summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm/wasm-validator.cpp2
-rw-r--r--test/heap-types.wast5
-rw-r--r--test/heap-types.wast.from-wast3
-rw-r--r--test/heap-types.wast.fromBinary3
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo3
5 files changed, 11 insertions, 5 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index edcf3676d..745ce8c06 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -2237,7 +2237,7 @@ void FunctionValidator::visitBrOnCast(BrOnCast* curr) {
curr->castType.getHeapType(),
curr,
"br_on_cast rtt must have the proper heap type");
- noteBreak(curr->name, Type(curr->rtt->type.getHeapType(), Nullable), curr);
+ noteBreak(curr->name, curr->castType, curr);
}
}
diff --git a/test/heap-types.wast b/test/heap-types.wast
index f0007bea9..5f47b6d2e 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -161,6 +161,7 @@
(func $rtt-param-with-depth (param $rtt (rtt 1 $parent)))
(func $rtt-param-without-depth (param $rtt (rtt $parent)))
(func $rtt-operations
+ (local $temp.A (ref null $struct.A))
(drop
(ref.test $struct.B (ref.null $struct.A) (rtt.canon $struct.B))
)
@@ -169,7 +170,9 @@
)
(drop
(block $out (result (ref $struct.B))
- (drop
+ ;; set the value to a local with type $struct.A, showing that the value
+ ;; flowing out has the right type
+ (local.set $temp.A
(br_on_cast $out $struct.B (ref.null $struct.A) (rtt.canon $struct.B))
)
;; an untaken br_on_cast, with unreachable rtt - so we cannot use the
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index 258addf3a..1b70252b0 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -167,6 +167,7 @@
(nop)
)
(func $rtt-operations
+ (local $temp.A (ref null ${i32_f32_f64}))
(drop
(ref.test ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}
(ref.null ${i32_f32_f64})
@@ -181,7 +182,7 @@
)
(drop
(block $out (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
- (drop
+ (local.set $temp.A
(br_on_cast $out ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}
(ref.null ${i32_f32_f64})
(rtt.canon ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index e46b674ee..85d452727 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -167,6 +167,7 @@
(nop)
)
(func $rtt-operations
+ (local $temp.A (ref null ${i32_f32_f64}))
(drop
(ref.test ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}
(ref.null ${i32_f32_f64})
@@ -181,7 +182,7 @@
)
(drop
(block $label$1 (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
- (drop
+ (local.set $temp.A
(br_on_cast $label$1 ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}
(ref.null ${i32_f32_f64})
(rtt.canon ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 6fe4da7d0..cf9067b21 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -167,6 +167,7 @@
(nop)
)
(func $4
+ (local $0 (ref null ${i32_f32_f64}))
(drop
(ref.test ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}
(ref.null ${i32_f32_f64})
@@ -181,7 +182,7 @@
)
(drop
(block $label$1 (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
- (drop
+ (local.set $0
(br_on_cast $label$1 ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}
(ref.null ${i32_f32_f64})
(rtt.canon ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})