https://bugs.llvm.org/show_bug.cgi?id=47413
Bug ID: 47413
Summary: Invalid wasm with -fwasm-exceptions
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: WebAssembly
Assignee: unassignedb...@nondot.org
Reporter: alonza...@gmail.com
CC: llvm-bugs@lists.llvm.org
Created attachment 23924
--> https://bugs.llvm.org/attachment.cgi?id=23924&action=edit
wasm file from LLVM
Testcase (from wasm0.test_exceptions_3):
===
#include <iostream>
int main(int argc, char **argv)
{
int arg = argv[1][0] - '0';
try {
if (arg == 2) throw std::runtime_error("Hello");
} catch(const char * ex) {
std::cout << "Caught C string: " << ex << std::endl;
} catch(...) {
}
std::cout << "Done.\n";
}
===
The output from LLVM is incorrect, but after binaryen processing it becomes
valid somehow (I think this is why this wasn't noticed earlier - removing the
binaryen processing locally uncovered it). To see the LLVM output, can build
with
EMCC_DEBUG=1 emcc test.cpp -fwasm-exceptions
and then look at /tmp/emscripten_temp/emcc-0-base.wasm (also attached). That
file looks invalid, v8 says
Compiling function #420 failed: not enough arguments on the stack for catch,
expected 1 more @+62235
and wabt says
emcc-0-base.wasm:000f0b7: error: type mismatch in try block, expected [i32] but
got []
[..]
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs