Skip to content

[WebAssembly] Exception specifications don't work in Emscripten EH & Wasm EH (except for throw()) #49740

@aheejin

Description

@aheejin
Bugzilla Link 50396
Version trunk
OS All
CC @kripken,@dschuff

Extended Description

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions