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-3894] Segmentation fault in swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) #46479

Closed
tonyarnold opened this issue Feb 8, 2017 · 9 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 serialization Area → compiler: Serialization & deserialization

Comments

@tonyarnold
Copy link
Contributor

Previous ID SR-3894
Radar rdar://problem/30435295
Original Reporter @tonyarnold
Type Bug
Status Resolved
Resolution Done

Attachment: Download

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

md5: 9cb3c4b9508a6b277dd207c19fe5267a

Issue Description:

I'm experiencing a segmentation fault (11) when compiling Diff.swift (https://github.com/wokalski/Diff.swift) (previously featured in SR-3605, SR-3707 and SR-3815). This is happening both with Xcode 8.3-beta.2, and with the latest 3.1 snapshot posted to Swift.org (swift-3.1-DEVELOPMENT-SNAPSHOT-2017-02-05-a-osx.pkg).

Showing Recent Issues
MergeSwiftModule normal x86_64 /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff.swiftmodule
    cd /Users/tonyarnold/Documents/Repositories/Diff.swift
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/ExtendedDiff~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/LinkedList~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/GenericPatch~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Patch~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/NestedExtendedDiff~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Patch+Sort~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff+UIKit~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Patch+Apply~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/ExtendedPatch+Apply~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/ExtendedPatch~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/NestedDiff~partial.swiftmodule -parse-as-library -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Products/Debug -F /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Products/Debug -enable-testing -g -import-underlying-module -module-cache-path /Users/tonyarnold/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Diff-generated-files.hmap -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Diff-own-target-headers.hmap -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Diff-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Diff-project-headers.hmap -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Products/Debug/include -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/DerivedSources/x86_64 -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -ivfsoverlay -Xcc /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/tonyarnold/Documents/Repositories/Diff.swift -emit-module-doc-path /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff.swiftdoc -module-name Diff -emit-objc-header-path /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff-Swift.h -o /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff.swiftmodule

0  swift                    0x000000010d1efad7 PrintStackTraceSignalHandler(void*) + 39
1  swift                    0x000000010d1eef86 SignalHandler(int) + 646
2  libsystem_platform.dylib 0x00007fff9d869b3a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fa579f90460 _sigtramp + 3698485568
4  swift                    0x000000010ac5fef1 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 529
5  swift                    0x000000010ac605b4 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2260
6  swift                    0x000000010ac607d9 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2809
7  swift                    0x000000010ac6013e swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1118
8  swift                    0x000000010ac5e1de swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 36270
9  swift                    0x000000010ac6a768 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 600
10 swift                    0x000000010b089fcd swift::NominalTypeDecl::lookupDirect(swift::DeclName, bool) + 349
11 swift                    0x000000010ac5cfce swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 31646
12 swift                    0x000000010ac6051a swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2106
13 swift                    0x000000010ac605b4 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2260
14 swift                    0x000000010ac607d9 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2809
15 swift                    0x000000010ac5a1ac swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 19836
16 swift                    0x000000010ac5feae swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 462
17 swift                    0x000000010ac5fee9 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 521
18 swift                    0x000000010ac605b4 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2260
19 swift                    0x000000010ac6012f swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1103
20 swift                    0x000000010ac5e1de swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 36270
21 swift                    0x000000010ac8533c swift::ModuleFile::getTopLevelDecls(llvm::SmallVectorImpl<swift::Decl*>&) + 1980
22 swift                    0x000000010a9a4f40 swift::SILPassManager::SILPassManager(swift::SILModule*, llvm::StringRef) + 1376
23 swift                    0x000000010a9abb9f swift::runSILDiagnosticPasses(swift::SILModule&) + 159
24 swift                    0x000000010a01be53 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 42803
25 swift                    0x0000000109fcb51c main + 9052
26 libdyld.dylib            0x00007fff9d65a235 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/ExtendedDiff~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/LinkedList~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/GenericPatch~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Patch~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/NestedExtendedDiff~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Patch+Sort~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff+UIKit~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Patch+Apply~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/ExtendedPatch+Apply~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/ExtendedPatch~partial.swiftmodule /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/NestedDiff~partial.swiftmodule -parse-as-library -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Products/Debug -F /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Products/Debug -enable-testing -g -import-underlying-module -module-cache-path /Users/tonyarnold/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Diff-generated-files.hmap -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Diff-own-target-headers.hmap -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Diff-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Diff-project-headers.hmap -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Products/Debug/include -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/DerivedSources/x86_64 -Xcc -I/Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -ivfsoverlay -Xcc /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/tonyarnold/Documents/Repositories/Diff.swift -emit-module-doc-path /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff.swiftdoc -module-name Diff -emit-objc-header-path /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff-Swift.h -o /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/Diff.swiftmodule 
1.  While reading from /Users/tonyarnold/Library/Developer/Xcode/DerivedData/Diff-cwkcgngzpswbmsbnrrwznvrgrach/Build/Intermediates/Diff.build/Debug/Diff.build/Objects-normal/x86_64/ExtendedPatch~partial.swiftmodule
2.  While deserializing 'extendedPatch' (FuncDecl #&#8203;35)in 'Diff'
3.  While deserializing 'OrderedBefore' (TypeAliasDecl #&#8203;95)in 'Diff'
4.  While deserializing decl #&#8203;132 (XREF)in 'Diff'
5.  Cross-reference to module 'Diff'
    ... ExtendedDiff
    ... Element
6.  While loading members for extension of ExtendedDiff in module 'Diff'
7.  While deserializing 'patch' (FuncDecl #&#8203;96)in 'Diff'
@belkadan
Copy link
Contributor

belkadan commented Feb 8, 2017

@swift-ci create

@belkadan
Copy link
Contributor

belkadan commented Feb 8, 2017

It's amazing that this one project keeps turning up new issues, and that we keep introducing those new issues.

@tonyarnold
Copy link
Contributor Author

It's the one function declaration, too. Is it too complex, or could it be better formed somehow?

@belkadan
Copy link
Contributor

belkadan commented Feb 9, 2017

I suspect that's just the first mildly complex declaration that trips up the problem. If you delete that one function out, it'll probably crash on something else.

@tonyarnold
Copy link
Contributor Author

OK, I'll leave it alone and let you guys do your magic. Thanks, Jordan!

@belkadan
Copy link
Contributor

Hm, this is succeeding for me on a build of master from yesterday, but I don't think anything would have changed since the snapshot you mentioned. Are you sure the snapshot was turned on?

@tonyarnold
Copy link
Contributor Author

Well, that's confusing. Yes, you are right, it does work with swift-3.1-DEVELOPMENT-SNAPSHOT-2017-02-08-a-osx. I don't have the older snapshot still installed to check, but in any case this issue appears to be resolved/bogus. Thanks!

@tonyarnold
Copy link
Contributor Author

Yeah, confirmed - this bug does not affect swift-3.1-DEVELOPMENT-SNAPSHOT-2017-02-05-a. You are right, I must not have activated the snapshot.

I'm sorry I wasted your time on this!

@belkadan
Copy link
Contributor

At least the fix was easy. :-)

@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 serialization Area → compiler: Serialization & deserialization
Projects
None yet
Development

No branches or pull requests

3 participants