summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/asm2wasm.h2
-rw-r--r--test/unit.asm.js3
-rw-r--r--test/unit.fromasm13
3 files changed, 17 insertions, 1 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 95638c9dc..d3d76ff83 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -245,7 +245,7 @@ private:
FunctionType *getFunctionType(Ref parent, ExpressionList& operands) {
// generate signature
- WasmType result = detectWasmType(parent, nullptr);
+ WasmType result = !!parent ? detectWasmType(parent, nullptr) : none;
std::string str = "FUNCSIG$";
str += getSig(result);
for (auto operand : operands) {
diff --git a/test/unit.asm.js b/test/unit.asm.js
index 64583da24..a2235dd62 100644
--- a/test/unit.asm.js
+++ b/test/unit.asm.js
@@ -126,6 +126,9 @@ function () {
if ((i >>> 0) < (j >>> 0)) i = i + 1 | 0;
return i | 0;
}
+ function cneg_nosemicolon() {
+ FUNCTION_TABLE_c[1 & 7](1) // no semicolon
+ }
function z() {
}
diff --git a/test/unit.fromasm b/test/unit.fromasm
index e4196c4d9..5a6b78de5 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -1,6 +1,7 @@
(module
(memory 16777216 16777216)
(type $FUNCSIG$vf (func (param f32)))
+ (type $FUNCSIG$vi (func (param i32)))
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
(import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))
(export "big_negative" $big_negative)
@@ -396,6 +397,18 @@
(get_local $i)
)
)
+ (func $cneg_nosemicolon
+ (call_indirect $FUNCSIG$vi
+ (i32.add
+ (i32.and
+ (i32.const 1)
+ (i32.const 7)
+ )
+ (i32.const 8)
+ )
+ (i32.const 1)
+ )
+ )
(func $z
(nop)
)