summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-05-13 10:27:55 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-05-13 11:17:49 -0700
commit7ccc6a3dcc3b2945e03dff20c6ecb0b6e1074ac4 (patch)
treed0e146d094484feaae625fac3ac29566fb7a5501
parent4513ec24ad33a4d0157d562217b310390d9cdb1b (diff)
downloadbinaryen-7ccc6a3dcc3b2945e03dff20c6ecb0b6e1074ac4.tar.gz
binaryen-7ccc6a3dcc3b2945e03dff20c6ecb0b6e1074ac4.tar.bz2
binaryen-7ccc6a3dcc3b2945e03dff20c6ecb0b6e1074ac4.zip
break type system fixes, avoid spurious errors on mismatched types
-rw-r--r--src/wasm-validator.h6
-rw-r--r--src/wasm.cpp6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h
index 49e2eb5d8..3d9693421 100644
--- a/src/wasm-validator.h
+++ b/src/wasm-validator.h
@@ -71,8 +71,10 @@ public:
} else {
if (breakTypes[name] == unreachable) {
breakTypes[name] = valueType;
- } else {
- shouldBeEqual(valueType, breakTypes[name], name.str, "breaks to same target must have same type (ignoring unreachable)");
+ } else if (valueType != unreachable) {
+ if (valueType != breakTypes[name]) {
+ breakTypes[name] = none; // a poison value that must not be consumed
+ }
}
}
}
diff --git a/src/wasm.cpp b/src/wasm.cpp
index 2157992e3..98268310a 100644
--- a/src/wasm.cpp
+++ b/src/wasm.cpp
@@ -33,7 +33,11 @@ struct BlockTypeSeeker : public PostWalker<BlockTypeSeeker, Visitor<BlockTypeSee
if (other == none) {
type = none;
} else if (other != unreachable) {
- type = other;
+ if (type == unreachable) {
+ type = other;
+ } else if (type != other) {
+ type = none; // poison value, we saw multiple types; this should not be consumed
+ }
}
}
}