diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-03-07 09:07:30 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 09:07:30 -0800 |
commit | 1a5b410701542413f497b3030c0b87f3600dc1bc (patch) | |
tree | d316e9a52cd4b8a1dd5574a07bafd3c33a067a93 /src/ir/branch-utils.h | |
parent | 3a5dcc61ffcc54cecdba2cac272be66310ab2f3d (diff) | |
download | binaryen-1a5b410701542413f497b3030c0b87f3600dc1bc.tar.gz binaryen-1a5b410701542413f497b3030c0b87f3600dc1bc.tar.bz2 binaryen-1a5b410701542413f497b3030c0b87f3600dc1bc.zip |
Fix getExitingBranches, which had |targets| instead of |curr->targets| (#1936)
That caused it to miss switch targets, and a code-folding bug.
Fixes #1838
Sadly the fuzzer didn't find this because code folding looks for very particular code patterns that are unlikely to be emitted randomly.
Diffstat (limited to 'src/ir/branch-utils.h')
-rw-r--r-- | src/ir/branch-utils.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ir/branch-utils.h b/src/ir/branch-utils.h index e8fd25119..b9448e590 100644 --- a/src/ir/branch-utils.h +++ b/src/ir/branch-utils.h @@ -95,7 +95,7 @@ inline std::set<Name> getExitingBranches(Expression* ast) { targets.insert(curr->name); } void visitSwitch(Switch* curr) { - for (auto target : targets) { + for (auto target : curr->targets) { targets.insert(target); } targets.insert(curr->default_); |