-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR-11630] Broken module found, compilation aborted! Trap 6 #54041
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
Comments
@swift-ci create |
As of now, it looks that it's something with ENABLE_TESTABILITY = YES |
This is the troublemaker code: public struct BlockModeOption: OptionSet {
public let rawValue: Int
public init(rawValue: Int) {
self.rawValue = rawValue
}
static let none = BlockModeOption(rawValue: 1 << 0)
static let initializationVectorRequired = BlockModeOption(rawValue: 1 << 1)
static let paddingRequired = BlockModeOption(rawValue: 1 << 2)
static let useEncryptToDecrypt = BlockModeOption(rawValue: 1 << 3)
} if I mark properties as "public" it will build with testability, otherwise it crashes |
This bug reproduced for me. Interestingly, I couldn’t reproduce it with SwiftPM—I had to open the xcworkspace instead. This is because one of the xcconfig files enables BUILD_LIBRARY_FOR_DISTRIBUTION; if I comment out that line, Swift compilation in Xcode completes and I get an ld error instead. After investigating, I think we’re running into trouble because we’re doing a Assertion failed: (isLoadableOrOpaque(Ty)), function createStruct, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/include/swift/SIL/SILBuilder.h, line 1230.
[snip]
1. Apple Swift version 5.1.1-dev (LLVM 6e04008c7f, Swift 9a4abf47a4)
2. While running pass #​250564 SILModuleTransform "GlobalOpt". -sil-verify-all does not narrow this down any further. lldb backtrace: * thread #​1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #​0: 0x00007fff6a66e49a libsystem_kernel.dylib`__pthread_kill + 10
frame #​1: 0x00007fff6a72b6cb libsystem_pthread.dylib`pthread_kill + 384
frame #​2: 0x00007fff6a5f6a1c libsystem_c.dylib`abort + 120
frame #​3: 0x00007fff6a5f5cd6 libsystem_c.dylib`__assert_rtn + 314
frame #​4: 0x0000000103f125d3 swift`swift::SILBuilder::createStruct(swift::SILLocation, swift::SILType, llvm::ArrayRef<swift::SILValue>) (.cold.1) + 35
frame #​5: 0x00000001008f984e swift`swift::SILBuilder::createStruct(this=<unavailable>, Loc=SILLocation @ 0x00007ffeefbf5810, Ty=<unavailable>, Elements=<unavailable>) at SILBuilder.h:1230:5 [opt]
frame #​6: 0x000000010051c063 swift`swift::SILCloner<swift::SILFunctionCloner>::visitStructInst(this=0x00007ffeefbf5b10, Inst=0x00000001235807c0) at SILCloner.h:1809:26 [opt]
frame #​7: 0x00000001005114cc swift`swift::SILCloner<swift::SILFunctionCloner>::visitBlocksDepthFirst(swift::SILBasicBlock*) at SILCloner.h:576:14 [opt]
frame #​8: 0x0000000100511490 swift`swift::SILCloner<swift::SILFunctionCloner>::visitBlocksDepthFirst(this=0x00007ffeefbf5b10, startBB=<unavailable>) at SILCloner.h:683 [opt]
frame #​9: 0x000000010051127f swift`swift::SILCloner<swift::SILFunctionCloner>::cloneFunctionBody(this=0x000000012769a790, F=<unavailable>, clonedEntryBB=0x00007ffeefbf5b10, entryArgs=<unavailable>) at SILCloner.h:630:3 [opt]
frame #​10: 0x0000000100510e07 swift`swift::SILFunctionCloner::cloneFunction(this=0x00007ffeefbf5b10, origF=0x00000001128a14d8) at SILCloner.h:515:14 [opt]
frame #​11: 0x000000010050c97d swift`(anonymous namespace)::SILGlobalOpt::run() [inlined] genGetterFromInit(FunctionBuilder=<unavailable>, InitF=0x00000001128a14d8, varDecl=<unavailable>) at GlobalOpt.cpp:562:10 [opt]
frame #​12: 0x000000010050c932 swift`(anonymous namespace)::SILGlobalOpt::run() [inlined] (anonymous namespace)::SILGlobalOpt::replaceLoadsByKnownValue(this=0x00007ffeefbf6118, CallToOnce=<unavailable>, AddrF=<unavailable>, InitF=0x00000001128a14d8, SILG=<unavailable>, InitVal=0x00000001235807c0, Calls=<unavailable>) at GlobalOpt.cpp:662 [opt]
frame #​13: 0x000000010050c7de swift`(anonymous namespace)::SILGlobalOpt::run() [inlined] (anonymous namespace)::SILGlobalOpt::optimizeInitializer(this=0x00007ffeefbf6118, AddrF=<unavailable>, Calls=<unavailable>) at GlobalOpt.cpp:760 [opt]
frame #​14: 0x000000010050c377 swift`(anonymous namespace)::SILGlobalOpt::run(this=0x00007ffeefbf6118) at GlobalOpt.cpp:961 [opt]
frame #​15: 0x000000010050b6b4 swift`(anonymous namespace)::SILGlobalOptPass::run(this=0x0000000124aa7180) at GlobalOpt.cpp:983:56 [opt]
frame #​16: 0x00000001005f357e swift`swift::SILPassManager::runModulePass(this=0x00007ffeefbf6418, TransIdx=14) at PassManager.cpp:557:8 [opt]
frame #​17: 0x00000001005f3f9a swift`swift::SILPassManager::execute(this=0x00007ffeefbf6418) at PassManager.cpp:623:7 [opt]
frame #​18: 0x00000001001b4c4b swift`swift::SILPassManager::executePassPipelinePlan(this=0x00007ffeefbf6418, Plan=0x00007ffeefbf65f0) at PassManager.h:269:7 [opt]
frame #​19: 0x00000001005fb5c5 swift`swift::runSILOptimizationPasses(Module=0x000000011a0ed2c0) at Passes.cpp:103:6 [opt]
frame #​20: 0x00000001002782f5 swift`swift::CompilerInstance::performSILProcessing(swift::SILModule*, swift::UnifiedStatsReporter*) [inlined] performSILOptimizations(Invocation=<unavailable>, SM=<unavailable>) at Frontend.cpp:1152:5 [opt]
frame #​21: 0x00000001002782ed swift`swift::CompilerInstance::performSILProcessing(this=0x0000000112005c00, silModule=0x000000011a0ed2c0, stats=0x0000000000000000) at Frontend.cpp:1185 [opt]
frame #​22: 0x000000010006aabf swift`performCompileStepsPostSILGen(Instance=0x00000000000000ba, Invocation=0x00007ffeefbf6ee8, SM=unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > @ 0x00007ffeefbf6e38, astGuaranteedToCorrespondToSIL=<unavailable>, MSF=<unavailable>, PSPs=0x00007ffeefbf6c80, moduleIsPublic=<unavailable>, ReturnValue=0x00007ffeefbf800c, observer=0x0000000000000000, Stats=0x0000000000000000) at FrontendTool.cpp:1355:16 [opt]
frame #​23: 0x000000010005fb1a swift`performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) [inlined] performCompileStepsPostSema(Invocation=<unavailable>, Instance=<unavailable>, ReturnValue=<unavailable>, observer=0x0000000000000000, Stats=<unavailable>) at FrontendTool.cpp:0 [opt]
frame #​24: 0x000000010005fa65 swift`performCompile(Instance=<unavailable>, Invocation=0x00007ffeefbf6ee8, Args=<unavailable>, ReturnValue=0x00007ffeefbf800c, observer=0x0000000000000000, Stats=0x0000000000000000) at FrontendTool.cpp:1150 [opt]
frame #​25: 0x000000010005d026 swift`swift::performFrontend(Args=<unavailable>, Argv0=<unavailable>, MainAddr=<unavailable>, observer=0x0000000000000000) at FrontendTool.cpp:1895:5 [opt]
frame #​26: 0x00000001000025b9 swift`main(argc_=<unavailable>, argv_=<unavailable>) at driver.cpp:273:12 [opt]
frame #​27: 0x00007fff6a51f2e5 libdyld.dylib`start + 1 The instruction it’s trying to clone (Inst in frame #6) is %5 in this basic block: sil_scope 1 { loc "/Users/brent/Downloads/CryptoSwift-master/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift":24:12 parent @globalinit_018_7DB1384D9A44D7634B13B25ECAE5EDEEA_func33 : $@convention(c) () -> () }
sil_scope 2 { loc "/Users/brent/Downloads/CryptoSwift-master/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift":24:47 parent 1 }
sil_scope 3 { loc "/Users/brent/Downloads/CryptoSwift-master/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift":19:12 parent @$s11CryptoSwift15BlockModeOptionV8rawValueACSi_tcfC : $@convention(method) (Int, @thin BlockModeOption.Type) -> @out BlockModeOption inlined_at 2 }
sil_scope 4 { loc "/Users/brent/Downloads/CryptoSwift-master/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift":19:32 parent 3 inlined_at 2 }
bb0:
alloc_global @$s11CryptoSwift15BlockModeOptionV28initializationVectorRequiredACvpZ // id: %0
%1 = global_addr @$s11CryptoSwift15BlockModeOptionV28initializationVectorRequiredACvpZ : $*BlockModeOption // user: %6
%2 = integer_literal $Builtin.Int64, 2 // user: %3
%3 = struct $Int (%2 : $Builtin.Int64) // users: %5, %4
debug_value %3 : $Int, let, name "rawValue", argno 1 // id: %4
%5 = struct $BlockModeOption (%3 : $Int) // user: %6 <===== crashes cloning this intruction
store %5 to %1 : $*BlockModeOption // id: %6
%7 = tuple () // user: %8
return %7 : $() // id: %8 The struct in question is: (struct_decl range=[/Users/brent/Downloads/CryptoSwift-master/Sources/CryptoSwift/BlockMode/BlockModeOptions.swift:16:8 - line:27:1] "BlockModeOption" interface type='BlockModeOption.Type' access=public resilient inherits: OptionSet
[snip] Note that we’re applying StructInst to a resilient struct from outside the module. Perhaps we’re inlining code from inside the module that isn’t valid from outside it? Or perhaps we were previously confused about the resilience expansion we should use? |
@krzyzanowskim Is this still relevant? |
Attachment: Download
Additional Detail from JIRA
md5: b06099272141edaa8c5a64a008703bfa
Issue Description:
Xcode 11.1 said I should report crash log, so I'm doing:
To reproduce, try to build Tests for https://github.com/krzyzanowskim/CryptoSwift
The text was updated successfully, but these errors were encountered: