Skip to content
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

Compiler crash when building WebAssembly for debug - Assertion !f->isGeneric() failed #73312

Open
CallumTodd7 opened this issue Apr 27, 2024 · 0 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 triage needed This issue needs more specific labels

Comments

@CallumTodd7
Copy link

Description

Apple's swift-for-wasm-examples works in the stated release mode, but the compiler crashes when building for debug mode.

Reproduction

  1. Clone Apple's swift-for-wasm-examples
  2. Run swift build --triple wasm32-unknown-none-wasm -c debug --product swift- audio

Stack dump

error: compile command failed due to signal 6 (use -v to see invocation)
swift-frontend: /home/build-user/swift/lib/IRGen/GenDecl.cpp:1589: void swift::irgen::IRGenerator::addLazyFunction(swift::SILFunction *): Assertion `!f->isGeneric()' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: /usr/bin/swift-frontend -frontend -c /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/AudioBuffer.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/AudioEncode.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Canvas.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/DOMInterop.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Effects/LadderFilter.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Instruments/Bass.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Instruments/Drums.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Instruments/Sequencer.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Mixer.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/MusicTheory/Pitch.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Plotter.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Utilities/AttackHoldRelease.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Utilities/Modulator.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Waveforms/Saw.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Waveforms/Signal.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Waveforms/Square.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/Waveforms/Triangle.swift /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/swift-audio/main.swift -supplementary-output-file-map /tmp/TemporaryDirectory.kV9hyE/supplementaryOutputs-1 -target wasm32-unknown-none-wasm -disable-objc-interop -cxx-interoperability-mode=default -I /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/.build/wasm32-unknown-none-wasm/debug/Modules -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/.build/wasm32-unknown-none-wasm/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -gnone -enable-experimental-feature Embedded -empty-abi-descriptor -Xcc -working-directory -Xcc /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2 -resource-dir /usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2 -Xcc -fmodule-map-file=/workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/.build/wasm32-unknown-none-wasm/debug/dlmalloc.build/module.modulemap -Xcc -I -Xcc /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/dlmalloc/include -Xcc -fmodule-map-file=/workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/.build/wasm32-unknown-none-wasm/debug/VultDSP.build/module.modulemap -Xcc -I -Xcc /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/Sources/VultDSP/include -Xcc -fdeclspec -Xcc -fPIC -Xcc -g -module-name swift_audio -package-name swift_for_wasm_examples_3e6d26ab3984ca4893a3295fd525a76aa39243b2 -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -o /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/swift_audio.o -index-store-path /workspaces/swift-for-wasm-examples-3e6d26ab3984ca4893a3295fd525a76aa39243b2/.build/wasm32-unknown-none-wasm/debug/index/store -index-system-modules
1.      Swift version 6.0-dev (LLVM 320c9b9b7bd4fd8, Swift 49dd95fae3faf89)
2.      Compiling with effective version 5.10
3.      While evaluating request IRGenRequest(IR Generation for module swift_audio)
 #0 0x0000aaaacbf65b94 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/bin/swift-frontend+0x7365b94)
 #1 0x0000aaaacbf63b88 llvm::sys::RunSignalHandlers() (/usr/bin/swift-frontend+0x7363b88)
 #2 0x0000aaaacbf662a0 SignalHandler(int) Signals.cpp:0:0
 #3 0x0000ffff9ccd07a0 (linux-vdso.so.1+0x7a0)
 #4 0x0000ffff9b0bf200 (/lib/aarch64-linux-gnu/libc.so.6+0x7f200)
 #5 0x0000ffff9b07a67c gsignal (/lib/aarch64-linux-gnu/libc.so.6+0x3a67c)
 #6 0x0000ffff9b067130 abort (/lib/aarch64-linux-gnu/libc.so.6+0x27130)
 #7 0x0000ffff9b073fd0 (/lib/aarch64-linux-gnu/libc.so.6+0x33fd0)
 #8 0x0000ffff9b074040 __assert_perror_fail (/lib/aarch64-linux-gnu/libc.so.6+0x34040)
 #9 0x0000aaaac5e24a5c swift::irgen::IRGenerator::addLazyFunction(swift::SILFunction*) (/usr/bin/swift-frontend+0x1224a5c)
#10 0x0000aaaac5e27a80 swift::irgen::IRGenModule::getAddrOfSILFunction(swift::SILFunction*, swift::ForDefinition_t, bool, bool) (/usr/bin/swift-frontend+0x1227a80)
#11 0x0000aaaac5ea09c4 emitKeyPathComponent(swift::irgen::IRGenModule&, swift::irgen::ConstantStructBuilder&, swift::KeyPathPatternComponent const&, bool, swift::GenericEnvironment*, llvm::ArrayRef<swift::GenericRequirement>, swift::CanType, llvm::ArrayRef<KeyPathIndexOperand>, bool) GenKeyPath.cpp:0:0
#12 0x0000aaaac5ea4328 swift::irgen::IRGenModule::emitSILProperty(swift::SILProperty*) (/usr/bin/swift-frontend+0x12a4328)
#13 0x0000aaaac5e22420 swift::irgen::IRGenerator::emitGlobalTopLevel(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) (/usr/bin/swift-frontend+0x1222420)
#14 0x0000aaaac5cdd0f8 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const (/usr/bin/swift-frontend+0x10dd0f8)
#15 0x0000aaaac5d30a3c swift::GeneratedModule swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::callDerived<0ul>(swift::Evaluator&, std::integer_sequence<unsigned long, 0ul>) const crtstuff.c:0:0
#16 0x0000aaaac5ce6904 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'()) crtstuff.c:0:0
#17 0x0000aaaac5cddf74 swift::performIRGeneration(swift::ModuleDecl*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::unique_ptr<swift::SILModule, std::default_delete<swift::SILModule>>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::GlobalVariable**) (/usr/bin/swift-frontend+0x10ddf74)
#18 0x0000aaaac5910c48 generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::unique_ptr<swift::SILModule, std::default_delete<swift::SILModule>>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>) FrontendTool.cpp:0:0
#19 0x0000aaaac590c7f4 performCompileStepsPostSILGen(swift::CompilerInstance&, std::unique_ptr<swift::SILModule, std::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) FrontendTool.cpp:0:0
#20 0x0000aaaac590b950 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) (/usr/bin/swift-frontend+0xd0b950)
#21 0x0000aaaac591e330 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) FrontendTool.cpp:0:0
#22 0x0000aaaac590ea5c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) FrontendTool.cpp:0:0
#23 0x0000aaaac590d330 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/usr/bin/swift-frontend+0xd0d330)
#24 0x0000aaaac56fcd90 swift::mainEntry(int, char const**) (/usr/bin/swift-frontend+0xafcd90)
#25 0x0000ffff9b0673fc (/lib/aarch64-linux-gnu/libc.so.6+0x273fc)
#26 0x0000ffff9b0674cc __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x274cc)
#27 0x0000aaaac56fbd30 _start (/usr/bin/swift-frontend+0xafbd30)

Expected behavior

Building for debug mode shouldn't cause a crash.

Environment

Swift version 6.0-dev (LLVM 320c9b9b7bd4fd8, Swift 49dd95f)
Target: aarch64-unknown-linux-gnu

Docker image: swiftlang/swift:nightly-jammy
.swift_tag: swift-DEVELOPMENT-SNAPSHOT-2024-04-25-a

Additional information

Looks to be a similar issue to #69682.

@CallumTodd7 CallumTodd7 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 Apr 27, 2024
@CallumTodd7 CallumTodd7 changed the title Compiler crash when building WebAssembly for debug Compiler crash when building WebAssembly for debug - Assertion !f->isGeneric()' failed` Apr 27, 2024
@CallumTodd7 CallumTodd7 changed the title Compiler crash when building WebAssembly for debug - Assertion !f->isGeneric()' failed` Compiler crash when building WebAssembly for debug - Assertion !f->isGeneric() failed Apr 27, 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
Projects
None yet
Development

No branches or pull requests

1 participant