From ac18734b3080ca32d9fede83ef85ae81c7cbf5c6 Mon Sep 17 00:00:00 2001 From: "Ben L. Titzer" Date: Mon, 31 Aug 2026 13:16:58 -0400 Subject: [PATCH] [gc] Test for unreachable code validation bug --- build.sh | 8 ++++++-- test/regress.failures | 1 + test/regress/ext:gc/unreach00.bin.wast | 8 ++++++++ test/regress/ext:gc/unreach00.wast | 11 +++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 test/regress/ext:gc/unreach00.bin.wast create mode 100644 test/regress/ext:gc/unreach00.wast diff --git a/build.sh b/build.sh index 3cfd74b36..15ecc4fcd 100755 --- a/build.sh +++ b/build.sh @@ -43,8 +43,12 @@ fi V3C=${V3C:=$(which v3c)} if [ ! -x "$V3C" ]; then - echo "Virgil compiler (v3c) not found in \$PATH, and \$V3C not set" - exit 1 + if [ "$VIRGIL_LOC" != "" ]; then + V3C=$(cd $VIRGIL_LOC && pwd)/bin/v3c + else + echo "Virgil compiler (v3c) not found in \$PATH, and neither \$V3C or \$VIRGIL_LOC is set" + exit 1 + fi fi if [ "$VIRGIL_LIB" = "" ]; then diff --git a/test/regress.failures b/test/regress.failures index 23a00fec0..88f61a635 100644 --- a/test/regress.failures +++ b/test/regress.failures @@ -1,2 +1,3 @@ test/regress/ext:threads/atomic_wait32_0.bin.wast test/regress/ext:threads/atomic_wait64_0.bin.wast +test/regress/ext:gc/unreach00.bin.wast diff --git a/test/regress/ext:gc/unreach00.bin.wast b/test/regress/ext:gc/unreach00.bin.wast new file mode 100644 index 000000000..2590d2083 --- /dev/null +++ b/test/regress/ext:gc/unreach00.bin.wast @@ -0,0 +1,8 @@ +(assert_invalid + (module binary + "\00\61\73\6d\01\00\00\00\01\84\80\80\80\00\01\60" + "\00\00\03\82\80\80\80\00\01\00\0a\8e\80\80\80\00" + "\01\88\80\80\80\00\01\01\7f\00\d4\21\00\0b" + ) + "type mismatch" +) diff --git a/test/regress/ext:gc/unreach00.wast b/test/regress/ext:gc/unreach00.wast new file mode 100644 index 000000000..bbc1cba7a --- /dev/null +++ b/test/regress/ext:gc/unreach00.wast @@ -0,0 +1,11 @@ +(assert_invalid + (module + (func $invalid + (local $i32 i32) + (unreachable) + (ref.as_non_null) + (local.set $i32) + ) + ) + "type mismatch" +)