Skip to content

Crash in wasm-emscripten-finalize with -g -fwasm-exceptions #27449

Description

@paradust7

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 6.0.4 (fe5be6a)
clang version 24.0.0git (https:/github.com/llvm/llvm-project c050c487e9edb97ef44f53cb29fe1d8bcddb8f76)
Target: wasm32-unknown-emscripten
Thread model: posix

Compile with

$ em++ -O0 -g -fwasm-exceptions -sSTACK_OVERFLOW_CHECK=2 repro.cpp -o out.js
wasm-emscripten-finalize: /b/s/w/ir/cache/builder/emscripten-releases/binaryen/src/wasm/wasm-debug.cpp:439: void wasm::Debug::AddrExprMap::add(Expression *, const BinaryLocations::Span): Assertion `!endMap.contains(span.end)' failed.
em++: error: '/emsdk/upstream/bin/wasm-emscripten-finalize -g --bigint --no-dyncalls --no-legalize-javascript-ffi --check-stack-overflow --dwarf out.wasm -o out.wasm --detect-features' failed (received SIGABRT (-6))

Reproducer

int main() {
  try {
    throw 1;
  } catch (int e) {
    return e;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions