Skip to content

Wasm MEMORY64: RuntimeError: WebAssembly.instantiate(): table index is out of bounds #22538

Closed
llvm/llvm-project
#107780
@juj

Description

@juj

STR:

a.c

void foo()
{
}

void js_callback(void (*callback)(void));

int main(int argc, char **argv)
{
  js_callback(foo);
}

lib_a.js

mergeInto(LibraryManager.library, {
  js_callback: function(foo) {}
});

Cmdline:

emcc -sMEMORY64 --js-library lib_a.js a.c -o a.html

Results in

image

during Wasm instantiation.

Attached Wast of generated a.wasm. There is a surprising (elem $0 (i64.const 2014339661825) $foo) in the code.

a.wast.txt

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