<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">We discovered a problem recently where we would miscompile when imported ObjC lightweight generic classes are extended to conform to Swift protocols. This is being tracked by Apple as <a href="rdar://problem/28873860" class="">rdar://problem/28873860</a>, for reference, and should be release noted in upcoming Xcode seeds. If you happen to be extending any ObjC generic classes to conform to Swift protocols, there are a couple of workarounds that may work:<div class=""><br class=""></div><div class="">- making the protocol @objc, if possible, or</div><div class="">- wrapping the ObjC class reference in a generic struct, and making that struct conform to the protocol instead of the class.</div><div class=""><br class=""></div><div class="">Does that help at all?</div><div class=""><br class=""></div><div class="">-Joe<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 21, 2016, at 9:44 AM, Evan Maloney via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">This is definitely not my first time hitting Swift compiler crashes :)<div class=""><br class=""></div><div class="">In the past, the stack traces have been helpful, pointing to what code the compiler was working on when it crashed. Unfortunately, this latest crash doesn't fall into that category:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">CompileSwift normal x86_64 /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/Sources/iOS/FormBuilder/Row.swift</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> cd /Users/emaloney/Documents/Code/CleanroomProject/AppleTart</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -filelist /var/folders/gn/gt76_ktx7w1010xg4v68p3txynz8ws/T/sources-a27d97 -primary-file /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/Sources/iOS/FormBuilder/Row.swift -target x86_64-apple-ios9.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -I /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Products/Debug-iphonesimulator -F /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Products/Debug-iphonesimulator -F /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/Carthage/Checkouts/AppleApiDocClients/build/Debug -F /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/Carthage/Checkouts/AppleTapstreamClient/build/Debug -F /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/Carthage/Checkouts/PromiseKit/build/Debug -enable-testing -g -import-objc-header /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/BuildControl/Bridging-Header.h -module-cache-path /Users/emaloney/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/AppleTart-generated-files.hmap -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/AppleTart-own-target-headers.hmap -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/AppleTart-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/AppleTart-project-headers.hmap -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Products/Debug-iphonesimulator/CardIO.framework/Headers -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/DerivedSources/x86_64 -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/emaloney/Documents/Code/CleanroomProject/AppleTart -emit-module-doc-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row~partial.swiftdoc -Onone -module-name AppleTart -emit-module-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row~partial.swiftmodule -serialize-diagnostics-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row.dia -emit-dependencies-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row.d -emit-reference-dependencies-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row.swiftdeps -o /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row.o</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">0 swift 0x000000010e668b6d PrintStackTraceSignalHandler(void*) + 45</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">1 swift 0x000000010e6685b6 SignalHandler(int) + 470</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">2 libsystem_platform.dylib 0x00007fff94a7b52a _sigtramp + 26</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">3 libsystem_platform.dylib 0x0000000000000004 _sigtramp + 1800948468</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">4 swift 0x000000010baa58d2 llvm::Value* llvm::function_ref<llvm::Value* (unsigned int)>::callback_fn<swift::irgen::emitArchetypeWitnessTableRef(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::ArchetypeType>, swift::ProtocolDecl*)::$_0>(long, unsigned int) + 530</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">5 swift 0x000000010bb83600 swift::irgen::emitImpliedWitnessTableRef(swift::irgen::IRGenFunction&, llvm::ArrayRef<swift::irgen::ProtocolEntry>, swift::ProtocolDecl*, llvm::function_ref<llvm::Value* (unsigned int)> const&) + 240</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">6 swift 0x000000010baa56a7 swift::irgen::emitArchetypeWitnessTableRef(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::ArchetypeType>, swift::ProtocolDecl*) + 247</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">7 swift 0x000000010bb7f9cd swift::SILWitnessVisitor<(anonymous namespace)::WitnessTableBuilder>::visitProtocolDecl(swift::ProtocolDecl*) + 5997</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">8 swift 0x000000010bb7d4d7 swift::irgen::IRGenModule::emitSILWitnessTable(swift::SILWitnessTable*) + 503</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">9 swift 0x000000010baef8ed swift::irgen::IRGenerator::emitGlobalTopLevel() + 2077</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">10 swift 0x000000010bbb0fcb performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1259</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">11 swift 0x000000010ba7f1c7 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 23687</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">12 swift 0x000000010ba77265 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17029</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">13 swift 0x000000010ba3482d main + 8685</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">14 libdyld.dylib 0x00007fff8ab5c5ad start + 1</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">Stack dump:</div><div style="margin: 0px 0px 0px 12px; text-indent: -12px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">0.<span class="Apple-tab-span" style="white-space:pre">        </span>Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -filelist /var/folders/gn/gt76_ktx7w1010xg4v68p3txynz8ws/T/sources-a27d97 -primary-file /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/Sources/iOS/FormBuilder/Row.swift -target x86_64-apple-ios9.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -I /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Products/Debug-iphonesimulator -F /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Products/Debug-iphonesimulator -F /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/Carthage/Checkouts/AppleApiDocClients/build/Debug -F /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/Carthage/Checkouts/AppleTapstreamClient/build/Debug -F /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/Carthage/Checkouts/PromiseKit/build/Debug -enable-testing -g -import-objc-header /Users/emaloney/Documents/Code/CleanroomProject/AppleTart/BuildControl/Bridging-Header.h -module-cache-path /Users/emaloney/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/AppleTart-generated-files.hmap -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/AppleTart-own-target-headers.hmap -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/AppleTart-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/AppleTart-project-headers.hmap -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Products/Debug-iphonesimulator/CardIO.framework/Headers -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/DerivedSources/x86_64 -Xcc -I/Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/emaloney/Documents/Code/CleanroomProject/AppleTart -emit-module-doc-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row~partial.swiftdoc -Onone -module-name AppleTart -emit-module-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row~partial.swiftmodule -serialize-diagnostics-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row.dia -emit-dependencies-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row.d -emit-reference-dependencies-path /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row.swiftdeps -o /Users/emaloney/Library/Developer/Xcode/DerivedData/AppleTart-gydtadecugkemlbxcybcwsxuynku/Build/Intermediates/AppleTart.build/Debug-iphonesimulator/AppleTart-iOS.build/Objects-normal/x86_64/Row.o </div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 21, 2016, at 12:41 PM, Jon Shier <<a href="mailto:jon@jonshier.com" class="">jon@jonshier.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">With Swift 3 I’ve found these crashes to be indicative of an underlying source issue rather than something random in the compiler. When you get the crash, can you get the backtrace in the Xcode build log? Sometimes that has clues about what it was doing when it crashed. A lot of the time when the crash is during the parsing or SIL generation for one of your functions, it will note it and you can take a look, as there may be a type mismatch. <br class=""><br class=""><br class=""><br class="">Jon<br class=""><br class=""><blockquote type="cite" class="">On Oct 21, 2016, at 12:26 PM, Evan Maloney via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:<br class=""><br class="">After a gargantuan effort updating our entire codebase to Swift 3.0, we are now being greeted with "Segmentation fault: 11" compiler crash whenever attempting to build.<br class=""><br class="">The issue seems to be related to generics, and sounds similar to this issue:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://stackoverflow.com/questions/39426535/segmentation-fault-11-xcode-8-swift-3-after-using-notificationcenter/39426812" class="">http://stackoverflow.com/questions/39426535/segmentation-fault-11-xcode-8-swift-3-after-using-notificationcenter/39426812</a><br class=""><br class="">I've filed a bug report that includes our project codebase, which triggers the issue 100% of the time:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="rdar://problem/28890409" class="">rdar://problem/28890409</a><br class=""><br class="">The usual work-around of turning off Whole Module Optimization (which has gotten around a lot of compiler crashes in the past) does not work here.<br class=""><br class="">Unfortunately, this code is in such a tangle of generics that undoing it is not going to be simple. Until a new version of Xcode ships, we're pretty much blocked from using Swift 3.0 unless another work-around is possible.<br class="">_______________________________________________<br class="">swift-users mailing list<br class="">swift-users@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></div></div></body></html>