[llvm-bugs] [Bug 50396] New: [WebAssembly] Exception specifications don't work in Emscripten EH & Wasm EH (except for throw())

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 18 14:47:37 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50396

            Bug ID: 50396
           Summary: [WebAssembly] Exception specifications don't work in
                    Emscripten EH & Wasm EH (except for throw())
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: aheejin at gmail.com
                CC: alonzakai at gmail.com, dschuff at google.com,
                    llvm-bugs at lists.llvm.org

It turns out Emscripten EH hasn't supported dynamic exception specification all
along. For example, the program prints "Incorrect", which it shouldn't:

```
#include <stdio.h>

void test() throw(float) { throw 3; }

int main() {
  try {
    test();
  } catch (int n) {
    printf("Incorrect\n");
  }
  return 0;
}
```

It supports `throw()` correctly, but for other types within `throw(..)`,
Emscripten EH currently allows all types to be thrown.

We are working on the new wasm EH based on the the wasm spec
(https://github.com/WebAssembly/exception-handling), but this currently has the
same limitation: it also only supports `throw()` and not other `throw(..)`.

For both Emscripten EH (the current EH) and the new wasm EH (currently
experimental and new browser support is necessary) the exception spec except
for `throw()` has never worked, and we don't have a short-term plan to fix this
in near future. Patches are welcome though.

-- 
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/20210518/00ae3d7f/attachment.html>


More information about the llvm-bugs mailing list