This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix type index block type handling in type checker
ClosedPublic

Authored by aheejin on Apr 7 2023, 9:54 PM.

Details

Summary

The current code is

ExpectBlockType = false;
TC.setLastSig(*Signature.get());
if (ExpectBlockType)
  NestingStack.back().Sig = *Signature.get();

Because of the first line, the third line's if (ExpectBlockType) is
always false and we don't get to update NestingStack.back().Sig. This
results in not correctly erroring out when the types of remaining values
on the stack do not match the block type if the block type is written in
the form of a function type. We should set ExpectBlockType to false
after the if.

Diff Detail

Event Timeline

aheejin created this revision.Apr 7 2023, 9:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2023, 9:54 PM
Herald added subscribers: pmatos, asb, wingo and 6 others. · View Herald Transcript
aheejin requested review of this revision.Apr 7 2023, 9:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2023, 9:54 PM
sbc100 accepted this revision.Apr 10 2023, 8:46 AM
This revision is now accepted and ready to land.Apr 10 2023, 8:46 AM
This revision was landed with ongoing or failed builds.Apr 11 2023, 2:05 AM
This revision was automatically updated to reflect the committed changes.