File: gc-cycle-leak.wast

package info (click to toggle)
binaryen 120-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,284 kB
  • sloc: cpp: 189,449; javascript: 62,189; ansic: 14,087; python: 5,379; pascal: 441; sh: 77; makefile: 30; asm: 27
file content (28 lines) | stat: -rw-r--r-- 906 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.

;; RUN: wasm-opt %s -all --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s

(module
 (type $A (struct (field (mut (ref null $A)))))

 ;; CHECK:      [fuzz-exec] calling test
 (func $test (export "test")
  (local $a (ref $A))
  ;; This function makes a self-cycle where the local $a's ref field points to
  ;; itself. This test checks that we do not error, even in sanitizers, when
  ;; such cycles are created (at the time of creating this test, we represent
  ;; GC data using std::shared_ptr, which does not handle cycles, and so by
  ;; default leak checks will error if not suppressed).
  (local.set $a
   (struct.new $A
    (ref.null $A)
   )
  )
  (struct.set $A 0
   (local.get $a)
   (local.get $a)
  )
 )
)
;; CHECK:      [fuzz-exec] calling test
;; CHECK-NEXT: [fuzz-exec] comparing test