Skip to content

fix(compiler): fix false-negative OOB when imm base+offset > INT32_MAX#427

Open
cmgCr wants to merge 2 commits intoDTVMStack:mainfrom
cmgCr:cmgCr/fix_issuse422
Open

fix(compiler): fix false-negative OOB when imm base+offset > INT32_MAX#427
cmgCr wants to merge 2 commits intoDTVMStack:mainfrom
cmgCr:cmgCr/fix_issuse422

Conversation

@cmgCr
Copy link
Copy Markdown
Contributor

@cmgCr cmgCr commented Mar 20, 2026

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

2. What is the scope of this PR (e.g. component or file name):

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains CI/CD configuration changes
  • Contains documentation changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

6. Release note

None

@github-actions
Copy link
Copy Markdown

⚡ Performance Regression Check Results

✅ Performance Check Passed (interpreter)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.50 1.49 -1.2% PASS
total/main/blake2b_huff/empty 0.02 0.02 -2.0% PASS
total/main/blake2b_shifts/8415nulls 12.07 12.07 -0.0% PASS
total/main/sha1_divs/5311 5.20 5.13 -1.4% PASS
total/main/sha1_divs/empty 0.07 0.07 -0.7% PASS
total/main/sha1_shifts/5311 3.06 3.05 -0.3% PASS
total/main/sha1_shifts/empty 0.04 0.04 -0.8% PASS
total/main/snailtracer/benchmark 56.21 55.90 -0.6% PASS
total/main/structarray_alloc/nfts_rank 1.03 1.04 +0.8% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 -3.2% PASS
total/main/swap_math/received 0.01 0.01 -3.1% PASS
total/main/swap_math/spent 0.00 0.00 -3.2% PASS
total/main/weierstrudel/1 0.29 0.29 -0.1% PASS
total/main/weierstrudel/15 3.15 3.16 +0.1% PASS
total/micro/JUMPDEST_n0/empty 1.32 1.31 -1.0% PASS
total/micro/jump_around/empty 0.09 0.09 -1.7% PASS
total/micro/loop_with_many_jumpdests/empty 19.96 19.92 -0.2% PASS
total/micro/memory_grow_mload/by1 0.09 0.10 +6.7% PASS
total/micro/memory_grow_mload/by16 0.11 0.11 -0.2% PASS
total/micro/memory_grow_mload/by32 0.12 0.12 -1.6% PASS
total/micro/memory_grow_mload/nogrow 0.09 0.09 +7.3% PASS
total/micro/memory_grow_mstore/by1 0.10 0.10 +6.8% PASS
total/micro/memory_grow_mstore/by16 0.11 0.11 -0.5% PASS
total/micro/memory_grow_mstore/by32 0.12 0.12 -0.1% PASS
total/micro/memory_grow_mstore/nogrow 0.09 0.09 -0.2% PASS
total/micro/signextend/one 0.23 0.24 +1.4% PASS
total/micro/signextend/zero 0.23 0.23 +0.0% PASS
total/synth/ADD/b0 4.10 4.09 -0.3% PASS
total/synth/ADD/b1 1.98 1.97 -0.5% PASS
total/synth/ADDRESS/a0 4.83 4.84 +0.1% PASS
total/synth/ADDRESS/a1 5.33 5.40 +1.3% PASS
total/synth/AND/b0 1.64 1.64 -0.2% PASS
total/synth/AND/b1 1.71 1.71 -0.0% PASS
total/synth/BYTE/b0 6.27 6.27 +0.0% PASS
total/synth/BYTE/b1 4.82 4.79 -0.5% PASS
total/synth/CALLDATASIZE/a0 3.18 3.18 -0.0% PASS
total/synth/CALLDATASIZE/a1 3.86 3.87 +0.3% PASS
total/synth/CALLER/a0 4.85 4.84 -0.1% PASS
total/synth/CALLER/a1 5.45 5.41 -0.7% PASS
total/synth/CALLVALUE/a0 3.38 3.26 -3.4% PASS
total/synth/CALLVALUE/a1 3.43 3.35 -2.3% PASS
total/synth/CODESIZE/a0 3.51 3.53 +0.8% PASS
total/synth/CODESIZE/a1 3.86 3.83 -0.6% PASS
total/synth/DUP1/d0 5.22 5.24 +0.2% PASS
total/synth/DUP1/d1 1.16 1.39 +19.9% PASS
total/synth/DUP10/d0 5.36 5.24 -2.1% PASS
total/synth/DUP10/d1 1.22 1.15 -5.9% PASS
total/synth/DUP11/d0 5.22 4.22 -19.2% PASS
total/synth/DUP11/d1 1.39 1.15 -17.3% PASS
total/synth/DUP12/d0 3.70 4.09 +10.5% PASS
total/synth/DUP12/d1 1.16 1.15 -0.1% PASS
total/synth/DUP13/d0 5.24 3.74 -28.6% PASS
total/synth/DUP13/d1 1.30 1.26 -3.4% PASS
total/synth/DUP14/d0 5.21 3.77 -27.6% PASS
total/synth/DUP14/d1 1.39 1.15 -16.8% PASS
total/synth/DUP15/d0 3.72 3.72 -0.1% PASS
total/synth/DUP15/d1 1.15 1.18 +2.7% PASS
total/synth/DUP16/d0 3.73 3.70 -0.8% PASS
total/synth/DUP16/d1 1.26 1.15 -8.5% PASS
total/synth/DUP2/d0 5.09 4.22 -17.1% PASS
total/synth/DUP2/d1 1.16 1.15 -0.9% PASS
total/synth/DUP3/d0 5.21 3.44 -33.9% PASS
total/synth/DUP3/d1 1.23 1.15 -5.9% PASS
total/synth/DUP4/d0 4.96 3.60 -27.4% PASS
total/synth/DUP4/d1 1.16 1.15 -0.2% PASS
total/synth/DUP5/d0 5.08 3.08 -39.5% PASS
total/synth/DUP5/d1 1.39 1.15 -17.4% PASS
total/synth/DUP6/d0 5.22 3.67 -29.7% PASS
total/synth/DUP6/d1 1.32 1.15 -12.5% PASS
total/synth/DUP7/d0 5.20 5.21 +0.2% PASS
total/synth/DUP7/d1 1.39 1.16 -16.7% PASS
total/synth/DUP8/d0 3.74 4.70 +25.7% PASS
total/synth/DUP8/d1 1.38 1.15 -16.2% PASS
total/synth/DUP9/d0 5.22 3.76 -28.0% PASS
total/synth/DUP9/d1 1.15 1.39 +20.9% PASS
total/synth/EQ/b0 2.70 2.70 +0.0% PASS
total/synth/EQ/b1 1.32 1.31 -0.4% PASS
total/synth/GAS/a0 3.76 3.75 -0.4% PASS
total/synth/GAS/a1 3.85 3.76 -2.4% PASS
total/synth/GT/b0 2.61 2.61 +0.0% PASS
total/synth/GT/b1 1.56 1.56 -0.0% PASS
total/synth/ISZERO/u0 1.14 1.14 -0.0% PASS
total/synth/JUMPDEST/n0 1.31 1.31 +0.1% PASS
total/synth/LT/b0 2.61 2.61 -0.0% PASS
total/synth/LT/b1 1.56 1.56 +0.0% PASS
total/synth/MSIZE/a0 4.24 4.24 +0.0% PASS
total/synth/MSIZE/a1 4.84 4.83 -0.1% PASS
total/synth/MUL/b0 5.32 5.30 -0.3% PASS
total/synth/MUL/b1 5.37 5.37 -0.0% PASS
total/synth/NOT/u0 1.67 1.66 -0.4% PASS
total/synth/OR/b0 1.64 1.64 -0.0% PASS
total/synth/OR/b1 1.72 1.71 -0.3% PASS
total/synth/PC/a0 3.10 3.37 +8.8% PASS
total/synth/PC/a1 4.06 4.16 +2.5% PASS
total/synth/PUSH1/p0 1.07 1.23 +14.9% PASS
total/synth/PUSH1/p1 1.35 1.33 -1.7% PASS
total/synth/PUSH10/p0 1.23 1.08 -12.4% PASS
total/synth/PUSH10/p1 1.36 1.35 -0.4% PASS
total/synth/PUSH11/p0 1.22 1.25 +2.5% PASS
total/synth/PUSH11/p1 1.36 1.28 -6.0% PASS
total/synth/PUSH12/p0 1.23 1.07 -12.9% PASS
total/synth/PUSH12/p1 1.14 1.32 +15.4% PASS
total/synth/PUSH13/p0 1.31 1.17 -10.8% PASS
total/synth/PUSH13/p1 1.36 1.35 -0.3% PASS
total/synth/PUSH14/p0 1.32 1.25 -5.3% PASS
total/synth/PUSH14/p1 1.36 1.36 -0.5% PASS
total/synth/PUSH15/p0 1.31 1.31 -0.1% PASS
total/synth/PUSH15/p1 1.45 1.45 -0.1% PASS
total/synth/PUSH16/p0 1.31 1.31 +0.1% PASS
total/synth/PUSH16/p1 1.23 1.35 +9.7% PASS
total/synth/PUSH17/p0 1.07 1.31 +22.3% PASS
total/synth/PUSH17/p1 1.36 1.35 -0.3% PASS
total/synth/PUSH18/p0 1.00 1.31 +31.3% PASS
total/synth/PUSH18/p1 1.36 1.12 -17.5% PASS
total/synth/PUSH19/p0 1.07 1.31 +21.9% PASS
total/synth/PUSH19/p1 1.37 1.36 -0.3% PASS
total/synth/PUSH2/p0 1.31 1.08 -17.6% PASS
total/synth/PUSH2/p1 1.35 1.12 -17.5% PASS
total/synth/PUSH20/p0 1.07 1.23 +14.6% PASS
total/synth/PUSH20/p1 1.35 1.38 +1.8% PASS
total/synth/PUSH21/p0 1.23 1.07 -13.1% PASS
total/synth/PUSH21/p1 1.35 1.36 +0.2% PASS
total/synth/PUSH22/p0 1.24 1.07 -13.5% PASS
total/synth/PUSH22/p1 1.12 1.38 +23.7% PASS
total/synth/PUSH23/p0 1.31 0.99 -24.4% PASS
total/synth/PUSH23/p1 1.37 1.22 -10.9% PASS
total/synth/PUSH24/p0 1.23 1.31 +6.5% PASS
total/synth/PUSH24/p1 1.36 1.36 +0.1% PASS
total/synth/PUSH25/p0 1.31 1.23 -6.2% PASS
total/synth/PUSH25/p1 1.35 1.34 -0.5% PASS
total/synth/PUSH26/p0 1.02 1.23 +21.3% PASS
total/synth/PUSH26/p1 1.36 1.36 +0.2% PASS
total/synth/PUSH27/p0 1.31 1.31 -0.1% PASS
total/synth/PUSH27/p1 1.36 1.15 -15.7% PASS
total/synth/PUSH28/p0 1.23 1.11 -10.3% PASS
total/synth/PUSH28/p1 1.31 1.30 -0.9% PASS
total/synth/PUSH29/p0 1.31 1.25 -4.6% PASS
total/synth/PUSH29/p1 1.36 1.12 -17.8% PASS
total/synth/PUSH3/p0 1.31 1.23 -6.6% PASS
total/synth/PUSH3/p1 1.35 1.33 -1.7% PASS
total/synth/PUSH30/p0 1.31 1.09 -17.2% PASS
total/synth/PUSH30/p1 1.23 1.18 -4.5% PASS
total/synth/PUSH31/p0 1.31 1.31 -0.1% PASS
total/synth/PUSH31/p1 1.33 1.48 +11.3% PASS
total/synth/PUSH32/p0 1.31 1.23 -5.9% PASS
total/synth/PUSH32/p1 1.22 1.15 -6.1% PASS
total/synth/PUSH4/p0 1.31 1.23 -6.4% PASS
total/synth/PUSH4/p1 1.11 1.35 +22.0% PASS
total/synth/PUSH5/p0 1.24 1.07 -13.3% PASS
total/synth/PUSH5/p1 1.35 1.35 +0.4% PASS
total/synth/PUSH6/p0 1.31 1.31 +0.2% PASS
total/synth/PUSH6/p1 1.24 1.33 +7.8% PASS
total/synth/PUSH7/p0 0.99 1.31 +32.2% PASS
total/synth/PUSH7/p1 1.35 1.34 -1.1% PASS
total/synth/PUSH8/p0 1.13 1.23 +8.9% PASS
total/synth/PUSH8/p1 1.35 1.35 +0.0% PASS
total/synth/PUSH9/p0 1.07 1.08 +0.6% PASS
total/synth/PUSH9/p1 1.35 1.23 -9.2% PASS
total/synth/RETURNDATASIZE/a0 3.59 3.59 +0.0% PASS
total/synth/RETURNDATASIZE/a1 3.93 3.92 -0.4% PASS
total/synth/SAR/b0 3.77 3.77 +0.0% PASS
total/synth/SAR/b1 4.28 4.26 -0.4% PASS
total/synth/SGT/b0 2.60 2.60 +0.0% PASS
total/synth/SGT/b1 1.72 1.70 -0.9% PASS
total/synth/SHL/b0 3.06 3.08 +0.7% PASS
total/synth/SHL/b1 1.69 1.77 +5.0% PASS
total/synth/SHR/b0 3.11 3.11 -0.1% PASS
total/synth/SHR/b1 1.72 1.66 -3.2% PASS
total/synth/SIGNEXTEND/b0 3.34 3.34 -0.1% PASS
total/synth/SIGNEXTEND/b1 3.45 3.43 -0.6% PASS
total/synth/SLT/b0 2.60 2.59 -0.2% PASS
total/synth/SLT/b1 1.72 1.61 -6.4% PASS
total/synth/SUB/b0 1.96 1.97 +0.7% PASS
total/synth/SUB/b1 1.99 1.98 -0.2% PASS
total/synth/SWAP1/s0 1.80 1.80 -0.0% PASS
total/synth/SWAP10/s0 1.81 1.81 -0.1% PASS
total/synth/SWAP11/s0 1.51 1.81 +20.3% PASS
total/synth/SWAP12/s0 1.82 1.82 +0.0% PASS
total/synth/SWAP13/s0 1.82 1.82 +0.0% PASS
total/synth/SWAP14/s0 1.82 1.82 -0.1% PASS
total/synth/SWAP15/s0 1.82 1.82 -0.1% PASS
total/synth/SWAP16/s0 1.82 1.82 -0.2% PASS
total/synth/SWAP2/s0 1.80 1.80 -0.0% PASS
total/synth/SWAP3/s0 1.80 1.54 -14.5% PASS
total/synth/SWAP4/s0 1.80 1.80 -0.1% PASS
total/synth/SWAP5/s0 1.81 1.81 +0.1% PASS
total/synth/SWAP6/s0 1.81 1.81 +0.3% PASS
total/synth/SWAP7/s0 1.81 1.81 -0.0% PASS
total/synth/SWAP8/s0 1.81 1.81 -0.1% PASS
total/synth/SWAP9/s0 1.51 1.81 +19.8% PASS
total/synth/XOR/b0 1.55 1.55 +0.0% PASS
total/synth/XOR/b1 1.55 1.55 -0.2% PASS
total/synth/loop_v1 4.82 4.83 +0.2% PASS
total/synth/loop_v2 4.79 4.77 -0.4% PASS

Summary: 194 benchmarks, 0 regressions


✅ Performance Check Passed (multipass)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.53 1.53 +0.1% PASS
total/main/blake2b_huff/empty 0.07 0.07 -0.1% PASS
total/main/blake2b_shifts/8415nulls 6.43 6.42 -0.1% PASS
total/main/sha1_divs/5311 3.53 3.53 -0.0% PASS
total/main/sha1_divs/empty 0.05 0.05 +0.3% PASS
total/main/sha1_shifts/5311 3.72 3.71 -0.3% PASS
total/main/sha1_shifts/empty 0.05 0.05 +0.1% PASS
total/main/snailtracer/benchmark 59.12 57.88 -2.1% PASS
total/main/structarray_alloc/nfts_rank 0.30 0.30 -0.1% PASS
total/main/swap_math/insufficient_liquidity 0.02 0.02 -0.3% PASS
total/main/swap_math/received 0.02 0.02 +0.8% PASS
total/main/swap_math/spent 0.02 0.02 +0.2% PASS
total/main/weierstrudel/1 0.36 0.36 -0.1% PASS
total/main/weierstrudel/15 3.25 3.23 -0.4% PASS
total/micro/JUMPDEST_n0/empty 0.13 0.13 -0.3% PASS
total/micro/jump_around/empty 0.63 0.63 +0.5% PASS
total/micro/loop_with_many_jumpdests/empty 1.96 1.99 +1.5% PASS
total/micro/memory_grow_mload/by1 0.19 0.19 -1.4% PASS
total/micro/memory_grow_mload/by16 0.20 0.20 -0.2% PASS
total/micro/memory_grow_mload/by32 0.22 0.21 -1.3% PASS
total/micro/memory_grow_mload/nogrow 0.19 0.19 +0.6% PASS
total/micro/memory_grow_mstore/by1 0.19 0.19 +0.2% PASS
total/micro/memory_grow_mstore/by16 0.20 0.20 -0.1% PASS
total/micro/memory_grow_mstore/by32 0.22 0.22 -0.2% PASS
total/micro/memory_grow_mstore/nogrow 0.19 0.19 -0.3% PASS
total/micro/signextend/one 0.35 0.35 -0.2% PASS
total/micro/signextend/zero 0.35 0.35 -0.1% PASS
total/synth/ADD/b0 0.01 0.01 -3.4% PASS
total/synth/ADD/b1 0.01 0.01 -14.5% PASS
total/synth/ADDRESS/a0 0.16 0.16 -0.0% PASS
total/synth/ADDRESS/a1 0.16 0.16 +0.1% PASS
total/synth/AND/b0 0.01 0.01 -4.6% PASS
total/synth/AND/b1 0.01 0.01 -4.0% PASS
total/synth/BYTE/b0 1.96 1.96 -0.0% PASS
total/synth/BYTE/b1 2.29 2.29 +0.0% PASS
total/synth/CALLDATASIZE/a0 0.08 0.08 -3.2% PASS
total/synth/CALLDATASIZE/a1 0.08 0.08 -4.0% PASS
total/synth/CALLER/a0 0.16 0.16 -0.1% PASS
total/synth/CALLER/a1 0.16 0.16 -0.0% PASS
total/synth/CALLVALUE/a0 0.28 0.28 +0.0% PASS
total/synth/CALLVALUE/a1 0.28 0.28 +0.0% PASS
total/synth/CODESIZE/a0 0.08 0.08 -1.3% PASS
total/synth/CODESIZE/a1 0.08 0.08 -0.2% PASS
total/synth/DUP1/d0 0.01 0.01 -2.8% PASS
total/synth/DUP1/d1 0.01 0.01 -7.4% PASS
total/synth/DUP10/d0 0.01 0.01 -2.0% PASS
total/synth/DUP10/d1 0.01 0.01 -8.1% PASS
total/synth/DUP11/d0 0.01 0.01 -7.9% PASS
total/synth/DUP11/d1 0.01 0.01 -11.9% PASS
total/synth/DUP12/d0 0.01 0.01 -7.1% PASS
total/synth/DUP12/d1 0.01 0.01 -12.6% PASS
total/synth/DUP13/d0 0.01 0.01 -3.8% PASS
total/synth/DUP13/d1 0.01 0.01 -5.5% PASS
total/synth/DUP14/d0 0.01 0.01 -1.2% PASS
total/synth/DUP14/d1 0.01 0.01 -11.9% PASS
total/synth/DUP15/d0 0.01 0.01 -0.2% PASS
total/synth/DUP15/d1 0.01 0.01 -14.1% PASS
total/synth/DUP16/d0 0.01 0.01 -0.2% PASS
total/synth/DUP16/d1 0.01 0.01 -14.2% PASS
total/synth/DUP2/d0 0.01 0.01 -7.8% PASS
total/synth/DUP2/d1 0.01 0.01 -13.9% PASS
total/synth/DUP3/d0 0.01 0.01 -6.1% PASS
total/synth/DUP3/d1 0.01 0.01 -1.3% PASS
total/synth/DUP4/d0 0.01 0.01 -4.1% PASS
total/synth/DUP4/d1 0.01 0.01 -9.5% PASS
total/synth/DUP5/d0 0.01 0.01 -4.9% PASS
total/synth/DUP5/d1 0.01 0.01 -11.1% PASS
total/synth/DUP6/d0 0.01 0.01 -5.9% PASS
total/synth/DUP6/d1 0.01 0.01 -8.3% PASS
total/synth/DUP7/d0 0.01 0.01 -2.5% PASS
total/synth/DUP7/d1 0.01 0.01 -6.5% PASS
total/synth/DUP8/d0 0.01 0.01 -2.7% PASS
total/synth/DUP8/d1 0.01 0.01 -4.7% PASS
total/synth/DUP9/d0 0.01 0.01 -7.9% PASS
total/synth/DUP9/d1 0.01 0.01 -6.0% PASS
total/synth/EQ/b0 0.01 0.01 -6.9% PASS
total/synth/EQ/b1 0.01 0.01 -11.0% PASS
total/synth/GAS/a0 0.79 0.79 -0.0% PASS
total/synth/GAS/a1 0.79 0.79 -0.1% PASS
total/synth/GT/b0 0.01 0.01 -7.9% PASS
total/synth/GT/b1 0.01 0.01 -13.5% PASS
total/synth/ISZERO/u0 0.01 0.01 -0.1% PASS
total/synth/JUMPDEST/n0 0.13 0.13 -0.7% PASS
total/synth/LT/b0 0.01 0.01 -3.9% PASS
total/synth/LT/b1 0.01 0.01 -2.1% PASS
total/synth/MSIZE/a0 0.01 0.01 -0.1% PASS
total/synth/MSIZE/a1 0.01 0.01 -17.2% PASS
total/synth/MUL/b0 0.01 0.01 -1.6% PASS
total/synth/MUL/b1 0.01 0.01 -8.8% PASS
total/synth/NOT/u0 0.01 0.01 +0.1% PASS
total/synth/OR/b0 0.01 0.01 -5.8% PASS
total/synth/OR/b1 0.01 0.01 -10.5% PASS
total/synth/PC/a0 0.01 0.01 -0.1% PASS
total/synth/PC/a1 0.01 0.01 -10.2% PASS
total/synth/PUSH1/p0 0.01 0.01 -11.7% PASS
total/synth/PUSH1/p1 0.01 0.01 -12.4% PASS
total/synth/PUSH10/p0 0.01 0.01 -9.7% PASS
total/synth/PUSH10/p1 0.01 0.01 -12.2% PASS
total/synth/PUSH11/p0 0.01 0.01 -5.6% PASS
total/synth/PUSH11/p1 0.01 0.01 -13.1% PASS
total/synth/PUSH12/p0 0.01 0.01 -14.1% PASS
total/synth/PUSH12/p1 0.01 0.01 -6.9% PASS
total/synth/PUSH13/p0 0.01 0.01 -9.9% PASS
total/synth/PUSH13/p1 0.01 0.01 -10.3% PASS
total/synth/PUSH14/p0 0.01 0.01 -0.3% PASS
total/synth/PUSH14/p1 0.01 0.01 -5.1% PASS
total/synth/PUSH15/p0 0.01 0.01 -2.7% PASS
total/synth/PUSH15/p1 0.01 0.01 -2.6% PASS
total/synth/PUSH16/p0 0.01 0.01 -5.6% PASS
total/synth/PUSH16/p1 0.01 0.01 -0.7% PASS
total/synth/PUSH17/p0 0.01 0.01 -1.0% PASS
total/synth/PUSH17/p1 0.01 0.01 -2.7% PASS
total/synth/PUSH18/p0 0.01 0.01 -1.0% PASS
total/synth/PUSH18/p1 0.01 0.01 -7.6% PASS
total/synth/PUSH19/p0 0.01 0.01 -0.6% PASS
total/synth/PUSH19/p1 0.01 0.01 -0.6% PASS
total/synth/PUSH2/p0 0.01 0.01 -6.6% PASS
total/synth/PUSH2/p1 0.01 0.01 -10.0% PASS
total/synth/PUSH20/p0 0.01 0.01 -1.8% PASS
total/synth/PUSH20/p1 0.01 0.01 -4.6% PASS
total/synth/PUSH21/p0 0.01 0.01 -0.4% PASS
total/synth/PUSH21/p1 0.01 0.01 -8.9% PASS
total/synth/PUSH22/p0 1.32 1.04 -21.6% PASS
total/synth/PUSH22/p1 1.17 1.16 -0.2% PASS
total/synth/PUSH23/p0 1.32 1.32 -0.3% PASS
total/synth/PUSH23/p1 1.14 1.16 +2.1% PASS
total/synth/PUSH24/p0 1.32 1.24 -6.2% PASS
total/synth/PUSH24/p1 1.15 1.14 -0.6% PASS
total/synth/PUSH25/p0 1.32 1.32 -0.4% PASS
total/synth/PUSH25/p1 1.16 1.13 -2.3% PASS
total/synth/PUSH26/p0 1.08 1.16 +7.0% PASS
total/synth/PUSH26/p1 1.15 1.14 -0.2% PASS
total/synth/PUSH27/p0 1.32 1.25 -5.3% PASS
total/synth/PUSH27/p1 1.14 1.14 +0.3% PASS
total/synth/PUSH28/p0 1.32 1.26 -4.8% PASS
total/synth/PUSH28/p1 1.14 1.14 +0.0% PASS
total/synth/PUSH29/p0 1.32 1.30 -1.6% PASS
total/synth/PUSH29/p1 1.15 1.14 -0.8% PASS
total/synth/PUSH3/p0 0.01 0.01 -5.6% PASS
total/synth/PUSH3/p1 0.01 0.01 -2.1% PASS
total/synth/PUSH30/p0 1.34 1.32 -1.1% PASS
total/synth/PUSH30/p1 1.18 1.18 +0.3% PASS
total/synth/PUSH31/p0 1.33 1.08 -18.5% PASS
total/synth/PUSH31/p1 1.26 1.29 +2.2% PASS
total/synth/PUSH32/p0 1.27 1.00 -20.6% PASS
total/synth/PUSH32/p1 1.18 1.15 -2.4% PASS
total/synth/PUSH4/p0 0.01 0.01 -13.2% PASS
total/synth/PUSH4/p1 0.01 0.01 -12.5% PASS
total/synth/PUSH5/p0 0.01 0.01 -1.2% PASS
total/synth/PUSH5/p1 0.01 0.01 -7.6% PASS
total/synth/PUSH6/p0 0.01 0.01 -13.4% PASS
total/synth/PUSH6/p1 0.01 0.01 -11.3% PASS
total/synth/PUSH7/p0 0.01 0.01 -2.5% PASS
total/synth/PUSH7/p1 0.01 0.01 -5.3% PASS
total/synth/PUSH8/p0 0.01 0.01 -4.6% PASS
total/synth/PUSH8/p1 0.01 0.01 -8.1% PASS
total/synth/PUSH9/p0 0.01 0.01 -8.2% PASS
total/synth/PUSH9/p1 0.01 0.01 -4.6% PASS
total/synth/RETURNDATASIZE/a0 0.53 0.53 +0.2% PASS
total/synth/RETURNDATASIZE/a1 0.49 0.49 +0.1% PASS
total/synth/SAR/b0 3.78 3.78 +0.1% PASS
total/synth/SAR/b1 4.28 4.30 +0.4% PASS
total/synth/SGT/b0 0.01 0.01 -5.1% PASS
total/synth/SGT/b1 0.01 0.01 -6.0% PASS
total/synth/SHL/b0 3.06 3.06 +0.0% PASS
total/synth/SHL/b1 1.69 1.69 -0.1% PASS
total/synth/SHR/b0 3.10 3.10 +0.0% PASS
total/synth/SHR/b1 1.61 1.61 +0.1% PASS
total/synth/SIGNEXTEND/b0 3.12 3.11 -0.1% PASS
total/synth/SIGNEXTEND/b1 3.35 3.31 -1.4% PASS
total/synth/SLT/b0 0.01 0.01 -1.9% PASS
total/synth/SLT/b1 0.01 0.01 -6.4% PASS
total/synth/SUB/b0 0.01 0.01 -7.0% PASS
total/synth/SUB/b1 0.01 0.01 -13.9% PASS
total/synth/SWAP1/s0 0.01 0.01 -4.5% PASS
total/synth/SWAP10/s0 0.01 0.01 -7.0% PASS
total/synth/SWAP11/s0 0.01 0.01 -10.8% PASS
total/synth/SWAP12/s0 0.01 0.01 -6.4% PASS
total/synth/SWAP13/s0 0.01 0.01 -2.0% PASS
total/synth/SWAP14/s0 0.01 0.01 -7.5% PASS
total/synth/SWAP15/s0 0.01 0.01 -0.2% PASS
total/synth/SWAP16/s0 0.01 0.01 -0.1% PASS
total/synth/SWAP2/s0 0.01 0.01 -5.2% PASS
total/synth/SWAP3/s0 0.01 0.01 -7.7% PASS
total/synth/SWAP4/s0 0.01 0.01 -4.9% PASS
total/synth/SWAP5/s0 0.01 0.01 -6.5% PASS
total/synth/SWAP6/s0 0.01 0.01 -5.9% PASS
total/synth/SWAP7/s0 0.01 0.01 -3.9% PASS
total/synth/SWAP8/s0 0.01 0.01 -10.9% PASS
total/synth/SWAP9/s0 0.01 0.01 -0.6% PASS
total/synth/XOR/b0 0.01 0.01 -0.8% PASS
total/synth/XOR/b1 0.01 0.01 -3.7% PASS
total/synth/loop_v1 1.42 1.41 -0.7% PASS
total/synth/loop_v2 1.42 1.41 -0.2% PASS

Summary: 194 benchmarks, 0 regressions


Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect x64 singlepass memory addressing when an immediate base combined with an offset crosses the signed disp32 boundary (and related large-offset cases), preventing missed traps (false-negative OOB) and incorrect negative displacement addressing.

Changes:

  • Update x64 singlepass load/store address formation to avoid folding imm_base + offset into a sign-extending disp32 when the sum exceeds INT32_MAX.
  • Add WAST regressions covering (1) immediate-base overflow leading to required OOB trap, and (2) large offsets that must not trap when in-bounds (plus a true OOB case).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/singlepass/x64/codegen.h Adjusts load/store address generation to use a base register path (and 64-bit materialization for large displacements) instead of producing sign-extended negative disp32 addresses.
tests/wast/spec_extra/store_large_offset_false_positive_oob.wast Adds a large-memory regression test ensuring large-offset accesses that are in-bounds do not trap, and that a truly OOB case still traps.
tests/wast/spec_extra/store_imm_base_overflow_false_negative_oob.wast Adds regressions for the issue reproducer pattern where (uint64)base + offset exceeds memory and must trap (store + load variants).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to +13
(module
(memory (;0;) 65131)

Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test instantiates a very large minimum memory (65131 pages ≈ 4.27GB). Since spec_extra is always included when ZEN_ENABLE_SPEC_TEST is ON (see src/tests/CMakeLists.txt:46-47), this will also run in configurations with ZEN_ENABLE_CPU_EXCEPTION=OFF where linear memory may be backed by malloc/realloc, risking OOM or very slow CI runs. Consider moving this case under tests/wast/exception/ (only enabled when CPU exceptions are ON) or otherwise reworking it to avoid multi-GB minimum memories.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +9
;; Memory size = 65131 * 65536 = 4269236224
;; 4268418419 + 8 <= 4269236224 => in-bounds, should NOT trap.
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment’s memory-size arithmetic looks incorrect: 65131 * 65536 equals 4268425216 bytes (not 4269236224). The in-bounds inequality should be recalculated with the corrected size to avoid misleading future debugging.

Suggested change
;; Memory size = 65131 * 65536 = 4269236224
;; 4268418419 + 8 <= 4269236224 => in-bounds, should NOT trap.
;; Memory size = 65131 * 65536 = 4268425216
;; 4268418419 + 8 <= 4268425216 => in-bounds, should NOT trap.

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +10
;; Memory size = 32769 * 65536 = 2147549184
;; 5550826491 + 2 > 2147549184 => out-of-bounds, MUST trap.

(module
(memory (;0;) 32769)
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test requires a 32769-page minimum memory (~2GB). Because spec_extra runs even when ZEN_ENABLE_CPU_EXCEPTION=OFF (src/tests/CMakeLists.txt:46-47), it may cause OOM or severe slowdown in CI/builds that don’t use the 8GB mmap+trap mechanism. Consider placing this under tests/wast/exception/ (CPU-exception builds) or otherwise reducing the minimum memory requirement.

Suggested change
;; Memory size = 32769 * 65536 = 2147549184
;; 5550826491 + 2 > 2147549184 => out-of-bounds, MUST trap.
(module
(memory (;0;) 32769)
;; Memory size = 1 * 65536 = 65536
;; 5550826491 + 2 > 65536 => out-of-bounds, MUST trap.
(module
(memory (;0;) 1)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A bug in singlepass mode

2 participants