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-8540] Xcode 10 Beta 6 Swift 4.2 compiler crash #51059
Comments
Comment by Joel Loeshelle (JIRA) I unfortunately haven't been able to narrow down the exact files it's crashing on - it happens on 26 files and building each one separately seems to work. If you have any suggestions on how to do that or any things to look out for, I can post some sample code. |
I was hoping the build log would have information about which protocol it's trying to emit, but I guess not. Any chance you can attach the entire project? (If not publicly, you can still file it just with Apple at https://bugreport.apple.com.) |
Comment by Joel Loeshelle (JIRA) @belkadan I don't know if I'll be able to file the entire project, but I can try to look for a file that matches something that would go through this code path. Would it be a Swift protocol that can get bridged to Objective-C? And would it be one of the files that has the failure or could it also be a dependency? |
I'm not sure, exactly. I think it'll be an I'll add some logging to the master compiler to say what protocol's being emitted, at least. |
Comment by Joel Loeshelle (JIRA) Thanks for the quick update with more debugging info! I downloaded the daily toolchain and actually ran into another issue (attached project). It looks like it happens when someone doesn't implement an optional objc protocol method that references a Swift class. Unfortunately I have a bunch of those in my project so I'm working my way and trying to fix them so I can reproduce the original issue. |
I suspect it's actually a related issue, since we are talking about protocols here. The daily snapshots have assertions turned on, which the Xcode toolchains don't. |
@swift-ci create |
#18844 fixes the crash on master. The sample project doesn't crash with Beta 6, though, and this code has changed significantly enough that I don't think the crash on master is related to the crash in Beta 6. |
Comment by Joel Loeshelle (JIRA) So I got around to testing the daily snapshot from August 21. After fixing my assertion errors, I didn't run into any Swift compiler crashes on my project! Once the next Xcode beta comes out, I'll confirm the crash doesn't show up anymore. |
Are you talking about the "Trunk Development (master)" snapshot? That one has the fix, and I'm glad that was the only issue remaining for your project on our master branch (which will become Swift 5). However, my fix did not go into Swift 4.2, and the sample project didn't crash for me with Xcode 10 beta 6, so I'm concerned that we haven't fixed your problem. Does your project crash with one of the "Swift 4.2 Development" snapshots? |
Comment by Joel Loeshelle (JIRA) Ah great call - I was using the master snapshot. Unfortunately when using the 4.2 snapshot from August 21, I see a new crash: Unexpected non-pointer generic struct type in imported Clang module!
UNREACHABLE executed at /Users/buildnode/jenkins/workspace/oss-swift-4.2-package-osx/swift/lib/IRGen/GenClangType.cpp:474!
0 swift 0x000000010cf4c488 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010cf4b6e7 llvm::sys::RunSignalHandlers() + 39
2 swift 0x000000010cf4cb02 SignalHandler(int) + 258
3 libsystem_platform.dylib 0x00007fff651fdf5a _sigtramp + 26
4 libsystem_platform.dylib 0x000000011a073314 _sigtramp + 3035059156
5 libsystem_c.dylib 0x00007fff64f9b1ae abort + 127
6 swift 0x000000010ceebf74 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 532
7 swift 0x000000010980564c (anonymous namespace)::GenClangType::visitBoundGenericType(swift::CanTypeWrapper<swift::BoundGenericType>) + 1036
8 swift 0x0000000109802035 swift::CanTypeVisitor<(anonymous namespace)::GenClangType, clang::CanQual<clang::Type> >::visit(swift::CanType) + 261
9 swift 0x0000000109801d53 swift::irgen::ClangTypeConverter::convert(swift::irgen::IRGenModule&, swift::CanType) + 163
10 swift 0x00000001098052bd (anonymous namespace)::GenClangType::visitBoundGenericType(swift::CanTypeWrapper<swift::BoundGenericType>) + 125
11 swift 0x0000000109802035 swift::CanTypeVisitor<(anonymous namespace)::GenClangType, clang::CanQual<clang::Type> >::visit(swift::CanType) + 261
12 swift 0x0000000109801d53 swift::irgen::ClangTypeConverter::convert(swift::irgen::IRGenModule&, swift::CanType) + 163
13 swift 0x00000001098994db getObjCEncodingForTypes(swift::irgen::IRGenModule&, swift::SILType, llvm::ArrayRef<swift::SILParameterInfo>, llvm::StringRef, unsigned long long, bool) + 267
14 swift 0x00000001098985a9 getObjCEncodingForMethodType(swift::irgen::IRGenModule&, swift::CanTypeWrapper<swift::SILFunctionType>, bool) + 313
15 swift 0x00000001098981bc swift::irgen::emitObjCMethodDescriptorParts(swift::irgen::IRGenModule&, swift::AbstractFunctionDecl*, bool, bool, llvm::Constant*&, llvm::Constant*&, llvm::Constant*&) + 268
16 swift 0x000000010989914e swift::irgen::emitObjCMethodDescriptor(swift::irgen::IRGenModule&, swift::irgen::ConstantArrayBuilder&, swift::AbstractFunctionDecl*) + 46
17 swift 0x0000000109810591 (anonymous namespace)::ClassDataBuilder::buildMethodList(llvm::ArrayRef<(anonymous namespace)::ClassDataBuilder::MethodDescriptor>, llvm::StringRef) + 497
18 swift 0x000000010980b047 swift::irgen::emitObjCProtocolData(swift::irgen::IRGenModule&, swift::ProtocolDecl*) + 1591
19 swift 0x0000000109895d85 swift::irgen::IRGenModule::emitLazyObjCProtocolDefinition(swift::ProtocolDecl*) + 21
20 swift 0x0000000109896041 swift::irgen::IRGenModule::emitLazyObjCProtocolDefinitions() + 65
21 swift 0x000000010990679c swift::irgen::IRGenModule::finalize() + 268
22 swift 0x00000001098e4a5c 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**, unsigned int) + 1788
23 swift 0x00000001098e4e0e swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, unsigned int, llvm::GlobalVariable**) + 94
24 swift 0x000000010977fbe0 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 15536
25 swift 0x000000010977af22 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2946
26 swift 0x0000000109735d08 main + 1128
27 libdyld.dylib 0x00007fff64eef015 start + 1
28 libdyld.dylib 0x00000000000000c6 start + 2601586866 |
Hello 🙂 0 swift 0x000000010cb2a64a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x000000010cb29dfe SignalHandler(int) + 302
2 libsystem_platform.dylib 0x00007fff6c472b3d _sigtramp + 29
3 libsystem_malloc.dylib 0x00007fff6c436807 malloc_zone_malloc + 103
4 swift 0x0000000108e5941a swift::irgen::ClangTypeConverter::convert(swift::irgen::IRGenModule&, swift::CanType) + 394
5 swift 0x0000000108f26348 getObjCEncodingForTypes(swift::irgen::IRGenModule&, swift::SILType, llvm::ArrayRef<swift::SILParameterInfo>, llvm::StringRef, unsigned long long, bool) + 88
6 swift 0x0000000108f2608e getObjCEncodingForMethodType(swift::irgen::IRGenModule&, swift::CanTypeWrapper<swift::SILFunctionType>, bool) + 414
7 swift 0x0000000108f25d4e swift::irgen::emitObjCMethodDescriptorParts(swift::irgen::IRGenModule&, swift::AbstractFunctionDecl*, bool, bool, llvm::Constant*&, llvm::Constant*&, llvm::Constant*&) + 286
8 swift 0x0000000108e64275 (anonymous namespace)::ClassDataBuilder::buildMethodList(llvm::ArrayRef<(anonymous namespace)::ClassDataBuilder::MethodDescriptor>, llvm::StringRef) + 949
9 swift 0x0000000108e69536 swift::irgen::emitObjCProtocolData(swift::irgen::IRGenModule&, swift::ProtocolDecl*) + 1766
10 swift 0x0000000108f24b2f swift::irgen::IRGenModule::emitLazyObjCProtocolDefinitions() + 63
11 swift 0x0000000108f98e45 swift::irgen::IRGenModule::finalize() + 325
12 swift 0x0000000108f7d658 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**, unsigned int) + 1960
13 swift 0x0000000108dbda10 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 46928
14 swift 0x0000000108daedc5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7717
15 swift 0x0000000108d54a35 main + 1349
16 libdyld.dylib 0x00007fff6c289085 start + 1
17 libdyld.dylib 0x000000000000011e start + 2480369818 |
Fixed by #18844 |
jml5qh (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"? Thanks! |
Attachment: Download
Environment
Xcode 10 Beta 6
Swift 4.2
Incremental compilation
Additional Detail from JIRA
md5: c5ba30ef9ccc22036c74ed90d7267466
relates to:
Issue Description:
This crash just started happening on Xcode 10 Beta 6. I am on Swift 4.2. This also only happens when I turn on Incremental Builds. Whole Module builds works.
0 swift 0x000000010a1bd37a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x000000010a1bcb2e SignalHandler(int) + 302
2 libsystem_platform.dylib 0x00007fff6c27af5a _sigtramp + 26
3 swift 0x00000001079e1a52 swift::TypeBase::getMemberSubstitutionMap(swift::ModuleDecl*, swift::ValueDecl const*, swift::GenericEnvironment*) + 418
4 swift 0x000000010651d9ba swift::irgen::ClangTypeConverter::convert(swift::irgen::IRGenModule&, swift::CanType) + 394
5 swift 0x000000010651ff8a (anonymous namespace)::GenClangType::visitBoundGenericType(swift::CanTypeWrapperswift::BoundGenericType) + 650
6 swift 0x000000010651d9ba swift::irgen::ClangTypeConverter::convert(swift::irgen::IRGenModule&, swift::CanType) + 394
7 swift 0x00000001065e91b7 getObjCEncodingForTypes(swift::irgen::IRGenModule&, swift::SILType, llvm::ArrayRefswift::SILParameterInfo, llvm::StringRef, unsigned long long, bool) + 279
8 swift 0x00000001065e8e3e getObjCEncodingForMethodType(swift::irgen::IRGenModule&, swift::CanTypeWrapperswift::SILFunctionType, bool) + 414
9 swift 0x00000001065e8afe swift::irgen::emitObjCMethodDescriptorParts(swift::irgen::IRGenModule&, swift::AbstractFunctionDecl*, bool, bool, llvm::Constant*&, llvm::Constant*&, llvm::Constant*&) + 286
10 swift 0x000000010652880d (anonymous namespace)::ClassDataBuilder::buildMethodList(llvm::ArrayRef<(anonymous namespace)::ClassDataBuilder::MethodDescriptor>, llvm::StringRef) + 925
11 swift 0x000000010652dac6 swift::irgen::emitObjCProtocolData(swift::irgen::IRGenModule&, swift::ProtocolDecl*) + 1766
12 swift 0x00000001065e78ff swift::irgen::IRGenModule::emitLazyObjCProtocolDefinitions() + 63
13 swift 0x0000000106657665 swift::irgen::IRGenModule::finalize() + 325
14 swift 0x000000010663c278 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::_1::unique_ptr<swift::SILModule, std::_1::default_deleteswift::SILModule >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**, unsigned int) + 1960
15 swift 0x0000000106482c60 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 46928
16 swift 0x0000000106474015 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7717
17 swift 0x0000000106419c95 main + 1349
18 libdyld.dylib 0x00007fff6bf6c015 start + 1
19 libdyld.dylib 0x00000000000000c6 start + 2483634354
The text was updated successfully, but these errors were encountered: