-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
SILGenArea → compiler: The SIL generation stageArea → compiler: The SIL generation stageassertion failureBug → crash: An assertion failureBug → crash: An assertion failurebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarevalue capturingFeature: Value capturing by closures and local functionsFeature: Value capturing by closures and local functions
Description
The following hits an assert in SILGen:
do {
func foo() -> Any { x }
lazy var x = foo()
}Assertion failed: (existing->second == context && "closure shouldn't be emitted with different capture type expansion contexts"), function setCaptureTypeExpansionContext, file TypeLowering.cpp, line 5381.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Users/hamish/src/swift-dev/build/Release/swift-macosx-arm64/bin/swift-frontend -typecheck /Users/hamish/src/swift-test-arena/swift-test-arena/main.swift -sdk /Users/hamish/src/MacOSX.sdk -debug-diagnostic-names -emit-silgen
1. Swift version 6.3-dev (LLVM 4d15cb92d0756cd, Swift 8c1e0c83ec0408e)
2. Compiling with effective version 5.10
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module main)
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 0x000000010667be60 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000106679b68 llvm::sys::RunSignalHandlers() + 172
2 swift-frontend 0x000000010667c948 SignalHandler(int, __siginfo*, void*) + 344
3 libsystem_platform.dylib 0x000000019678e744 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000196784888 pthread_kill + 296
5 libsystem_c.dylib 0x000000019668a808 abort + 124
6 libsystem_c.dylib 0x0000000196689a3c err + 0
7 swift-frontend 0x00000001066cbfd4 swift::Lowering::TypeConverter::setLoweredAddresses() (.cold.8) + 0
8 swift-frontend 0x000000010118d440 swift::Lowering::TypeConverter::setCaptureTypeExpansionContext(swift::SILDeclRef, swift::SILModule&) + 436
9 swift-frontend 0x0000000100e0f340 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 128
10 swift-frontend 0x0000000101da9a78 swift::AbstractStorageDecl::visitExpectedOpaqueAccessors(llvm::function_ref<void (swift::AccessorKind)>) const + 68
11 swift-frontend 0x0000000101da9a1c swift::AbstractStorageDecl::visitEmittedAccessors(llvm::function_ref<void (swift::AccessorDecl*)>) const + 160
12 swift-frontend 0x0000000100e13cf0 swift::Lowering::SILGenModule::visitEmittedAccessors(swift::AbstractStorageDecl*, llvm::function_ref<void (swift::AccessorDecl*)>) + 48
13 swift-frontend 0x0000000100e6b330 swift::Lowering::SILGenFunction::visitVarDecl(swift::VarDecl*) + 160
14 swift-frontend 0x0000000100f0e6c4 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 5388
15 swift-frontend 0x0000000100f0d1ac swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 24
16 swift-frontend 0x0000000100f1adb0 swift::Lowering::SILGenTopLevel::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 156
17 swift-frontend 0x0000000100f19608 swift::Lowering::SILGenTopLevel::visitSourceFile(swift::SourceFile*) + 100
18 swift-frontend 0x0000000100f18e44 swift::Lowering::SILGenModule::emitEntryPoint(swift::SourceFile*, swift::SILFunction*) + 776
19 swift-frontend 0x0000000100f1a744 swift::Lowering::SILGenModule::emitEntryPoint(swift::SourceFile*) + 268
20 swift-frontend 0x0000000100e144dc swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 780
21 swift-frontend 0x0000000100e14760 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 608
22 swift-frontend 0x0000000100f0cbd0 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&) + 136
23 swift-frontend 0x0000000100e18764 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'())::'lambda'()::operator()() const + 84
24 swift-frontend 0x0000000100e18680 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'()) + 320
25 swift-frontend 0x0000000100e14a34 swift::performASTLowering(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 120
26 swift-frontend 0x0000000100837b10 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*, llvm::ArrayRef<char const*>) + 2712
27 swift-frontend 0x00000001008475c4 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 164
28 swift-frontend 0x000000010083b19c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*, llvm::ArrayRef<char const*>) + 556
29 swift-frontend 0x0000000100838d54 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2448
30 swift-frontend 0x00000001005d3804 swift::mainEntry(int, char const**) + 3244
31 dyld 0x00000001963c5d54 start + 7184
Metadata
Metadata
Assignees
Labels
SILGenArea → compiler: The SIL generation stageArea → compiler: The SIL generation stageassertion failureBug → crash: An assertion failureBug → crash: An assertion failurebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarevalue capturingFeature: Value capturing by closures and local functionsFeature: Value capturing by closures and local functions