diff options
-rw-r--r-- | src/wasm-validator.h | 10 | ||||
-rw-r--r-- | test/dot_s/alias.s | 3 | ||||
-rw-r--r-- | test/dot_s/alias.wast | 2 | ||||
-rw-r--r-- | test/dot_s/unreachable_blocks.s | 4 | ||||
-rw-r--r-- | test/dot_s/unreachable_blocks.wast | 5 | ||||
m--------- | test/spec | 0 |
6 files changed, 12 insertions, 12 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h index d14a56a10..04c42e4f2 100644 --- a/src/wasm-validator.h +++ b/src/wasm-validator.h @@ -491,8 +491,8 @@ public: if (curr->value) { if (returnType == unreachable) { returnType = curr->value->type; - } else if (curr->value->type != unreachable && returnType != curr->value->type) { - returnType = none; // poison + } else if (curr->value->type != unreachable) { + shouldBeEqual(curr->value->type, returnType, curr, "function results must match"); } } else { returnType = none; @@ -560,10 +560,8 @@ public: if (curr->body->type != unreachable) { shouldBeEqual(curr->result, curr->body->type, curr->body, "function body type must match, if function returns"); } - if (curr->result != none) { // TODO: over previous too? - if (returnType != unreachable) { - shouldBeEqual(curr->result, returnType, curr->body, "function result must match, if function returns"); - } + if (returnType != unreachable) { + shouldBeEqual(curr->result, returnType, curr->body, "function result must match, if function has returns"); } returnType = unreachable; labelNames.clear(); diff --git a/test/dot_s/alias.s b/test/dot_s/alias.s index 121f3fc53..5b719d18c 100644 --- a/test/dot_s/alias.s +++ b/test/dot_s/alias.s @@ -9,9 +9,8 @@ __exit: # @__exit i32.load $push1=, 0($pop0) i32.const $push2=, ._C i32.load $push3=, 0($pop2) - i32.add $push4=, $pop1, $pop3 + i32.add $drop=, $pop1, $pop3 # BB#0: # %entry - return $pop4 .endfunc .Lfunc_end0: .size __exit, .Lfunc_end0-__exit diff --git a/test/dot_s/alias.wast b/test/dot_s/alias.wast index fb23a0c07..f30d62788 100644 --- a/test/dot_s/alias.wast +++ b/test/dot_s/alias.wast @@ -8,7 +8,7 @@ (export "__needs_exit" (func $__needs_exit)) (export "dynCall_v" (func $dynCall_v)) (func $__exit (type $FUNCSIG$v) - (return + (drop (i32.add (i32.load (i32.const 16) diff --git a/test/dot_s/unreachable_blocks.s b/test/dot_s/unreachable_blocks.s index 15b63e019..9885be2b1 100644 --- a/test/dot_s/unreachable_blocks.s +++ b/test/dot_s/unreachable_blocks.s @@ -3,12 +3,13 @@ .type unreachable_block_void,@function unreachable_block_void: + .result i32 block # Tests that we don't consume the type of the first item inside a block i32.const $push0=, 1 end_block return $pop0 - block + block i32 end_block .endfunc .Lfunc_end0: @@ -60,6 +61,7 @@ unreachable_block_f64: .type unreachable_loop_void,@function unreachable_loop_void: + .result i32 loop i32.const $push0=, 6 br 0 diff --git a/test/dot_s/unreachable_blocks.wast b/test/dot_s/unreachable_blocks.wast index d9e921a4a..dbd4a8626 100644 --- a/test/dot_s/unreachable_blocks.wast +++ b/test/dot_s/unreachable_blocks.wast @@ -1,13 +1,14 @@ (module (import "env" "memory" (memory $0 1)) (table 0 anyfunc) - (func $unreachable_block_void + (func $unreachable_block_void (result i32) (block $label$0 ) (return (i32.const 1) ) (block $label$1 + (unreachable) ) ) (func $unreachable_block_i32 (result i32) @@ -42,7 +43,7 @@ (unreachable) ) ) - (func $unreachable_loop_void + (func $unreachable_loop_void (result i32) (loop $label$0 (br $label$0) ) diff --git a/test/spec b/test/spec -Subproject db60b99bd3693e0ae87ff5b03afa4010ecb0d43 +Subproject 668281b3d7dfe9be6cbc3c4500b537c49d6449b |