diff options
author | Alon Zakai <azakai@google.com> | 2022-08-18 09:11:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-18 09:11:10 -0700 |
commit | 8a92ab5f5f0529fec4b71223858fac853837884e (patch) | |
tree | 38e722fdeb1f1c7c8e3879ded646e9c1b0c52f86 /src/ir/struct-utils.h | |
parent | 613fadc9b27be3f025ce6d280ce92c236f7b53e0 (diff) | |
download | binaryen-8a92ab5f5f0529fec4b71223858fac853837884e.tar.gz binaryen-8a92ab5f5f0529fec4b71223858fac853837884e.tar.bz2 binaryen-8a92ab5f5f0529fec4b71223858fac853837884e.zip |
Validator: Validate unreachable calls more carefully (#4909)
Normally the validator will find stale types properly, by just running refinalize and seeing
if the type has changed (if so, then some code forgot to refinalize). However, refinalize
is a local operation, so it does not apply to calls: a call's proper type is determined by
the global information of the function we are calling. As a result, we would not notice
errors like this:
(call $foo) ;; type: unreachable
Refinalizing that would not change the type from unreachable to the proper type, since
that is global information.
To validate this properly, validate that a call whose type is unreachable actually has
an unreachable child. That rules out an invalid unreachable type here, which leaves
concrete types, that we already have proper global validation for. The code here is
generalized to handle non-call things as well, but it only helps expressions requiring
global validation, so it likely only helps global.get and a few others.
Diffstat (limited to 'src/ir/struct-utils.h')
0 files changed, 0 insertions, 0 deletions