Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-4717] Abort when running SILFunctionTransform Devirtualizer pass. #47294

Closed
swift-ci opened this issue Apr 27, 2017 · 3 comments
Closed

[SR-4717] Abort when running SILFunctionTransform Devirtualizer pass. #47294

swift-ci opened this issue Apr 27, 2017 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software optimized only Flag: An issue whose reproduction requires optimized compilation serialization Area → compiler: Serialization & deserialization

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-4717
Radar rdar://problem/31865136
Original Reporter andersha (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 8.3.2 (8E2002)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, OptimizedOnly, Serialization
Assignee None
Priority Medium

md5: 0989712d22af886df6236daddf8ad27e

Issue Description:

The compiler crashes when compiling the test in the provided project, when the framework is compiled with `-Owholemodule`. `-O` and `-Onone` work normally.

Specifically, it crashes when the test calls any default implementation of `MutableCollection` on a custom collection type that contains at least one `IndexSet` as its stored property. The crash does not happen if either (1) all `IndexSet`s are removed from the type; or (2) one avoids calling any of the `MutableCollection` method, except the required subscript setter which does not trigger the issue.

Log:

CompileSwift normal x86_64 /Users/anders/Repo/Crasher/CrasherLibTests/CrasherLibTests.swift
    cd /Users/anders/Repo/Crasher
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/anders/Repo/Crasher/CrasherLibTests/CrasherLibTests.swift -target x86_64-apple-ios10.3 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -I /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Products/Debug-iphonesimulator -F /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Products/Debug-iphonesimulator -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/anders/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -serialize-debugging-options -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/CrasherLibTests-generated-files.hmap -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/CrasherLibTests-own-target-headers.hmap -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/CrasherLibTests-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/CrasherLibTests-project-headers.hmap -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/DerivedSources/x86_64 -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/anders/Repo/Crasher -emit-module-doc-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.swiftdoc -serialize-diagnostics-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.dia -O -parse-as-library -module-name CrasherLibTests -emit-module-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.swiftmodule -emit-objc-header-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests-Swift.h -emit-dependencies-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.d -num-threads 4 -o /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.o

0  swift                    0x000000010d65f4f7 PrintStackTraceSignalHandler(void*) + 39
1  swift                    0x000000010d65e9a6 SignalHandler(int) + 646
2  libsystem_platform.dylib 0x00007fffd2839b3a _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 763127008
4  libsystem_c.dylib        0x00007fffd26be420 abort + 129
5  swift                    0x000000010b0c22e4 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 38404
6  swift                    0x000000010b0c4054 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1780
7  swift                    0x000000010b0c029d swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 30141
8  swift                    0x000000010b0d68ce swift::SILDeserializer::readSILInstruction(swift::SILFunction*, swift::SILBasicBlock*, swift::SILBuilder&, unsigned int, llvm::SmallVectorImpl<unsigned long long>&) + 3006
9  swift                    0x000000010b0d5351 swift::SILDeserializer::readSILFunction(llvm::PointerEmbeddedInt<unsigned int, 31>, swift::SILFunction*, llvm::StringRef, bool, bool) + 4785
10 swift                    0x000000010b0e0516 swift::SILDeserializer::lookupSILFunction(swift::SILFunction*) + 422
11 swift                    0x000000010b04c38b swift::SILLinkerVisitor::processFunction(swift::SILFunction*) + 299
12 swift                    0x000000010aecd503 (anonymous namespace)::Devirtualizer::run() + 1491
13 swift                    0x000000010ae0b320 swift::SILPassManager::runOneIteration() + 6192
14 swift                    0x000000010a5e075d swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 381
15 swift                    0x000000010a480bad swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 56253
16 swift                    0x000000010a42cd6c main + 9052
17 libdyld.dylib            0x00007fffd262a235 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/anders/Repo/Crasher/CrasherLibTests/CrasherLibTests.swift -target x86_64-apple-ios10.3 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -I /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Products/Debug-iphonesimulator -F /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Products/Debug-iphonesimulator -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/anders/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -serialize-debugging-options -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/CrasherLibTests-generated-files.hmap -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/CrasherLibTests-own-target-headers.hmap -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/CrasherLibTests-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/CrasherLibTests-project-headers.hmap -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/DerivedSources/x86_64 -Xcc -I/Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/anders/Repo/Crasher -emit-module-doc-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.swiftdoc -serialize-diagnostics-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.dia -O -parse-as-library -module-name CrasherLibTests -emit-module-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.swiftmodule -emit-objc-header-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests-Swift.h -emit-dependencies-path /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.d -num-threads 4 -o /Users/anders/Library/Developer/Xcode/DerivedData/Crasher-fraddilmnfpinhgvpmmqjgqovlir/Build/Intermediates/Crasher.build/Debug-iphonesimulator/CrasherLibTests.build/Objects-normal/x86_64/CrasherLibTests.o 
1.  While running pass #&#8203;2802 SILFunctionTransform "Devirtualizer" on SILFunction "@_TTSg5GVC10CrasherLib13ReactiveArray11MutableViewSi__GS1_Si__s17MutableCollectionS_GS1_Si__s22RandomAccessCollectionS____TFs10_partitionuRxs17MutableCollectionxs22RandomAccessCollectionWxPs10Collection8Iterator7Element_s10ComparablerFTRx8subRangeGVs5RangewxPs17_MutableIndexable5Index__wxS7_".
2.  While deserializing decl #&#8203;116 (XREF)in 'CrasherLib'
3.  Cross-reference to module 'Foundation'
    ... IndexSet
    ... _handle
4.  While deserializing decl #&#8203;160 (XREF)in 'CrasherLib'
5.  Cross-reference to module 'Foundation'
    ... _MutablePairHandle
@belkadan
Copy link
Contributor

@swift-ci create

@belkadan
Copy link
Contributor

belkadan commented Jul 5, 2017

Seems to be fixed in Xcode 9. Anders, mind trying this again in the most recent beta?

@swift-ci
Copy link
Collaborator Author

Comment by Anders Ha (JIRA)

Yes, `-Owholemodule` now works in Xcode 9 beta 5 under this scenario.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software optimized only Flag: An issue whose reproduction requires optimized compilation serialization Area → compiler: Serialization & deserialization
Projects
None yet
Development

No branches or pull requests

3 participants