Skip to content

Compiler crash when building swift-testing at commit 6a49142b223f214eff5da6c1224935a80e62e512 #79304

@hjyamauchi

Description

@hjyamauchi

Description

https://ci.swift.org/job/oss-swift-incremental-RA-macos-apple-silicon/8156/consoleText
https://ci-external.swift.org/job/swift-main-windows-toolchain/1055/consoleText

The swift compiler at head (commit a86743e77edd1f1a51e5f25d1b10b7cf0c8d24f7) crashes due to a SIL verification failure when building swift-testing at commit 6a49142b223f214eff5da6c1224935a80e62e512. It didn't crash with swift-testing at commit 63eb1d97e305befeea9cee3482a9ce38507a2cf6.

SIL verification failed: operand must match type required by pattern Verifying instruction: %17 = alloc_stack $Issue.Severity // users: %21, %19, %18 -> %19 = keypath $KeyPath<(keyPath: Array<String>, value: Optional<Event.HumanReadableOutputRecorder._Context.TestData>), Optional<Int>>, (root $(keyPath: Array<String>, value: Optional<Event.HumanReadableOutputRecorder._Context.TestData>); tuple_element #1 : $Optional<Event.HumanReadableOutputRecorder._Context.TestData>; optional_chain : $Event.HumanReadableOutputRecorder._Context.TestData; stored_property #Event.HumanReadableOutputRecorder._Context.TestData.issueCount : $Dictionary<Issue.Severity, Int>; settable_property $Optional<Int>, id @$sSDyq_Sgxcig : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@in_guaranteed τ_0_0, @guaranteed Dictionary<τ_0_0, τ_0_1>) -> @out Optional<τ_0_1>, getter @$sSDyq_SgxcipSDy7Testing5IssueV8SeverityOSiGAFSiTK : $@convention(keypath_accessor_getter) (@in_guaranteed Dictionary<Issue.Severity, Int>, @in_guaranteed Issue.Severity) -> @out Optional<Int>, setter @$sSDyq_SgxcipSDy7Testing5IssueV8SeverityOSiGAFSiTk : $@convention(keypath_accessor_setter) (@in_guaranteed Optional<Int>, @inout Dictionary<Issue.Severity, Int>, @in_guaranteed Issue.Severity) -> (), indices [%$0 : $Issue.Severity : $Issue.Severity], indices_equals @$s7Testing5IssueV8SeverityOTH : $@convention(keypath_accessor_equals) (@in_guaranteed Issue.Severity, @in_guaranteed Issue.Severity) -> Bool, indices_hash @$s7Testing5IssueV8SeverityOTh : $@convention(keypath_accessor_hash) (@in_guaranteed Issue.Severity) -> Int, external #Dictionary.subscript<Issue.Severity, Int>) (%17) // user: %20 %20 = move_value [lexical] [var_decl] %19 : $KeyPath<(keyPath: Array<String>, value: Optional<Event.HumanReadableOutputRecorder._Context.TestData>), Optional<Int>> // users: %33, %23 In function: // Event.HumanReadableOutputRecorder._issueCounts(in:) ... 

Full crash log:
compiler-crash-swift-testing.txt

Reproduction

Build swift-testing with the swift compiler built at head

Stack dump

1.	Apple Swift version 6.2-dev (LLVM 77c001641a849b9, Swift eb7706ded9d8d62) 2.	Compiling with the current language version 3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Users/ec2-user/jenkins/workspace/oss-swift-incremental-RA-macos-apple-silicon/swift-testing/Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift") 4.	While silgen emitFunction SIL function "@$s7Testing5EventV27HumanReadableOutputRecorderV12_issueCounts33_00ABC4D9283F1DC320C8520EB9A815F8LL2inSi15errorIssueCount_Si07warningsT0Si05knownsT0Si05totalsT0SS11descriptiontAA5GraphVySSAE8_ContextAGLLV8TestDataVSgGSg_tF". for '_issueCounts(in:)' (at /Users/ec2-user/jenkins/workspace/oss-swift-incremental-RA-macos-apple-silicon/swift-testing/Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift:118:11) 5.	While verifying SIL function "@$s7Testing5EventV27HumanReadableOutputRecorderV12_issueCounts33_00ABC4D9283F1DC320C8520EB9A815F8LL2inSi15errorIssueCount_Si07warningsT0Si05knownsT0Si05totalsT0SS11descriptiontAA5GraphVySSAE8_ContextAGLLV8TestDataVSgGSg_tF". for '_issueCounts(in:)' (at /Users/ec2-user/jenkins/workspace/oss-swift-incremental-RA-macos-apple-silicon/swift-testing/Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift:118:11) Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 swift-frontend 0x000000010716ec40 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56 1 swift-frontend 0x000000010716cefc llvm::sys::RunSignalHandlers() + 112 2 swift-frontend 0x000000010716f2e4 SignalHandler(int) + 352 3 libsystem_platform.dylib 0x000000018212ba24 _sigtramp + 56 4 libsystem_pthread.dylib 0x00000001820fccc0 pthread_kill + 288 5 libsystem_c.dylib 0x000000018200ca40 abort + 180 6 swift-frontend 0x0000000101df2564 swift::SILModule::print(llvm::raw_ostream&, swift::ModuleDecl*, swift::SILOptions const&, bool) const + 0 7 swift-frontend 0x0000000101e1e130 void llvm::function_ref<void (bool, llvm::StringRef)>::callback_fn<(anonymous namespace)::SILVerifier::checkKeyPathInst(swift::KeyPathInst*)::'lambda'(bool, llvm::StringRef)>(long, bool, llvm::StringRef) + 52 8 swift-frontend 0x0000000101df40cc (anonymous namespace)::verifyKeyPathComponent(swift::SILModule&, swift::TypeExpansionContext, swift::SerializedKind_t, llvm::function_ref<void (bool, llvm::StringRef)>, swift::CanType&, swift::CanType, swift::KeyPathPatternComponent const&, llvm::ArrayRef<swift::Operand>, swift::CanGenericSignature, swift::SubstitutionMap, bool, bool) + 3916 9 swift-frontend 0x0000000101e10fb8 swift::SILVisitorBase<(anonymous namespace)::SILVerifier, void>::visitSILBasicBlock(swift::SILBasicBlock*) + 93952 10 swift-frontend 0x0000000101df9fb8 (anonymous namespace)::SILVerifier::visitSILBasicBlock(swift::SILBasicBlock*) + 28 11 swift-frontend 0x0000000101df879c (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 10824 12 swift-frontend 0x0000000101df270c swift::SILFunction::verify(swift::CalleeCache*, bool, bool, bool) const + 208 13 swift-frontend 0x000000010145b3ec swift::Lowering::SILGenModule::postEmitFunction(swift::SILDeclRef, swift::SILFunction*) + 296 14 swift-frontend 0x000000010145ab60 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 6132 15 swift-frontend 0x000000010145bc88 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 252 16 swift-frontend 0x0000000101459350 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 168 17 swift-frontend 0x0000000101570ab8 SILGenExtension::visitFuncDecl(swift::FuncDecl*) + 172 18 swift-frontend 0x000000010156cfa4 SILGenExtension::emitExtension(swift::ExtensionDecl*) + 164 19 swift-frontend 0x000000010156cef4 swift::Lowering::SILGenModule::visitExtensionDecl(swift::ExtensionDecl*) + 24 20 swift-frontend 0x000000010145e0c0 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 160 21 swift-frontend 0x000000010145e5b0 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 616 22 swift-frontend 0x000000010155a7f4 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 132 23 swift-frontend 0x00000001014636cc swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 324 24 swift-frontend 0x000000010145eb64 swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 84 25 swift-frontend 0x0000000100e03c5c swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 608 26 swift-frontend 0x0000000100e0fbe0 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160 27 swift-frontend 0x0000000100e058e4 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 700 28 swift-frontend 0x0000000100e05140 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2180 29 swift-frontend 0x0000000100bb5fa8 swift::mainEntry(int, char const**) + 3140 30 dyld 0x0000000181d810e0 start + 2360 

Expected behavior

No crash

Environment

The swift-main-windows-toolchain CI.

The swift compiler at head (commit a86743e77edd1f1a51e5f25d1b10b7cf0c8d24f7) crashes due to a SIL verification failure when building swift-testing at commit 6a49142b223f214eff5da6c1224935a80e62e512 on windows.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    SILbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of software

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions