Commit 85f2425
JIT: Fix KnownBits bounds-check width and drop dead include
The bounds-check consumer hardcoded width=32 in EvalRelop, which is unsound on
64-bit targets where fgMorphIndexAddr (morph.cpp:2995-3015) widens the bounds
check to TYP_I_IMPL when the index is native int. With a TYP_LONG index whose
low 32 bits are provably small but whose high 32 bits are unknown, the fold
could prove (uint)idx < (uint)len using only the low half and incorrectly drop
a required bounds check (memory corruption).
Derive the width from the operand type, matching the other two consumers.
Caught by Opus 4.7 (xhigh), Opus 4.8, and GPT-5.5 in parallel review.
Also drop the now-dead #include "knownbits.h" from rangecheck.cpp left over
from the previous cleanup commit.
libraries.pmi: -13,920 bytes (was -14,515; ~600 byte loss is the correctness
recovery -- those wins were unsound TYP_LONG bounds-check drops).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 7c5bf61 commit 85f2425
2 files changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5572 | 5572 | | |
5573 | 5573 | | |
5574 | 5574 | | |
5575 | | - | |
| 5575 | + | |
| 5576 | + | |
| 5577 | + | |
| 5578 | + | |
| 5579 | + | |
| 5580 | + | |
5576 | 5581 | | |
5577 | 5582 | | |
5578 | | - | |
| 5583 | + | |
5579 | 5584 | | |
5580 | 5585 | | |
5581 | 5586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
0 commit comments