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-10796] Segmentation fault when compiling project #53186

Closed
swift-ci opened this issue May 30, 2019 · 1 comment
Closed

[SR-10796] Segmentation fault when compiling project #53186

swift-ci opened this issue May 30, 2019 · 1 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

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-10796
Radar rdar://problem/51262618
Original Reporter kansaichris (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode Version 10.2.1 (10E1001)

Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)

Target: x86_64-apple-darwin18.6.0

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

md5: 81809a15f7f43e232b39b4cab58508c1

Issue Description:

When attempting to compile the attached project, Xcode crashes with a segmentation fault. Here's the full stack trace:

Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/chris/Developer/Test/Test/DatabaseQueue.swift /Users/chris/Developer/Test/Test/DatabaseTable.swift -primary-file /Users/chris/Developer/Test/Test/SQLStatement.swift /Users/chris/Developer/Test/Test/DatabaseColumn.swift /Users/chris/Developer/Test/Test/main.swift /Users/chris/Developer/Test/Test/DatabaseRecord.swift /Users/chris/Developer/Test/Test/Database.swift -emit-module-path /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Objects-normal/x86_64/SQLStatement~partial.swiftmodule -emit-module-doc-path /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Objects-normal/x86_64/SQLStatement~partial.swiftdoc -serialize-diagnostics-path /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Objects-normal/x86_64/SQLStatement.dia -emit-dependencies-path /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Objects-normal/x86_64/SQLStatement.d -emit-reference-dependencies-path /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Objects-normal/x86_64/SQLStatement.swiftdeps -target x86_64-apple-macosx10.14 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Products/Debug -F /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Products/Debug -enable-testing -g -module-cache-path /Users/chris/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/chris/Developer/Test -enable-anonymous-context-mangled-names -Xcc -I/Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Test-generated-files.hmap -Xcc -I/Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Test-own-target-headers.hmap -Xcc -I/Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Test-all-target-headers.hmap -Xcc -iquote -Xcc /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Test-project-headers.hmap -Xcc -I/Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Products/Debug/include -Xcc -I/Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/DerivedSources-normal/x86_64 -Xcc -I/Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/DerivedSources/x86_64 -Xcc -I/Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/DerivedSources -Xcc -DDEBUG=1 -module-name Test -o /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Build/Intermediates.noindex/Test.build/Debug/Test.build/Objects-normal/x86_64/SQLStatement.o -index-store-path /Users/chris/Library/Developer/Xcode/DerivedData/Test-ebygnmmrxgssllbzrtfugnyaxtsa/Index/DataStore -index-system-modules 
1.  While emitting IR SIL function "@$s4Test12SQLStatementO12ColumnOptionO4hash4intoys6HasherVz_tF".
 for 'hash(into:)' (in module 'Test')
0  swift                    0x0000000110b18ee3 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x0000000110b186bc SignalHandler(int) + 348
2  libsystem_platform.dylib 0x00007fff647aab5d _sigtramp + 29
3  libsystem_platform.dylib 0x0000000000000003 _sigtramp + 2609206467
4  swift                    0x000000010c9c6b22 swift::irgen::emitArchetypeWitnessTableRef(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::ArchetypeType>, swift::ProtocolDecl*) + 402
5  swift                    0x000000010cb0de9c swift::irgen::emitWitnessTableRef(swift::irgen::IRGenFunction&, swift::CanType, llvm::Value**, swift::ProtocolConformanceRef) + 204
6  swift                    0x000000010cb163f0 swift::irgen::emitGenericRequirementFromSubstitutions(swift::irgen::IRGenFunction&, swift::CanGenericSignature, swift::ModuleDecl&, swift::irgen::GenericRequirement, swift::SubstitutionMap) + 256
7  swift                    0x000000010cb16254 void llvm::function_ref<void (swift::irgen::GenericRequirement)>::callback_fn<(anonymous namespace)::EmitPolymorphicArguments::emit(swift::SubstitutionMap, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&)::$_22>(long, swift::irgen::GenericRequirement) + 36
8  swift                    0x000000010cb13b72 void llvm::function_ref<void (swift::irgen::GenericRequirement)>::callback_fn<(anonymous namespace)::PolymorphicConvention::enumerateUnfulfilledRequirements(llvm::function_ref<void (swift::irgen::GenericRequirement)> const&)::$_12>(long, swift::irgen::GenericRequirement) + 162
9  swift                    0x000000010cb13aaf (anonymous namespace)::PolymorphicConvention::enumerateUnfulfilledRequirements(llvm::function_ref<void (swift::irgen::GenericRequirement)> const&) + 319
10 swift                    0x000000010cb15fd5 swift::irgen::emitPolymorphicArguments(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::SILFunctionType>, swift::SubstitutionMap, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&) + 501
11 swift                    0x000000010cb9b6b6 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2022
12 swift                    0x000000010cb7ba4a swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9898
13 swift                    0x000000010ca395c0 swift::irgen::IRGenerator::emitGlobalTopLevel(bool) + 1232
14 swift                    0x000000010cb5b414 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1076
15 swift                    0x000000010c97d319 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 49433
16 swift                    0x000000010c96d92e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
17 swift                    0x000000010c90b9ce main + 1246
18 libdyld.dylib            0x00007fff645bf3d5 start + 1
error: Segmentation fault: 11

For what it's worth, I've found that the Swift compiler will stop crashing if I replace the following two lines in SQLStatement.swift:

enum SQLStatement<Table: DatabaseTable> {
    typealias Column = Table.Column

with this:

enum SQLStatement<Column: DatabaseColumn> {

Interestingly enough, the Swift compiler will also stop crashing if I simply delete DatabaseQueue.swift (but not if I comment out its contents).

Hope this helps!

@DougGregor
Copy link
Member

This is fixed on master

@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
Projects
None yet
Development

No branches or pull requests

3 participants