Skip to content

Commit 7976b34

Browse files
authored
[NFC] Test we error at runtime on subtyping errors (WebAssembly#7912)
The test verifies that even if validation accepts something, the interpreter checks subtyping at runtime, allowing us to detect (in principle) bugs in validation (or missing/incorrect validation rules).
1 parent 6866014 commit 7976b34

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
;; Disable validation and see that we error at runtime when an exact
2+
;; reference contains a subtype. (We disable validation so that the error is
3+
;; caught only at runtime; this would allow us to catch bugs that validation
4+
;; misses.)
5+
6+
;; RUN: not wasm-opt %s -all --no-validation --fuzz-exec 2>&1 | filecheck %s
7+
8+
;; CHECK: Fatal: expected (ref (exact $A)), seeing (ref (exact $B)) from
9+
10+
(module
11+
(rec
12+
(type $A (sub (struct)))
13+
(type $B (sub $A (struct)))
14+
)
15+
16+
(func $test (export "test")
17+
(drop
18+
(block (result (ref (exact $A)))
19+
(struct.new $B)
20+
)
21+
)
22+
)
23+
)
24+

0 commit comments

Comments
 (0)