Skip to content

ctor-eval crashes when a non-env table is imported #8145

Closed

Description

@stevenfontanella

Importing a table should be fine, we should just throw FailToEvalException when it's read from or written to.

Repro:

(module
 (import "import" "table" (table $table 1 1 anyref))
 (func $foo (result i32)
  (i32.const 1)
 )
 (export "foo" (func $foo))
) 
$ python3 check.py ctor-eval --filter='*imports*'
ninja: no work to do.

[ checking wasm-ctor-eval... ]

.. imports.wast
executing:  /usr/local/google/home/stevenfont/code/binaryen/bin/wasm-ctor-eval /usr/local/google/home/stevenfont/code/binaryen/test/ctor-eval/imports.wast -all -o a.wat -S --ctors foo
terminate called after throwing an instance of 'std::out_of_range'
  what():  map::at
^C
Traceback (most recent call last):
  File "/usr/local/google/home/stevenfont/code/binaryen/check.py", line 436, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/local/google/home/stevenfont/code/binaryen/check.py", line 419, in main
    TEST_SUITES[test]()
    ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/google/home/stevenfont/code/binaryen/check.py", line 121, in run_ctor_eval_tests
    support.run_command(cmd)
    ~~~~~~~~~~~~~~~~~~~^^^^^
  File "/usr/local/google/home/stevenfont/code/binaryen/scripts/test/support.py", line 224, in run_command
    out, err, code = _subprocess_run(cmd, stdout=subprocess.PIPE, stderr=stderr, encoding='UTF-8')
                     ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/stevenfont/code/binaryen/scripts/test/support.py", line 201, in _subprocess_run
    proc = subprocess.run(*args, **kwargs)
  File "/usr/lib/python3.13/subprocess.py", line 556, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
                     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/subprocess.py", line 1209, in communicate
    stdout = self.stdout.read()
KeyboardInterrupt

Activity

  1. stevenfontanella commented on Jan 15, 2026

    @stevenfontanella
    MemberAuthor

    Tried again, a more complete repro command is

    bin/wasm-ctor-eval --enable-reference-types --enable-gc --ctors=foo repro.wast

    This does crash for the wast here, but it doesn't crash when the import module is "env" because of our stubbing logic. This will be fixed by #8194.

  2. changed the title [-]ctor-eval crashes when a table is imported[/-] [+]ctor-eval crashes when a non-env table is imported[/+] on Jan 15, 2026
  3. stevenfontanella commented on Jan 22, 2026

    @stevenfontanella
    MemberAuthor

    This is fixed by #8194:

     ninja && bin/wasm-ctor-eval --enable-reference-types --enable-gc --ctors=foo repro2.wast --output reproout.wast
    ninja: no work to do.
      ...stopping since could not create module instance: Imported table access.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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