summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2022-06-18 09:37:09 -0700
committerGitHub <noreply@github.com>2022-06-18 09:37:09 -0700
commitbab21052c3e12df7ad2fd3711d0fe6e69e05f449 (patch)
tree0ff5e87412853db2253ade9373d95b118e68f892 /test
parent4652398b62ce0546f015cdc2c7b3010938c7c5a9 (diff)
downloadbinaryen-bab21052c3e12df7ad2fd3711d0fe6e69e05f449.tar.gz
binaryen-bab21052c3e12df7ad2fd3711d0fe6e69e05f449.tar.bz2
binaryen-bab21052c3e12df7ad2fd3711d0fe6e69e05f449.zip
Do not emit recursion groups without GC enabled (#4738)
We emit nominal types as a single large recursion group, but this produces invalid modules when --nominal or --hybrid was used without GC enabled. Fix the bug by always emitting types as though they were structural (i.e. without recursion groups) when GC is not enabled. Fixes #4723.
Diffstat (limited to 'test')
-rw-r--r--test/lit/nominal-no-gc.wast20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/lit/nominal-no-gc.wast b/test/lit/nominal-no-gc.wast
new file mode 100644
index 000000000..7247caa5a
--- /dev/null
+++ b/test/lit/nominal-no-gc.wast
@@ -0,0 +1,20 @@
+;; Write the module with --nominal but without GC
+;; RUN: wasm-opt %s --nominal --disable-gc -g -o %t.wasm
+
+;; We should not get any recursion groups even though we used --nominal. We use
+;; --hybrid -all here to make sure that any rec groups from the binary will
+;; actually show up in the output and cause the test to fail.
+;; RUN: wasm-opt %t.wasm --hybrid -all -S -o - | filecheck %s
+
+;; Also check that we don't get a failure with the default configuration.
+;; RUN: wasm-opt %t.wasm
+
+;; CHECK-NOT: rec
+
+(module
+ (type $foo (func))
+ (type $bar (func))
+
+ (func $f1 (type $foo))
+ (func $f2 (type $bar))
+)