Skip to content

wasm-ctor-eval bug with suspend #8553

@tlively

Description

@tlively
;; test.wast
(module
 (type $i32-none (func (param i32)))
 (type $none-none (func))
 (import "fuzzing-support" "log-i32" (func $log (type $i32-none)))
 (global $global$0 (mut i32) (i32.const 100))
 (tag $tag$0 (type $none-none))
 (export "ctor" (func $ctor))
 (export "main" (func $main))
 (func $ctor (type $none-none)
  (global.set $global$0
   (i32.sub
    (global.get $global$0)
    (i32.const 1)
   )
  )
  (suspend $tag$0)
 )
 (func $main (type $none-none)
  (global.get $global$0)
  (call $log)
 )
)
$ bin/wasm-ctor-eval test.wast --ctors=ctor --kept-exports=ctor,main -all -S -o -

The subtraction is serialized to the global but no removed from ctor, so it is executed again at runtime.

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