Skip to content

LLVM assertion failure on Wasm exceptions #135665

Open
@purplesyringa

Description

@purplesyringa

Code

fn main() {}

:/

Meta

I'm building rustc on the current master (bcd0683) with LLVM assertions enabled. I'm compiling the program above like this:

RUSTFLAGS="-C panic=unwind" cargo +stage1 build --target wasm32-wasip1 -Z build-std

I'm using the 23.0 WASI sysroot, downloaded from their GitHub releases, if that matters.

Error output

rustc: /checkout/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1378: void mapWasmLandingPadIndex(MachineBasicBlock *, const CatchPadInst *): Assertion `IntrFound && "wasm.landingpad.index intrinsic not found!"' failed.

like, everywhere, on all sorts of standard crates like libc and unwind.

Disabling assertions hides the bug, and user code works fine. This also does not reproduce on rustup's nightly, probably for the same reason. I have no idea, really. Please tell me I'm doing something wrong.

For context, this seems more important because Emscripten is supposed to switch to Wasm exceptions soon-ish, and I imagine the same problem occurs there (but I haven't checked). Unlike wasm32-wasip1, unwinding is enabled there by default.

@rustbot label +A-LLVM

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!O-wasiOperating system: Wasi, Webassembly System InterfaceO-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions