Skip to content

Compiler crash building Swift Testing branch that adopts typed throws #76930

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

Open
grynspan opened this issue Oct 9, 2024 · 0 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels typed throws Feature → error handling → throws & rethrows: Typed throws

Comments

@grynspan
Copy link
Contributor

grynspan commented Oct 9, 2024

Description

When I check out branch jgrynspan/typed-throws-crash from the Swift Testing repo and try to build, I get the attached crash.

Reproduction

  1. Check out jgrynspan/typed-throws-crash
  2. swift test

Stack dump

error: compile command failed due to signal 11 (use -v to see invocation)
error: compile command failed due to signal 11 (use -v to see invocation)
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Volumes/Dev/Source/swift-testing/Tests/TestingMacrosTests/ConditionMacroTests.swift -primary-file /Volumes/Dev/Source/swift-testing/Tests/TestingMacrosTests/TagMacroTests.swift /Volumes/Dev/Source/swift-testing/Tests/TestingMacrosTests/TestDeclarationMacroTests.swift /Volumes/Dev/Source/swift-testing/Tests/TestingMacrosTests/TestSupport/FixIts.swift /Volumes/Dev/Source/swift-testing/Tests/TestingMacrosTests/TestSupport/Parse.swift /Volumes/Dev/Source/swift-testing/Tests/TestingMacrosTests/UniqueIdentifierTests.swift -emit-dependencies-path /Volumes/Dev/Source/swift-testing/.build/arm64-apple-macosx/debug/TestingMacrosTests-tool.build/TagMacroTests.d -emit-reference-dependencies-path /Volumes/Dev/Source/swift-testing/.build/arm64-apple-macosx/debug/TestingMacrosTests-tool.build/TagMacroTests.swiftdeps -target arm64-apple-macosx13.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk -I /Volumes/Dev/Source/swift-testing/.build/arm64-apple-macosx/debug/Modules-tool -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Volumes/Dev/Source/swift-testing/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -D SWT_TARGET_OS_APPLE -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -load-plugin-executable /Volumes/Dev/Source/swift-testing/.build/arm64-apple-macosx/debug/TestingMacros-tool#TestingMacros -enable-experimental-feature "AvailabilityMacro=_mangledTypeNameAPI:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0" -enable-experimental-feature "AvailabilityMacro=_backtraceAsyncAPI:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0" -enable-experimental-feature "AvailabilityMacro=_clockAPI:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0" -enable-experimental-feature "AvailabilityMacro=_regexAPI:macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0" -enable-experimental-feature "AvailabilityMacro=_swiftVersionAPI:macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0" -enable-experimental-feature "AvailabilityMacro=_typedThrowsAPI:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0" -enable-experimental-feature "AvailabilityMacro=_distantFuture:macOS 99.0, iOS 99.0, watchOS 99.0, tvOS 99.0, visionOS 99.0" -enable-experimental-feature AccessLevelOnImport -enable-upcoming-feature ExistentialAny -enable-upcoming-feature InternalImportsByDefault -empty-abi-descriptor -blocklist-file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/blocklists/Optimizations.yaml -blocklist-file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/blocklists/modules.yml -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Volumes/Dev/Source/swift-testing -Xcc -fmodule-map-file=/Volumes/Dev/Source/swift-testing/.build/checkouts/swift-syntax/Sources/_SwiftSyntaxCShims/include/module.modulemap -Xcc -I -Xcc /Volumes/Dev/Source/swift-testing/.build/checkouts/swift-syntax/Sources/_SwiftSyntaxCShims/include -Xcc -fmodule-map-file=/Volumes/Dev/Source/swift-testing/Sources/_TestingInternals/include/module.modulemap -Xcc -I -Xcc /Volumes/Dev/Source/swift-testing/Sources/_TestingInternals/include -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name TestingMacrosTests -package-name swift_testing -disable-clang-spi -target-sdk-version 15.1 -target-sdk-name macosx15.1 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -parse-as-library -o /Volumes/Dev/Source/swift-testing/.build/arm64-apple-macosx/debug/TestingMacrosTests-tool.build/TagMacroTests.swift.o -index-store-path /Volumes/Dev/Source/swift-testing/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1.	Apple Swift version 6.0 (swiftlang-6.0.0.9.13 clang-1600.0.26.4)
2.	Compiling with the current language version
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Volumes/Dev/Source/swift-testing/Tests/TestingMacrosTests/TagMacroTests.swift")
4.	While silgen emitFunction SIL function "@$s18TestingMacrosTests08TagMacroC0V03tagE05input8typeNameySS_SStKF".
 for 'tagMacro(input:typeName:)' (at /Volumes/Dev/Source/swift-testing/Tests/TestingMacrosTests/TagMacroTests.swift:33:3)
5.	While silgen closureexpr SIL function "@$s18TestingMacrosTests08TagMacroC0V03tagE05input8typeNameySS_SStKFSbSi_SiyXEtXEfU0_".
 for expression at [@__swiftmacro_18TestingMacrosTests0024TagMacroTestsswift_ynAHffMX34_4_6expectfMf_.swift:1:50 - line:1:63] RangeText="{ $0 == $1() "
6.	While emitting reabstraction thunk in SIL function "@$sSis5NeverOIgrzr_SiIegd_TR".
 for <<debugloc at "<compiler-generated>":0:0>>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           0x00000001084369dc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000108434c30 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000108436fa8 SignalHandler(int) + 292
3  libsystem_platform.dylib 0x000000018deb4184 _sigtramp + 56
4  swift-frontend           0x000000010380c13c swift::Lowering::SILGenFunction::emitApplyWithRethrow(swift::SILLocation, swift::SILValue, swift::SILType, swift::SubstitutionMap, llvm::ArrayRef<swift::SILValue>) + 2288
5  swift-frontend           0x0000000103918200 buildThunkBody(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanType, llvm::function_ref<void (swift::Lowering::SILGenFunction&)>) + 1988
6  swift-frontend           0x000000010391a060 createThunk(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::TypeLowering const&) + 3840
7  swift-frontend           0x000000010390f798 (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::SILType, swift::Lowering::SGFContext) + 1700
8  swift-frontend           0x000000010390e794 swift::Lowering::SILGenFunction::emitOrigToSubstValue(swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 320
9  swift-frontend           0x00000001039339e4 (anonymous namespace)::EmitBBArguments::handleScalar(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::Initialization*, bool) + 1596
10 swift-frontend           0x000000010393509c swift::CanTypeVisitor<(anonymous namespace)::EmitBBArguments, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*>::visitBuiltinIntegerType(swift::CanTypeWrapper<swift::BuiltinIntegerType>, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*) + 96
11 swift-frontend           0x0000000103934f88 swift::CanTypeVisitor<(anonymous namespace)::EmitBBArguments, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*>::visit(swift::CanType, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*) + 2136
12 swift-frontend           0x0000000103932efc (anonymous namespace)::ArgumentInitHelper::makeArgument(swift::SILLocation, swift::ParamDecl*) + 1200
13 swift-frontend           0x0000000103931680 (anonymous namespace)::ArgumentInitHelper::emitParam(swift::ParamDecl*) + 360
14 swift-frontend           0x000000010393008c swift::Lowering::SILGenFunction::emitBasicProlog(swift::DeclContext*, swift::ParameterList*, swift::ParamDecl*, swift::Type, std::__1::optional<swift::Type>, swift::SourceLoc, unsigned int) + 2656
15 swift-frontend           0x000000010392d884 swift::Lowering::SILGenFunction::emitProlog(swift::DeclContext*, swift::CaptureInfo, swift::ParameterList*, swift::ParamDecl*, swift::Type, std::__1::optional<swift::Type>, swift::SourceLoc) + 160
16 swift-frontend           0x00000001038b01a0 swift::Lowering::SILGenFunction::emitClosure(swift::AbstractClosureExpr*) + 740
17 swift-frontend           0x00000001037fa9ac swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 4312
18 swift-frontend           0x00000001038045a8 void llvm::function_ref<void ()>::callback_fn<swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&)::$_0>(long) + 200
19 swift-frontend           0x00000001037fd6ac swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&) + 280
20 swift-frontend           0x00000001038a4608 (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 1984
21 swift-frontend           0x0000000103880428 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 40
22 swift-frontend           0x00000001038600d0 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)>) + 316
23 swift-frontend           0x00000001037dfd10 swift::Lowering::ArgumentSource::getConverted(swift::Lowering::SILGenFunction&, swift::Lowering::Conversion const&, swift::Lowering::SGFContext) && + 136
24 swift-frontend           0x000000010381f0f8 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 5528
25 swift-frontend           0x000000010380cf8c (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 216
26 swift-frontend           0x000000010381d848 (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 256
27 swift-frontend           0x0000000103829714 (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&) && + 664
28 swift-frontend           0x0000000103829134 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) + 1000
29 swift-frontend           0x0000000103811d18 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 2028
30 swift-frontend           0x00000001038102a4 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 3116
31 swift-frontend           0x0000000103880428 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 40
32 swift-frontend           0x000000010381ea90 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 3888
33 swift-frontend           0x000000010380cf8c (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 216
34 swift-frontend           0x000000010381d848 (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 256
35 swift-frontend           0x0000000103829714 (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&) && + 664
36 swift-frontend           0x000000010382903c (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) + 752
37 swift-frontend           0x0000000103811d18 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 2028
38 swift-frontend           0x00000001038102a4 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 3116
39 swift-frontend           0x0000000103880b10 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 888
40 swift-frontend           0x0000000103938110 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 5512
41 swift-frontend           0x00000001038afe64 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 492
42 swift-frontend           0x00000001037fb9b8 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 8420
43 swift-frontend           0x00000001037fc258 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 216
44 swift-frontend           0x00000001037f9888 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 364
45 swift-frontend           0x000000010394fb28 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 32
46 swift-frontend           0x000000010394c0d0 (anonymous namespace)::SILGenType::emitType() + 424
47 swift-frontend           0x00000001037f94c0 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 104
48 swift-frontend           0x00000001037ffed4 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 1804
49 swift-frontend           0x00000001039367c8 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&) + 196
50 swift-frontend           0x0000000103804db0 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'()) + 528
51 swift-frontend           0x0000000102ddf084 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 920
52 swift-frontend           0x0000000102de2378 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1680
53 swift-frontend           0x0000000102de10a8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3572
54 swift-frontend           0x0000000102d6816c swift::mainEntry(int, char const**) + 3680
55 dyld                     0x000000018dafc274 start + 2840
[231/328] Compiling TestingMacrosTests FixIts.swift
error: fatalError

Expected behavior

Does not crash, build completes (downstream failures may be present as this branch was a WIP when I was blocked by the crash.)

Environment

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.13 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0

Additional information

No response

@grynspan grynspan added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels typed throws Feature → error handling → throws & rethrows: Typed throws labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels typed throws Feature → error handling → throws & rethrows: Typed throws
Projects
None yet
Development

No branches or pull requests

1 participant