[llvm-bugs] [Bug 47413] New: Invalid wasm with -fwasm-exceptions
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 3 15:53:27 PDT 2020
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: unassignedbugs at nondot.org
Reporter: alonzakai at gmail.com
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200903/c0f6a8d7/attachment.html>
More information about the llvm-bugs
mailing list