We are attempting to compile our project with Xcode 10 GM. We have been seeing Illegal instruction: 4
since the first beta.
We have reported this issue, but we cannot submit our code and have not been able to come up with a sample project to demonstrate the error.
The illegal instruction shows up on roughly 52 of our about 1000 swift files.
We have noticed that enabling whole module optimization for our project makes the issue disappear, but we would prefer to not always have that on and to take advantage of the incremental builds. Example:
SWIFT_COMPILATION_MODE[sdk=iphonesimulator12.0] = wholemodule
What are the next steps we should take to debugging the issue?
Swift Crash:
0 swift 0x00000001061cd64a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x00000001061ccdfe SignalHandler(int) + 302
2 libsystem_platform.dylib 0x00007fff609b3f5a _sigtramp + 26
3 libsystem_platform.dylib 0x0000000100fbe80a _sigtramp + 2690689226
4 swift 0x00000001024fc41a swift::irgen::ClangTypeConverter::convert(swift::irgen::IRGenModule&, swift::CanType) + 394
5 swift 0x00000001024fe9ea (anonymous namespace)::GenClangType::visitBoundGenericType(swift::CanTypeWrapper<swift::BoundGenericType>) + 650
6 swift 0x00000001024fc41a swift::irgen::ClangTypeConverter::convert(swift::irgen::IRGenModule&, swift::CanType) + 394
7 swift 0x00000001025c9348 getObjCEncodingForTypes(swift::irgen::IRGenModule&, swift::SILType, llvm::ArrayRef<swift::SILParameterInfo>, llvm::StringRef, unsigned long long, bool) + 88
8 swift 0x00000001025c908e getObjCEncodingForMethodType(swift::irgen::IRGenModule&, swift::CanTypeWrapper<swift::SILFunctionType>, bool) + 414
9 swift 0x00000001025c8d4e swift::irgen::emitObjCMethodDescriptorParts(swift::irgen::IRGenModule&, swift::AbstractFunctionDecl*, bool, bool, llvm::Constant*&, llvm::Constant*&, llvm::Constant*&) + 286
10 swift 0x0000000102507275 (anonymous namespace)::ClassDataBuilder::buildMethodList(llvm::ArrayRef<(anonymous namespace)::ClassDataBuilder::MethodDescriptor>, llvm::StringRef) + 949
11 swift 0x000000010250c536 swift::irgen::emitObjCProtocolData(swift::irgen::IRGenModule&, swift::ProtocolDecl*) + 1766
12 swift 0x00000001025c7b2f swift::irgen::IRGenModule::emitLazyObjCProtocolDefinitions() + 63
13 swift 0x000000010263be45 swift::irgen::IRGenModule::finalize() + 325
14 swift 0x0000000102620658 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
15 swift 0x0000000102460a10 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 46928
16 swift 0x0000000102451dc5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7717
17 swift 0x00000001023f7a35 main + 1349
18 libdyld.dylib 0x00007fff606a5015 start + 1