diff options
author | Thomas Lively <tlively@google.com> | 2024-03-08 13:12:15 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-08 21:12:15 +0000 |
commit | df1044fec09db03bb2e00f5ffb4652f7ee5caaad (patch) | |
tree | 357a47d12a691e9c8e0ffbb6e5ec10a05aba6650 /src | |
parent | a484cc215944a484bd4432668cff9ee53cacc720 (diff) | |
download | binaryen-df1044fec09db03bb2e00f5ffb4652f7ee5caaad.tar.gz binaryen-df1044fec09db03bb2e00f5ffb4652f7ee5caaad.tar.bz2 binaryen-df1044fec09db03bb2e00f5ffb4652f7ee5caaad.zip |
Check for unreachable in `Select::finalize(Type)` (#6389)
Previously selects finalized with explicit types would never be marked
unreachable, even when they should have been.
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 374a97e19..7147f2c3d 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -760,7 +760,15 @@ void Binary::finalize() { } } -void Select::finalize(Type type_) { type = type_; } +void Select::finalize(Type type_) { + assert(ifTrue && ifFalse); + if (ifTrue->type == Type::unreachable || ifFalse->type == Type::unreachable || + condition->type == Type::unreachable) { + type = Type::unreachable; + } else { + type = type_; + } +} void Select::finalize() { assert(ifTrue && ifFalse); |