Open dimlio opened 1 month ago
When building with current 5.10 compiler the crash is different:
$ swiftc a.swift
error: compile command failed due to signal 6 (use -v to see invocation)
Invalid bitcast
%19 = bitcast ptr %11 to i64
<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
<unknown>:0: note: Broken module found, compilation aborted!
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 -primary-file a.swift -target arm64-apple-macosx14.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -color-diagnostics -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -module-name a -disable-clang-spi -target-sdk-version 14.5 -target-sdk-name macosx14.5 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/bin/swift-plugin-server -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 -o /var/folders/y0/5ch3_9cs0x1fyzdykz2tbz4w0000gn/T/TemporaryDirectory.SQOhZE/a-1.o
1. Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
2. Compiling with the current language version
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 0x0000000107e97f3c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000107e970f8 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x0000000107e98544 SignalHandler(int) + 360
3 libsystem_platform.dylib 0x0000000182647584 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000182616c20 pthread_kill + 288
5 libsystem_c.dylib 0x0000000182523a30 abort + 180
6 swift-frontend 0x00000001027a16d8 PrettyStackTraceFrontend::~PrettyStackTraceFrontend() + 0
7 swift-frontend 0x0000000107de0a18 llvm::report_fatal_error(llvm::Twine const&, bool) + 280
8 swift-frontend 0x0000000107de0900 llvm::report_fatal_error(llvm::Twine const&, bool) + 0
9 swift-frontend 0x0000000102c744b8 llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::printPipeline(llvm::raw_ostream&, llvm::function_ref<llvm::StringRef (llvm::StringRef)>) + 0
10 swift-frontend 0x0000000107b97ce8 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 224
11 swift-frontend 0x0000000102c67490 swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*, llvm::raw_pwrite_stream*) + 3992
12 swift-frontend 0x0000000102c68bec swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, llvm::vfs::OutputBackend&, swift::UnifiedStatsReporter*) + 2364
13 swift-frontend 0x000000010279c4f8 generateCode(swift::CompilerInstance&, llvm::StringRef, llvm::Module*, llvm::GlobalVariable*) + 260
14 swift-frontend 0x0000000102796318 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*) + 2024
15 swift-frontend 0x0000000102795444 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 608
16 swift-frontend 0x0000000102799694 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1448
17 swift-frontend 0x00000001027976d0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4968
18 swift-frontend 0x0000000102726e8c swift::mainEntry(int, char const**) + 2612
19 dyld 0x000000018228e0e0 start + 2360
error: fatalError
Description
Hi!
We observed a strange behavior of our Swift application leading to either wrong logs or crashes. When running under ASAN it reported "use after free" error. We tried to use 5.10 and 6.0 development snapshots and got compiler crashes due to failed asserts. We were able to minimize the code that produces similar assertion.
Reproduction
Stack dump
Expected behavior
Code is expected to compile and run without errors.
Environment
Apple Swift version 6.0-dev (LLVM cef183591317ec7, Swift 66e311074bff491) Target: arm64-apple-macosx14.0
Additional information
No response