Open
Description
Description
While trying to use the C++ interoperability feature with a complex C++ library (FastDDS), the attached swift package constantly crashes the Swift compiler.
Reproduction
Just build attached swift package.
swift build
Stack dump
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Applications/Xcode_15.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/dmitry/Developer/FastDDS-dev/SwiftError/Sources/FastRTPSSwift/ReaderDiscoveryInfo.swift -emit-dependencies-path /Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/arm64-apple-macosx/debug/FastRTPSSwift.build/ReaderDiscoveryInfo.d -emit-reference-dependencies-path /Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/arm64-apple-macosx/debug/FastRTPSSwift.build/ReaderDiscoveryInfo.swiftdeps -target arm64-apple-macosx10.13 -Xllvm -aarch64-use-tbi -enable-objc-interop -cxx-interoperability-mode=default -sdk /Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -I /Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/arm64-apple-macosx/debug -I /Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/artifacts/fastddsprebuild/FastDDS/FastDDS.xcframework/macos-arm64_x86_64/Headers -I /Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/arm64-apple-macosx/debug -F /Applications/Xcode_15.3.app/Contents/Developer/Platforms
/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -module-cache-path /Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /Applications/Xcode_15.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /Applications/Xcode_15.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -fmodule-map-file=/Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/arm64-apple-macosx/debug/FastRTPSWrapper.build/module.modulemap -Xcc -I -Xcc /Users/dmitry/Developer/FastDDS-dev/SwiftError/Sources/FastRTPSWrapper/include -Xcc -I -Xcc /Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/artifacts/fastddsprebuild/FastDDS/FastDDS.xcframework/macos-arm64_x86_64/Headers -Xcc -std=c++17 -Xcc -isysroot -Xcc /Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -Xcc -F -Xcc /Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name FastRTPSSwift -package-name swifterror -disable-clang-spi -target-sdk-version 14.4 -target-sdk-name macosx14.4 -external-plugin-path /Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/lib/swift/host/plugins#/Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Applications/Xcode_15.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode_15.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -parse-as-library -o /Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/arm64-apple-macosx/debug/FastRTPSSwift.build/ReaderDiscoveryInfo.swift.o -index-store-path /Users/dmitry/Developer/FastDDS-dev/SwiftError/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1. Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
2. Compiling with the current language version
3. While evaluating request IRGenRequest(IR Generation for file "/Users/dmitry/Developer/FastDDS-dev/SwiftError/Sources/FastRTPSSwift/ReaderDiscoveryInfo.swift")
4. While converting type 'eprosima.fastrtps.rtps.ReaderProxyData'
5. While converting type 'eprosima.fastdds.dds.ReaderQos'
6. While converting type 'eprosima.fastdds.dds.PresentationQosPolicy'
7. While converting type 'eprosima.fastdds.dds.PresentationQosPolicyAccessScopeKind'
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 0x0000000106803f3c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x00000001068030f8 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x0000000106804544 SignalHandler(int) + 360
3 libsystem_platform.dylib 0x000000019c64b584 _sigtramp + 56
4 libsystem_pthread.dylib 0x000000019c61ac20 pthread_kill + 288
5 libsystem_c.dylib 0x000000019c527a20 abort + 180
6 libsystem_malloc.dylib 0x000000019c437aa8 malloc_vreport + 896
7 libsystem_malloc.dylib 0x000000019c45bea8 malloc_zone_error + 104
8 libsystem_malloc.dylib 0x000000019c44cfdc nanov2_guard_corruption_detected + 44
9 libsystem_malloc.dylib 0x000000019c44c1f0 _nanov2_free + 0
10 libsystem_malloc.dylib 0x000000019c4551c0 _malloc_zone_memalign + 316
11 libc++abi.dylib 0x000000019c5d3d00 operator new(unsigned long, std::align_val_t) + 72
12 swift-frontend 0x0000000101e03d2c std::__1::pair<llvm::StringMapIterator<unsigned int>, bool> llvm::StringMap<unsigned int, llvm::MallocAllocator>::try_emplace<>(llvm::StringRef) + 80
13 swift-frontend 0x0000000102b63b60 swift::Mangle::Mangler::appendIdentifier(llvm::StringRef) + 104
14 swift-frontend 0x00000001027e8108 swift::Mangle::ASTMangler::appendAnyGenericType(swift::GenericTypeDecl const*) + 1820
15 swift-frontend 0x00000001027e7ca8 swift::Mangle::ASTMangler::appendAnyGenericType(swift::GenericTypeDecl const*) + 700
16 swift-frontend 0x00000001015fff3c swift::irgen::IRGenMangler::mangleTypeForLLVMTypeName(swift::CanType) + 536
17 swift-frontend 0x00000001015bf968 swift::irgen::IRGenModule::createNominalType(swift::CanType) + 360
18 swift-frontend 0x000000010158eb0c swift::irgen::TypeConverter::convertStructType(swift::TypeBase*, swift::CanType, swift::StructDecl*) + 292
19 swift-frontend 0x00000001015bd360 swift::irgen::TypeConverter::getTypeEntry(swift::CanType) + 1108
20 swift-frontend 0x000000010158f304 swift::irgen::TypeConverter::convertStructType(swift::TypeBase*, swift::CanType, swift::StructDecl*) + 2332
21 swift-frontend 0x00000001015bd360 swift::irgen::TypeConverter::getTypeEntry(swift::CanType) + 1108
22 swift-frontend 0x000000010158f304 swift::irgen::TypeConverter::convertStructType(swift::TypeBase*, swift::CanType, swift::StructDecl*) + 2332
23 swift-frontend 0x00000001015bd360 swift::irgen::TypeConverter::getTypeEntry(swift::CanType) + 1108
24 swift-frontend 0x000000010158f304 swift::irgen::TypeConverter::convertStructType(swift::TypeBase*, swift::CanType, swift::StructDecl*) + 2332
25 swift-frontend 0x00000001015bd360 swift::irgen::TypeConverter::getTypeEntry(swift::CanType) + 1108
26 swift-frontend 0x00000001015bcae8 swift::irgen::IRGenModule::getTypeInfoForUnlowered(swift::Lowering::AbstractionPattern, swift::CanType) + 256
27 swift-frontend 0x00000001015c7660 swift::irgen::emitValueWitnessTable(swift::irgen::IRGenModule&, swift::CanType, bool, bool) + 628
28 swift-frontend 0x000000010152010c swift::irgen::emitForeignTypeMetadata(swift::irgen::IRGenModule&, swift::NominalTypeDecl*) + 908
29 swift-frontend 0x0000000101479c64 swift::irgen::IRGenerator::emitLazyDefinitions() + 1212
30 swift-frontend 0x00000001015d7a4c swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 4284
31 swift-frontend 0x000000010162154c swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 176
32 swift-frontend 0x00000001015e4264 llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenRequest>(swift::IRGenRequest const&) + 836
33 swift-frontend 0x00000001015da438 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**) + 264
34 swift-frontend 0x00000001011080b8 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
35 swift-frontend 0x0000000101102294 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*) + 1892
36 swift-frontend 0x0000000101101444 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 608
37 swift-frontend 0x0000000101105694 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1448
38 swift-frontend 0x00000001011036d0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4968
39 swift-frontend 0x0000000101092e8c swift::mainEntry(int, char const**) + 2612
40 dyld 0x000000019c2920e0 start + 2360
Expected behavior
The compiler should not crash.
Environment
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
ProductName: macOS
ProductVersion: 14.4.1
BuildVersion: 23E224
Additional information
No response