Skip to content

Segfault in ctor-eval when optimizing an imported table of funcrefs #8209

@stevenfontanella

Description

@stevenfontanella

I ran the following example from main to see whether the no-op function call would get optimized away:

;; repro.wast
;; bin/wasm-ctor-eval --ctors=test repro.wast
(module
  (import "env" "table" (table $t 1 funcref))
  (type $v (func))
  (func $target (type $v)
    (nop)
  )
  (elem (table $t) (i32.const 0) func $target)

  (func $test
    (call_indirect $t (type $v) (i32.const 0))
  )
  (export "test" (func $test))
)

Unlike other similar issues, this one does import from env which is expected to work.

From checking lldb, the crash is from dereferencing null in tableSize: link. Maybe this is related to the comment immediately above?

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