@ 261106.8
current
;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.

;; RUN: foreach %s %t wasm-opt -all --fuzz-exec-before | filecheck %s

;; $start runs before the first export, so we print 1 here.
(module
  (global $global (mut i32) (i32.const 0))

  (start $start)

  (func $start
    (global.set $global
      (i32.const 1)
    )
  )

  ;; CHECK:      [fuzz-exec] export run
  ;; CHECK-NEXT: [fuzz-exec] note result: run => 1
  (func $run (export "run") (result i32)
    (global.get $global)
  )
)

;; A trapping start prevents any export from running.
(module
  ;; CHECK:      [trap unreachable]
  (start $trap)

  (func $trap
    (unreachable)
  )

  (func $run (export "run") (result i32)
    (i32.const 42)
  )
)

;; A throwing start prevents any export from running.
(module
  ;; CHECK:      [exception thrown: failed to instantiate module]
  (tag $tag)

  (start $throw)

  (func $throw
    (throw $tag)
  )

  (func $run (export "run") (result i32)
    (i32.const 42)
  )
)