From 7ccc6a3dcc3b2945e03dff20c6ecb0b6e1074ac4 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 13 May 2016 10:27:55 -0700 Subject: break type system fixes, avoid spurious errors on mismatched types --- src/wasm-validator.h | 6 ++++-- src/wasm.cpp | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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