Skip to content

Swift 6.0.2 2024-10-28 compiler snapshot crashes on reproducer from #77365 #77447

Open
@jamieQ

Description

@jamieQ

Description

the Swift 6.0.2 release snapshot from 2024-10-28 crashes on the reproduction example for issue #77365

Reproduction

@main
struct S {
  static func main() async {
    await SharedActor.shared.test()
  }

  actor SharedActor {
    static let shared = SharedActor()

    deinit {
      print("DEINIT")
    }

    func test() {
      Task { [unowned self] in
        _ = self
      }
    }
  }
}

Stack dump

Assertion failed: (Ptr && "Cannot dereference a null GenericSignature!"), function operator->, file GenericSignature.h, line 139.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /Users/u44824/Library/Developer/Toolchains/swift-6.0.2-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/u44824/development/scratch-spm-tgt/Sources/tool.swift -emit-dependencies-path /Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Intermediates.noindex/scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/Objects-normal/arm64/tool.d -emit-const-values-path /Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Intermediates.noindex/scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/Objects-normal/arm64/tool.swiftconstvalues -emit-reference-dependencies-path /Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Intermediates.noindex/scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/Objects-normal/arm64/tool.swiftdeps -serialize-diagnostics-path /Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Intermediates.noindex/scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/Objects-normal/arm64/tool.dia -target arm64-apple-macos15.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode-16.0.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -I /Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Products/Debug -I /Applications/Xcode-16.0.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Products/Debug -F /Applications/Xcode-16.0.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -no-color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=5 -module-cache-path /Users/u44824/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 6 -enforce-exclusivity=checked -Onone -D SWIFT_PACKAGE -D DEBUG -D Xcode -serialize-debugging-options -const-gather-protocols-file /Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Intermediates.noindex/scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/Objects-normal/arm64/scratch-spm-tgt_const_extract_protocols.json -enable-experimental-feature DebugDescriptionMacro -enable-experimental-feature OpaqueTypeErasure -empty-abi-descriptor -plugin-path /Users/u44824/Library/Developer/Toolchains/swift-6.0.2-RELEASE.xctoolchain/usr/lib/swift/host/plugins -external-plugin-path /Applications/Xcode-16.0.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins/testing#/Applications/Xcode-16.0.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-plugin-server -validate-clang-modules-once -clang-build-session-file /Users/u44824/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -Xcc -working-directory -Xcc /Users/u44824/development/scratch-spm-tgt/.swiftpm/xcode -resource-dir /Users/u44824/Library/Developer/Toolchains/swift-6.0.2-RELEASE.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Users/u44824/development/scratch-spm-tgt/.swiftpm/xcode -Xcc -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -Xcc -I/Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Products/Debug/include -Xcc -I/Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Intermediates.noindex/scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/DerivedSources-normal/arm64 -Xcc -I/Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Intermediates.noindex/scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/DerivedSources/arm64 -Xcc -I/Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Intermediates.noindex/scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/DerivedSources -Xcc -DSWIFT_PACKAGE -Xcc -DDEBUG=1 -module-name scratch_spm_tgt -package-name scratch_spm_tgt -frontend-parseable-output -disable-clang-spi -plugin-path /Users/u44824/Library/Developer/Toolchains/swift-6.0.2-RELEASE.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/u44824/Library/Developer/Toolchains/swift-6.0.2-RELEASE.xctoolchain/usr/local/lib/swift/host/plugins -target-sdk-version 15.0 -target-sdk-name macosx15.0 -external-plugin-path /Applications/Xcode-16.0.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode-16.0.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-16.0.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode-16.0.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -parse-as-library -o /Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Build/Intermediates.noindex/scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/Objects-normal/arm64/tool.o -index-unit-output-path /scratch-spm-tgt.build/Debug/scratch-spm-tgt.build/Objects-normal/arm64/tool.o -index-store-path /Users/u44824/Library/Developer/Xcode/DerivedData/scratch-spm-tgt-ccjndfapzlaemxejeqtkuiqvbrfm/Index.noindex/DataStore -index-system-modules
1.	Apple Swift version 6.0.2 (swift-6.0.2-RELEASE)
2.	Compiling with the current language version
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Users/u44824/development/scratch-spm-tgt/Sources/tool.swift")
4.	While silgen emitFunction SIL function "@$s15scratch_spm_tgt1SV11SharedActorC4testyyF".
 for 'test()' (at /Users/u44824/development/scratch-spm-tgt/Sources/tool.swift:14:5)
5.	While silgen closureexpr SIL function "@$s15scratch_spm_tgt1SV11SharedActorC4testyyFyyYacfU_".
 for expression at [/Users/u44824/development/scratch-spm-tgt/Sources/tool.swift:15:12 - line:17:7] RangeText="{ [unowned self] in
        _ = self
      "
6.	While verifying SIL function "@$s15scratch_spm_tgt1SV11SharedActorC4testyyFyyYacfU_".
 for expression at [/Users/u44824/development/scratch-spm-tgt/Sources/tool.swift:15:12 - line:17:7] RangeText="{ [unowned self] in
        _ = self
      "
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           0x00000001074498d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 40
1  swift-frontend           0x0000000107447dc5 llvm::sys::RunSignalHandlers() + 85
2  swift-frontend           0x0000000107449f2e SignalHandler(int) + 270
3  libsystem_platform.dylib 0x00007ff80d182fdd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603370361245760
5  libsystem_c.dylib        0x00007ff80d079a79 abort + 126
6  libsystem_c.dylib        0x00007ff80d078d68 err + 0
7  swift-frontend           0x00000001078e6883 (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) (.cold.68) + 35
8  swift-frontend           0x000000010239f4b8 (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 14904
9  swift-frontend           0x0000000102397101 swift::SILFunction::verify(swift::CalleeCache*, bool, bool, bool) const + 241
10 swift-frontend           0x00000001018e1daa swift::Lowering::SILGenModule::postEmitFunction(swift::SILDeclRef, swift::SILFunction*) + 298
11 swift-frontend           0x00000001018e1365 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 6965
12 swift-frontend           0x00000001018ea3bb void llvm::function_ref<void ()>::callback_fn<swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&)::$_4>(long) + 203
13 swift-frontend           0x000000010230acda swift::Lowering::TypeConverter::withClosureTypeInfo(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&, llvm::function_ref<void ()>) + 138
14 swift-frontend           0x00000001018e33e5 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&) + 165
15 swift-frontend           0x0000000101984f43 (anonymous namespace)::RValueEmitter::emitClosureReference(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&) + 51
16 swift-frontend           0x0000000101984a9d (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 653
17 swift-frontend           0x00000001019847d4 swift::Lowering::ManagedValue llvm::function_ref<swift::Lowering::ManagedValue (swift::AbstractClosureExpr*)>::callback_fn<(anonymous namespace)::RValueEmitter::visitCaptureListExpr(swift::CaptureListExpr*, swift::Lowering::SGFContext)::$_14>(long, swift::AbstractClosureExpr*) + 36
18 swift-frontend           0x0000000101984773 emitCaptureListExpr(swift::Lowering::SILGenFunction&, swift::CaptureListExpr*, llvm::function_ref<swift::Lowering::ManagedValue (swift::AbstractClosureExpr*)>) + 131
19 swift-frontend           0x00000001019793ea (anonymous namespace)::RValueEmitter::visitCaptureListExpr(swift::CaptureListExpr*, swift::Lowering::SGFContext) + 74
20 swift-frontend           0x00000001019715ae swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 478
21 swift-frontend           0x000000010196690c swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 60
22 swift-frontend           0x00000001019462c1 swift::Lowering::SILGenFunction::emitConvertedRValue(swift::SILLocation, swift::Lowering::Conversion const&, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 433
23 swift-frontend           0x00000001019464ee swift::Lowering::ConvertingInitialization::tryPeephole(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::Conversion, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 286
24 swift-frontend           0x00000001019461db swift::Lowering::SILGenFunction::emitConvertedRValue(swift::SILLocation, swift::Lowering::Conversion const&, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 203
25 swift-frontend           0x00000001019463bf swift::Lowering::SILGenFunction::emitConvertedRValue(swift::Expr*, swift::Lowering::Conversion const&, swift::Lowering::SGFContext) + 95
26 swift-frontend           0x000000010197c2d0 (anonymous namespace)::RValueEmitter::visitFunctionConversionExpr(swift::FunctionConversionExpr*, swift::Lowering::SGFContext) + 2736
27 swift-frontend           0x00000001019716b4 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 740
28 swift-frontend           0x000000010196690c swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 60
29 swift-frontend           0x00000001019462c1 swift::Lowering::SILGenFunction::emitConvertedRValue(swift::SILLocation, swift::Lowering::Conversion const&, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 433
30 swift-frontend           0x00000001018c34cb swift::Lowering::ArgumentSource::getConverted(swift::Lowering::SILGenFunction&, swift::Lowering::Conversion const&, swift::Lowering::SGFContext) && + 171
31 swift-frontend           0x00000001019084b7 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 5463
32 swift-frontend           0x00000001018f47c8 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 296
33 swift-frontend           0x0000000101906285 (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 261
34 swift-frontend           0x000000010191426c (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && + 1068
35 swift-frontend           0x0000000101913981 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) + 1425
36 swift-frontend           0x00000001018f96ca (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 2202
37 swift-frontend           0x00000001018f72f2 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2450
38 swift-frontend           0x0000000101971419 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 73
39 swift-frontend           0x000000010196702f swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 1135
40 swift-frontend           0x0000000101a1c120 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 6496
41 swift-frontend           0x0000000101a1a7b5 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
42 swift-frontend           0x0000000101992464 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 500
43 swift-frontend           0x00000001018e133e swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 6926
44 swift-frontend           0x00000001018e2362 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 258
45 swift-frontend           0x00000001018df800 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 192
46 swift-frontend           0x0000000101a353c5 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 21
47 swift-frontend           0x0000000101a3164e (anonymous namespace)::SILGenType::emitType() + 334
48 swift-frontend           0x0000000101a315da (anonymous namespace)::SILGenType::emitType() + 218
49 swift-frontend           0x0000000101a314f9 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 25
50 swift-frontend           0x00000001018e5376 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 1190
51 swift-frontend           0x0000000101a1a1c1 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 129
52 swift-frontend           0x00000001018eb229 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'()) + 345
53 swift-frontend           0x00000001018e5f32 swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 114
54 swift-frontend           0x00000001011d84e1 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 753
55 swift-frontend           0x00000001011e72df withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 143
56 swift-frontend           0x00000001011dac07 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 967
57 swift-frontend           0x00000001011da04f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2927
58 swift-frontend           0x0000000100fbfdec swift::mainEntry(int, char const**) + 2636
59 dyld                     0x0000000214c1e366 start + 1942

Expected behavior

compiler does not crash

Environment

toolchain bundle id: org.swift.6020202410241a

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwaretriage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions