Xcode 10 beta 6 compiler crash

xcode

#1

I just started getting the following compiler crash in beta 6.:

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


#2

Interesting note: This only happens during incremental compilation. If I use whole module, my code builds without any issue.


#3

This is still happening on Xcode 10 GM


(Joe Groff) #4

This sounds like a known issue in batch mode, also brought up in this thread. Disabling batch mode should work around the crash.


#5

Thanks for the quick reply @Joe_Groff! This may be a dumb question but is batch mode the same as Incremental compilation? If not, how do you disable it?


(Joe Groff) #6

According to @jrose, the problem may occur with incremental builds regardless of whether you're using the new batch mode. Disabling incremental builds or using whole module optimization should avoid the problem.