Skip to content

[6.0.1] Compiler crashes when attempting to compile Swift Foundation. Failed to reconstruct type. #76788

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
sbhat98 opened this issue Sep 30, 2024 · 5 comments
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 Darwin IRGen LLVM IR generation

Comments

@sbhat98
Copy link

sbhat98 commented Sep 30, 2024

Description

When attempting to compile the latest branch of Swift Foundation (https://github.com/swiftlang/swift-foundation/) using the swift.org release of Swift 6.0.1 on MacOS, the compiler crashes.

Reproduction

  1. Clone https://github.com/swiftlang/swift-foundation/. (Tested when main pointed to b2d323e)
  2. Run swift test

Stack dump

Failed to reconstruct type for $s6Darwin14POSIXErrorCodeOD
Original type:
(enum_type decl="_errno.(file).POSIXErrorCode")
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Pass '-Xfrontend -disable-round-trip-debug-types' to disable this assertion.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-6.0.1-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -c -filelist /var/folders/cj/0w4bb6k17375x2djs9w7k0x80000gn/T/TemporaryDirectory.oxtmqV/sources-1 -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Data/Pointers+DataProtocol.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Date.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/DateInterval.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Decimal/Decimal+Compatibility.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Decimal/Decimal+Conformances.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Decimal/Decimal+Math.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Decimal/Decimal.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Error/CocoaError+FilePath.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Error/CocoaError.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Error/ErrorCodes+POSIX.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Error/ErrorCodes+Win32.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Error/ErrorCodes.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/FileManager/FileManager+Basics.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/FileManager/FileManager+Bridge.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/FileManager/FileManager+Directories.swift -primary-file /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/FileManager/FileManager+Files.swift -supplementary-output-file-map /var/folders/cj/0w4bb6k17375x2djs9w7k0x80000gn/T/TemporaryDirectory.oxtmqV/supplementaryOutputs-4 -target x86_64-apple-macosx13.3 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -I /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/Modules -I /Library/Developer/Toolchains/swift-6.0.1-RELEASE.xctoolchain/usr/lib/swift/macosx/testing -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 /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -load-plugin-executable /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationMacros-tool#FoundationMacros -enable-experimental-feature VariadicGenerics -enable-experimental-feature AccessLevelOnImport -enable-experimental-feature "AvailabilityMacro=FoundationPreview 0.1:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4" -enable-experimental-feature "AvailabilityMacro=FoundationPredicate 0.1:macOS 14, iOS 17, tvOS 17, watchOS 10" -enable-experimental-feature "AvailabilityMacro=FoundationPredicateRegex 0.1:macOS 15, iOS 18, tvOS 18, watchOS 11" -enable-experimental-feature "AvailabilityMacro=FoundationPreview 0.2:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4" -enable-experimental-feature "AvailabilityMacro=FoundationPredicate 0.2:macOS 14, iOS 17, tvOS 17, watchOS 10" -enable-experimental-feature "AvailabilityMacro=FoundationPredicateRegex 0.2:macOS 15, iOS 18, tvOS 18, watchOS 11" -enable-experimental-feature "AvailabilityMacro=FoundationPreview 0.3:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4" -enable-experimental-feature "AvailabilityMacro=FoundationPredicate 0.3:macOS 14, iOS 17, tvOS 17, watchOS 10" -enable-experimental-feature "AvailabilityMacro=FoundationPredicateRegex 0.3:macOS 15, iOS 18, tvOS 18, watchOS 11" -enable-experimental-feature "AvailabilityMacro=FoundationPreview 0.4:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4" -enable-experimental-feature "AvailabilityMacro=FoundationPredicate 0.4:macOS 14, iOS 17, tvOS 17, watchOS 10" -enable-experimental-feature "AvailabilityMacro=FoundationPredicateRegex 0.4:macOS 15, iOS 18, tvOS 18, watchOS 11" -enable-experimental-feature "AvailabilityMacro=FoundationPreview 6.0.2:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4" -enable-experimental-feature "AvailabilityMacro=FoundationPredicate 6.0.2:macOS 14, iOS 17, tvOS 17, watchOS 10" -enable-experimental-feature "AvailabilityMacro=FoundationPredicateRegex 6.0.2:macOS 15, iOS 18, tvOS 18, watchOS 11" -enable-experimental-feature StrictConcurrency -enable-upcoming-feature InferSendableFromCaptures -empty-abi-descriptor -plugin-path /Library/Developer/Toolchains/swift-6.0.1-RELEASE.xctoolchain/usr/lib/swift/host/plugins/testing -resource-dir /Library/Developer/Toolchains/swift-6.0.1-RELEASE.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Users/shishir/code/swift-foundation -Xcc -fmodule-map-file=/Users/shishir/code/swift-foundation/.build/checkouts/swift-syntax/Sources/_SwiftSyntaxCShims/include/module.modulemap -Xcc -I -Xcc /Users/shishir/code/swift-foundation/.build/checkouts/swift-syntax/Sources/_SwiftSyntaxCShims/include -Xcc -fmodule-map-file=/Users/shishir/code/swift-foundation/Sources/_FoundationCShims/include/module.modulemap -Xcc -I -Xcc /Users/shishir/code/swift-foundation/Sources/_FoundationCShims/include -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name FoundationEssentials -package-name swift_foundation -plugin-path /Library/Developer/Toolchains/swift-6.0.1-RELEASE.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Library/Developer/Toolchains/swift-6.0.1-RELEASE.xctoolchain/usr/local/lib/swift/host/plugins -target-sdk-version 15.0 -target-sdk-name macosx15.0 -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 -parse-as-library -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/Pointers+DataProtocol.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/Date.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/DateInterval.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/Decimal+Compatibility.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/Decimal+Conformances.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/Decimal+Math.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/Decimal.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/CocoaError+FilePath.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/CocoaError.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/ErrorCodes+POSIX.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/ErrorCodes+Win32.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/ErrorCodes.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/FileManager+Basics.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/FileManager+Bridge.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/FileManager+Directories.swift.o -o /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/FoundationEssentials.build/FileManager+Files.swift.o -index-store-path /Users/shishir/code/swift-foundation/.build/x86_64-apple-macosx/debug/index/store -index-system-modules
1.  Apple Swift version 6.0.1 (swift-6.0.1-RELEASE)
2.  Compiling with effective version 5.10
3.  Contents of /var/folders/cj/0w4bb6k17375x2djs9w7k0x80000gn/T/TemporaryDirectory.oxtmqV/sources-1:
4.  While evaluating request IRGenRequest(IR Generation for file "/Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Error/CocoaError+FilePath.swift")
5.  While emitting IR SIL function "@$s20FoundationEssentials10POSIXErrorV5errnoACSgs5Int32V_tc33_FBA71097CBDF77AA6E663B7714FA1434LlfC".
 for 'init(errno:)' (at /Users/shishir/code/swift-foundation/Sources/FoundationEssentials/Error/CocoaError+FilePath.swift:73:17)
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           0x000000010e60c458 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 40
1  swift-frontend           0x000000010e60a945 llvm::sys::RunSignalHandlers() + 85
2  swift-frontend           0x000000010e60caae SignalHandler(int) + 270
3  libsystem_platform.dylib 0x00007ff802876e9d _sigtramp + 29
4  libsystem_platform.dylib 0x00007f8846accd68 _sigtramp + 18446743593816514280
5  libsystem_c.dylib        0x00007ff802762b19 abort + 126
6  swift-frontend           0x000000010e6ffbfd (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) (.cold.23) + 141
7  swift-frontend           0x000000010896633b (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) + 4699
8  swift-frontend           0x000000010895f37a (anonymous namespace)::IRGenDebugInfoImpl::emitVariableDeclaration(swift::irgen::IRBuilder&, llvm::ArrayRef<llvm::Value*>, swift::irgen::DebugTypeInfo, swift::SILDebugScope const*, std::__1::optional<swift::SILLocation>, swift::SILDebugVariable, swift::irgen::IndirectionKind, swift::irgen::ArtificialKind, swift::irgen::AddrDbgInstrKind) + 602
9  swift-frontend           0x000000010895f0dc swift::irgen::IRGenDebugInfo::emitVariableDeclaration(swift::irgen::IRBuilder&, llvm::ArrayRef<llvm::Value*>, swift::irgen::DebugTypeInfo, swift::SILDebugScope const*, std::__1::optional<swift::SILLocation>, swift::SILDebugVariable, swift::irgen::IndirectionKind, swift::irgen::ArtificialKind, swift::irgen::AddrDbgInstrKind) + 300
10 swift-frontend           0x00000001089c9e9a (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 94074
11 swift-frontend           0x00000001089b1eac (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 11884
12 swift-frontend           0x00000001089ae9f3 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 2339
13 swift-frontend           0x00000001088197b4 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) + 820
14 swift-frontend           0x000000010894ebe3 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 2755
15 swift-frontend           0x00000001089adbbf swift::GeneratedModule swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 223
16 swift-frontend           0x00000001089ada9e swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 14
17 swift-frontend           0x0000000108958221 swift::IRGenRequest::OutputType swift::Evaluator::getResultUncached<swift::IRGenRequest, swift::IRGenRequest::OutputType swift::evaluateOrFatal<swift::IRGenRequest>(swift::Evaluator&, swift::IRGenRequest)::'lambda'()>(swift::IRGenRequest const&, swift::IRGenRequest::OutputType swift::evaluateOrFatal<swift::IRGenRequest>(swift::Evaluator&, swift::IRGenRequest)::'lambda'()) + 209
18 swift-frontend           0x0000000108951460 swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 304
19 swift-frontend           0x00000001083a3234 generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>) + 180
20 swift-frontend           0x000000010839ecf7 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1575
21 swift-frontend           0x000000010839de6e swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 830
22 swift-frontend           0x00000001083acc1f withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 143
23 swift-frontend           0x00000001083a0547 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 967
24 swift-frontend           0x000000010839f98f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2927
25 swift-frontend           0x000000010818572c swift::mainEntry(int, char const**) + 2636
26 dyld                     0x00007ff8024b42cd start + 1805

error: fatalError

Expected behavior

The code builds without error

Environment

$ swift --version

Apple Swift version 6.0.1 (swift-6.0.1-RELEASE)
Target: x86_64-apple-macosx15.0

Additional information

It's unclear if this is a regression from 6.0.0 since there was another issue causing this to be unable to be built in the previous version (#76534)

@sbhat98 sbhat98 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 labels Sep 30, 2024
@jmschonfeld jmschonfeld added IRGen LLVM IR generation Darwin and removed triage needed This issue needs more specific labels labels Oct 8, 2024
@ulian-onua
Copy link

I can confirm that I also have a similar Swift Compiler crash when trying to build Swift Package for the iOS app.

image

@IamYJLee
Copy link

Workaround

You can disable this assertion by adding the option to Other Swift Flags as shown below.

image

@toffaletti
Copy link
Contributor

Workaround if using swiftpm:

swift build -Xswiftc '-disable-round-trip-debug-types'

@nikitabobko
Copy link

nikitabobko commented Apr 3, 2025

Simple reproducer:

public extension Sequence {
    func sumOf(_ selector: (Self.Element) -> CGFloat) -> CGFloat {
        var result: CGFloat = 0
        for elem in self {
            result += selector(elem)
        }
        return result
    }
}

For some reason I can only reproduce it if I use swift via swiftly. Swift from Xcode doesn't crash

Crashes with:

Failed to reconstruct type for $s7ElementSTQz12CoreGraphics7CGFloatVIgnd_D
Original type:
(sil_function_type type="@noescape @callee_guaranteed (@in_guaranteed \xCF\x84_0_0.Element) -> CGFloat"
  (dependent_member_type assoc_type="Swift.(file).Sequence.Element"
    (base=generic_type_param_type depth=0 index=0 param_kind=type))
  (struct_type decl="CoreFoundation.(file).CGFloat")
  (substitution_map null_generic_signature)
  (substitution_map null_generic_signature))
Generic signature: <τ_0_0 where τ_0_0 : Sequence>
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Pass '-Xfrontend -disable-round-trip-debug-types' to disable this assertion.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/bobko/a/swift-sandbox/Sources/_main.swift -emit-dependencies-path _main.d -emit-reference-dependencies-path _main.swiftdeps -target arm64-apple-macosx13.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -I /Users/bobko/a/swift-sandbox/.build/arm64-apple-macosx/debug/Modules -I /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/macosx/testing -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/PrivateFrameworks -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Users/bobko/a/swift-sandbox/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -entry-point-function-name swift_sandbox_main -empty-abi-descriptor -plugin-path /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/host/plugins/testing -resource-dir /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Users/bobko/a/swift-sandbox -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/PrivateFrameworks -Xcc -fPIC -Xcc -g -module-name swift_sandbox -package-name swift_sandbox -in-process-plugin-server-path /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/local/lib/swift/host/plugins -target-sdk-version 15.4 -target-sdk-name macosx15.4 -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 -parse-as-library -o _main.o -index-store-path /Users/bobko/a/swift-sandbox/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1.      Apple Swift version 6.1 (swift-6.1-RELEASE)
2.      Compiling with the current language version
3.      While evaluating request IRGenRequest(IR Generation for file "/Users/bobko/a/swift-sandbox/Sources/_main.swift")
4.      While emitting IR SIL function "@$sST13swift_sandboxE5sumOfy12CoreGraphics7CGFloatVAE7ElementQzXEF".
 for 'sumOf(_:)' (at /Users/bobko/a/swift-sandbox/Sources/_main.swift:14:5)
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           0x00000001075db884 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x00000001075d9fb0 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x00000001075dbec8 SignalHandler(int) + 292
3  libsystem_platform.dylib 0x0000000186b0ade4 _sigtramp + 56
4  libsystem_pthread.dylib  0x0000000186ad3f70 pthread_kill + 288
5  libsystem_c.dylib        0x00000001869e0908 abort + 128
6  swift-frontend           0x000000010767e95c (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo, llvm::DIScope*) (.cold.24) + 0
7  swift-frontend           0x000000010278c9c0 (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo, llvm::DIScope*) + 4124
8  swift-frontend           0x000000010278cd18 (anonymous namespace)::IRGenDebugInfoImpl::createParameterTypes(swift::CanTypeWrapper<swift::SILFunctionType>) + 752
9  swift-frontend           0x0000000102786040 (anonymous namespace)::IRGenDebugInfoImpl::emitFunction(swift::SILDebugScope const*, llvm::Function*, swift::SILFunctionTypeRepresentation, swift::SILType, swift::DeclContext*, llvm::StringRef) + 1636
10 swift-frontend           0x00000001027c6adc (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 1104
11 swift-frontend           0x00000001027c60ec swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1812
12 swift-frontend           0x000000010266aca0 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) + 728
13 swift-frontend           0x000000010277a5f8 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 2396
14 swift-frontend           0x00000001027c5608 swift::GeneratedModule swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)17>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 200
15 swift-frontend           0x0000000102781d90 swift::IRGenRequest::OutputType swift::Evaluator::getResultUncached<swift::IRGenRequest, swift::IRGenRequest::OutputType swift::evaluateOrFatal<swift::IRGenRequest>(swift::Evaluator&, swift::IRGenRequest)::'lambda'()>(swift::IRGenRequest const&, swift::IRGenRequest::OutputType swift::evaluateOrFatal<swift::IRGenRequest>(swift::Evaluator&, swift::IRGenRequest)::'lambda'()) + 212
16 swift-frontend           0x000000010277c434 swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 208
17 swift-frontend           0x00000001022f08dc generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>) + 156
18 swift-frontend           0x00000001022ed5d4 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1372
19 swift-frontend           0x00000001022eca3c swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 468
20 swift-frontend           0x00000001022f8b50 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 164
21 swift-frontend           0x00000001022ee74c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 716
22 swift-frontend           0x00000001022edf68 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2228
23 swift-frontend           0x00000001020d18f0 swift::mainEntry(int, char const**) + 3064
24 dyld                     0x0000000186754274 start + 2840

nikitabobko added a commit to nikitabobko/AeroSpace that referenced this issue Apr 3, 2025
Now when I use swiftly, I managed to reproduce the crash locally

swiftlang/swift#76788

    Failed to reconstruct type for $s7ElementSTQz12CoreGraphics7CGFloatVIgnd_D
    Original type:
    (sil_function_type type="@NoEscape @callee_guaranteed (@in_guaranteed \xCF\x84_0_0.Element) -> CGFloat"
      (dependent_member_type assoc_type="Swift.(file).Sequence.Element"
        (base=generic_type_param_type depth=0 index=0 param_kind=type))
      (struct_type decl="CoreFoundation.(file).CGFloat")
      (substitution_map null_generic_signature)
      (substitution_map null_generic_signature))
    Generic signature: <τ_0_0 where τ_0_0 : Sequence>
    Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
    Pass '-Xfrontend -disable-round-trip-debug-types' to disable this assertion.
    Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
    Stack dump:
    0.      Program arguments: /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/bobko/a/swift-sandbox/Sources/_main.swift -emit-dependencies-path _main.d -emit-reference-dependencies-path _main.swiftdeps -target arm64-apple-macosx13.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -I /Users/bobko/a/swift-sandbox/.build/arm64-apple-macosx/debug/Modules -I /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/macosx/testing -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/PrivateFrameworks -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Users/bobko/a/swift-sandbox/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -entry-point-function-name swift_sandbox_main -empty-abi-descriptor -plugin-path /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/host/plugins/testing -resource-dir /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Users/bobko/a/swift-sandbox -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/PrivateFrameworks -Xcc -fPIC -Xcc -g -module-name swift_sandbox -package-name swift_sandbox -in-process-plugin-server-path /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/bobko/Library/Developer/Toolchains/swift-6.1-RELEASE.xctoolchain/usr/local/lib/swift/host/plugins -target-sdk-version 15.4 -target-sdk-name macosx15.4 -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 -parse-as-library -o _main.o -index-store-path /Users/bobko/a/swift-sandbox/.build/arm64-apple-macosx/debug/index/store -index-system-modules
    1.      Apple Swift version 6.1 (swift-6.1-RELEASE)
    2.      Compiling with the current language version
    3.      While evaluating request IRGenRequest(IR Generation for file "/Users/bobko/a/swift-sandbox/Sources/_main.swift")
    4.      While emitting IR SIL function "@$sST13swift_sandboxE5sumOfy12CoreGraphics7CGFloatVAE7ElementQzXEF".
     for 'sumOf(_:)' (at /Users/bobko/a/swift-sandbox/Sources/_main.swift:14:5)
    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           0x00000001075db884 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
    1  swift-frontend           0x00000001075d9fb0 llvm::sys::RunSignalHandlers() + 112
    2  swift-frontend           0x00000001075dbec8 SignalHandler(int) + 292
    3  libsystem_platform.dylib 0x0000000186b0ade4 _sigtramp + 56
    4  libsystem_pthread.dylib  0x0000000186ad3f70 pthread_kill + 288
    5  libsystem_c.dylib        0x00000001869e0908 abort + 128
    6  swift-frontend           0x000000010767e95c (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo, llvm::DIScope*) (.cold.24) + 0
    7  swift-frontend           0x000000010278c9c0 (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo, llvm::DIScope*) + 4124
    8  swift-frontend           0x000000010278cd18 (anonymous namespace)::IRGenDebugInfoImpl::createParameterTypes(swift::CanTypeWrapper<swift::SILFunctionType>) + 752
    9  swift-frontend           0x0000000102786040 (anonymous namespace)::IRGenDebugInfoImpl::emitFunction(swift::SILDebugScope const*, llvm::Function*, swift::SILFunctionTypeRepresentation, swift::SILType, swift::DeclContext*, llvm::StringRef) + 1636
    10 swift-frontend           0x00000001027c6adc (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 1104
    11 swift-frontend           0x00000001027c60ec swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1812
    12 swift-frontend           0x000000010266aca0 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) + 728
    13 swift-frontend           0x000000010277a5f8 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 2396
    14 swift-frontend           0x00000001027c5608 swift::GeneratedModule swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)17>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 200
    15 swift-frontend           0x0000000102781d90 swift::IRGenRequest::OutputType swift::Evaluator::getResultUncached<swift::IRGenRequest, swift::IRGenRequest::OutputType swift::evaluateOrFatal<swift::IRGenRequest>(swift::Evaluator&, swift::IRGenRequest)::'lambda'()>(swift::IRGenRequest const&, swift::IRGenRequest::OutputType swift::evaluateOrFatal<swift::IRGenRequest>(swift::Evaluator&, swift::IRGenRequest)::'lambda'()) + 212
    16 swift-frontend           0x000000010277c434 swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 208
    17 swift-frontend           0x00000001022f08dc generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>) + 156
    18 swift-frontend           0x00000001022ed5d4 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1372
    19 swift-frontend           0x00000001022eca3c swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 468
    20 swift-frontend           0x00000001022f8b50 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 164
    21 swift-frontend           0x00000001022ee74c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 716
    22 swift-frontend           0x00000001022edf68 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2228
    23 swift-frontend           0x00000001020d18f0 swift::mainEntry(int, char const**) + 3064
    24 dyld                     0x0000000186754274 start + 2840
@toffaletti
Copy link
Contributor

This seems to be fixed with swift 6.1

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 Darwin IRGen LLVM IR generation
Projects
None yet
Development

No branches or pull requests

6 participants