From 981c7efa1ae4b27d1efd212284e61b77e89977a5 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 30 Jul 2016 09:41:13 -0700 Subject: make sure to create unique implicit block names in s-parser --- src/wasm-s-parser.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/wasm-s-parser.h') diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index b70f70b4e..746d96cf2 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -387,7 +387,11 @@ private: bool brokeToAutoBlock; Name getPrefixedName(std::string prefix) { - return IString((prefix + std::to_string(otherIndex++)).c_str(), false); + // make sure to return a unique name not already on the stack + while (1) { + Name ret = IString((prefix + std::to_string(otherIndex++)).c_str(), false); + if (std::find(labelStack.begin(), labelStack.end(), ret) == labelStack.end()) return ret; + } } Name getFunctionName(Element& s) { -- cgit v1.2.3