Skip to content

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

Merged
zoowii merged 3 commits intoDTVMStack:mainfrom
cmgCr:cmgCr/fix_issuse422
Apr 1, 2026
Merged

fix(compiler): fix false-negative OOB when imm base+offset > INT32_MAX#427
zoowii merged 3 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

github-actions Bot commented Mar 20, 2026

⚡ 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.59 1.53 -3.5% PASS
total/main/blake2b_huff/empty 0.03 0.02 -2.7% PASS
total/main/blake2b_shifts/8415nulls 12.03 11.99 -0.3% PASS
total/main/sha1_divs/5311 5.15 5.17 +0.3% PASS
total/main/sha1_divs/empty 0.06 0.06 -0.5% PASS
total/main/sha1_shifts/5311 2.92 2.95 +1.1% PASS
total/main/sha1_shifts/empty 0.04 0.04 -0.4% PASS
total/main/snailtracer/benchmark 54.49 53.21 -2.3% PASS
total/main/structarray_alloc/nfts_rank 1.02 0.98 -3.6% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 -0.7% PASS
total/main/swap_math/received 0.00 0.00 -0.7% PASS
total/main/swap_math/spent 0.00 0.00 +0.7% PASS
total/main/weierstrudel/1 0.28 0.28 -0.4% PASS
total/main/weierstrudel/15 3.15 3.13 -0.5% PASS
total/micro/JUMPDEST_n0/empty 1.79 1.79 +0.0% PASS
total/micro/jump_around/empty 0.09 0.09 -0.4% PASS
total/micro/loop_with_many_jumpdests/empty 20.64 27.39 +32.7% REGRESSED
total/micro/memory_grow_mload/by1 0.10 0.10 -4.4% PASS
total/micro/memory_grow_mload/by16 0.10 0.10 +3.0% PASS
total/micro/memory_grow_mload/by32 0.12 0.11 -5.9% PASS
total/micro/memory_grow_mload/nogrow 0.09 0.09 +0.6% PASS
total/micro/memory_grow_mstore/by1 0.10 0.10 +0.9% PASS
total/micro/memory_grow_mstore/by16 0.11 0.10 -5.7% PASS
total/micro/memory_grow_mstore/by32 0.12 0.12 -5.4% PASS
total/micro/memory_grow_mstore/nogrow 0.10 0.10 -0.2% PASS
total/micro/signextend/one 0.23 0.23 +0.1% PASS
total/micro/signextend/zero 0.23 0.23 -1.7% PASS
total/synth/ADD/b0 2.00 1.99 -0.4% PASS
total/synth/ADD/b1 2.02 2.00 -0.6% PASS
total/synth/ADDRESS/a0 4.76 4.76 +0.0% PASS
total/synth/ADDRESS/a1 5.31 5.31 -0.1% PASS
total/synth/AND/b0 1.71 1.71 +0.1% PASS
total/synth/AND/b1 1.72 1.72 -0.0% PASS
total/synth/BYTE/b0 6.12 6.12 -0.0% PASS
total/synth/BYTE/b1 4.77 4.78 +0.3% PASS
total/synth/CALLDATASIZE/a0 3.59 3.60 +0.5% PASS
total/synth/CALLDATASIZE/a1 3.60 3.60 -0.0% PASS
total/synth/CALLER/a0 4.73 4.74 +0.1% PASS
total/synth/CALLER/a1 5.32 5.31 -0.2% PASS
total/synth/CALLVALUE/a0 3.76 3.50 -6.7% PASS
total/synth/CALLVALUE/a1 3.77 3.76 -0.1% PASS
total/synth/CODESIZE/a0 3.99 3.99 +0.1% PASS
total/synth/CODESIZE/a1 4.01 4.01 -0.1% PASS
total/synth/DUP1/d0 1.31 1.23 -6.2% PASS
total/synth/DUP1/d1 1.40 1.40 -0.3% PASS
total/synth/DUP10/d0 1.38 1.31 -5.2% PASS
total/synth/DUP10/d1 1.17 1.40 +19.7% PASS
total/synth/DUP11/d0 1.31 1.31 -0.0% PASS
total/synth/DUP11/d1 1.16 1.18 +2.0% PASS
total/synth/DUP12/d0 1.31 1.31 -0.2% PASS
total/synth/DUP12/d1 1.40 1.40 -0.3% PASS
total/synth/DUP13/d0 1.31 1.07 -18.3% PASS
total/synth/DUP13/d1 1.16 1.40 +20.2% PASS
total/synth/DUP14/d0 1.31 1.31 -0.0% PASS
total/synth/DUP14/d1 1.40 1.40 -0.3% PASS
total/synth/DUP15/d0 1.07 1.15 +7.2% PASS
total/synth/DUP15/d1 1.40 1.40 -0.2% PASS
total/synth/DUP16/d0 1.35 1.33 -1.8% PASS
total/synth/DUP16/d1 1.40 1.40 -0.3% PASS
total/synth/DUP2/d0 1.31 1.22 -6.2% PASS
total/synth/DUP2/d1 1.40 1.40 -0.2% PASS
total/synth/DUP3/d0 1.15 1.39 +21.2% PASS
total/synth/DUP3/d1 1.40 1.16 -17.5% PASS
total/synth/DUP4/d0 1.39 1.31 -5.9% PASS
total/synth/DUP4/d1 1.40 1.16 -17.3% PASS
total/synth/DUP5/d0 1.31 1.31 -0.0% PASS
total/synth/DUP5/d1 1.40 1.40 -0.3% PASS
total/synth/DUP6/d0 1.15 1.15 -0.5% PASS
total/synth/DUP6/d1 1.16 1.16 -0.6% PASS
total/synth/DUP7/d0 1.07 1.31 +22.5% PASS
total/synth/DUP7/d1 1.40 1.40 -0.4% PASS
total/synth/DUP8/d0 1.31 1.31 -0.4% PASS
total/synth/DUP8/d1 1.40 1.40 -0.1% PASS
total/synth/DUP9/d0 1.15 1.31 +13.8% PASS
total/synth/DUP9/d1 1.40 1.40 -0.3% PASS
total/synth/EQ/b0 2.76 2.76 +0.0% PASS
total/synth/EQ/b1 1.35 1.34 -0.9% PASS
total/synth/GAS/a0 3.83 3.83 +0.0% PASS
total/synth/GAS/a1 3.85 3.87 +0.3% PASS
total/synth/GT/b0 2.62 2.61 -0.4% PASS
total/synth/GT/b1 1.57 1.57 -0.4% PASS
total/synth/ISZERO/u0 1.15 1.15 -0.1% PASS
total/synth/JUMPDEST/n0 1.46 1.59 +8.7% PASS
total/synth/LT/b0 2.63 2.62 -0.3% PASS
total/synth/LT/b1 1.57 1.56 -0.2% PASS
total/synth/MSIZE/a0 4.26 4.26 +0.1% PASS
total/synth/MSIZE/a1 4.82 4.82 -0.1% PASS
total/synth/MUL/b0 5.30 5.30 -0.0% PASS
total/synth/MUL/b1 5.39 5.38 -0.2% PASS
total/synth/NOT/u0 1.84 1.83 -0.5% PASS
total/synth/OR/b0 1.65 1.64 -0.3% PASS
total/synth/OR/b1 1.72 1.72 -0.2% PASS
total/synth/PC/a0 3.58 3.58 -0.0% PASS
total/synth/PC/a1 3.60 3.60 +0.0% PASS
total/synth/PUSH1/p0 1.07 1.07 -0.0% PASS
total/synth/PUSH1/p1 1.40 1.39 -0.1% PASS
total/synth/PUSH10/p0 0.99 1.07 +8.3% PASS
total/synth/PUSH10/p1 1.43 1.43 -0.4% PASS
total/synth/PUSH11/p0 1.07 1.15 +7.4% PASS
total/synth/PUSH11/p1 1.42 1.41 -0.6% PASS
total/synth/PUSH12/p0 1.01 1.15 +13.8% PASS
total/synth/PUSH12/p1 1.42 1.39 -2.0% PASS
total/synth/PUSH13/p0 0.91 0.90 -1.1% PASS
total/synth/PUSH13/p1 1.42 1.41 -0.5% PASS
total/synth/PUSH14/p0 1.08 0.93 -14.0% PASS
total/synth/PUSH14/p1 1.42 1.41 -0.5% PASS
total/synth/PUSH15/p0 0.93 0.91 -2.1% PASS
total/synth/PUSH15/p1 1.48 1.50 +1.2% PASS
total/synth/PUSH16/p0 1.15 0.91 -20.7% PASS
total/synth/PUSH16/p1 1.43 1.41 -1.0% PASS
total/synth/PUSH17/p0 1.12 0.91 -18.9% PASS
total/synth/PUSH17/p1 1.42 1.41 -0.6% PASS
total/synth/PUSH18/p0 1.15 1.15 +0.0% PASS
total/synth/PUSH18/p1 1.44 1.41 -1.6% PASS
total/synth/PUSH19/p0 1.07 1.13 +5.7% PASS
total/synth/PUSH19/p1 1.44 1.41 -1.7% PASS
total/synth/PUSH2/p0 0.91 1.15 +26.6% PASS
total/synth/PUSH2/p1 1.40 1.40 -0.1% PASS
total/synth/PUSH20/p0 1.15 1.15 -0.0% PASS
total/synth/PUSH20/p1 1.42 1.43 +1.0% PASS
total/synth/PUSH21/p0 0.91 1.07 +17.6% PASS
total/synth/PUSH21/p1 1.40 1.42 +1.2% PASS
total/synth/PUSH22/p0 1.15 1.15 +0.0% PASS
total/synth/PUSH22/p1 1.42 1.42 -0.4% PASS
total/synth/PUSH23/p0 1.07 1.15 +7.7% PASS
total/synth/PUSH23/p1 1.43 1.45 +1.7% PASS
total/synth/PUSH24/p0 1.15 1.07 -6.9% PASS
total/synth/PUSH24/p1 1.43 1.42 -0.3% PASS
total/synth/PUSH25/p0 1.07 1.11 +4.0% PASS
total/synth/PUSH25/p1 1.41 1.42 +1.1% PASS
total/synth/PUSH26/p0 0.91 0.91 +0.2% PASS
total/synth/PUSH26/p1 1.41 1.44 +1.8% PASS
total/synth/PUSH27/p0 1.15 1.07 -6.7% PASS
total/synth/PUSH27/p1 1.46 1.42 -2.6% PASS
total/synth/PUSH28/p0 0.92 0.91 -0.7% PASS
total/synth/PUSH28/p1 1.44 1.43 -0.8% PASS
total/synth/PUSH29/p0 0.99 0.91 -7.9% PASS
total/synth/PUSH29/p1 1.45 1.46 +0.1% PASS
total/synth/PUSH3/p0 1.15 0.90 -21.2% PASS
total/synth/PUSH3/p1 1.39 1.41 +1.9% PASS
total/synth/PUSH30/p0 1.16 1.17 +0.6% PASS
total/synth/PUSH30/p1 1.43 1.45 +1.3% PASS
total/synth/PUSH31/p0 0.94 1.15 +22.8% PASS
total/synth/PUSH31/p1 1.59 1.60 +0.7% PASS
total/synth/PUSH32/p0 1.15 0.92 -19.4% PASS
total/synth/PUSH32/p1 1.45 1.44 -0.3% PASS
total/synth/PUSH4/p0 0.91 0.91 -0.3% PASS
total/synth/PUSH4/p1 1.42 1.41 -0.5% PASS
total/synth/PUSH5/p0 1.15 1.15 -0.2% PASS
total/synth/PUSH5/p1 1.39 1.41 +1.3% PASS
total/synth/PUSH6/p0 1.15 1.13 -1.6% PASS
total/synth/PUSH6/p1 1.41 1.41 -0.3% PASS
total/synth/PUSH7/p0 1.15 0.91 -20.8% PASS
total/synth/PUSH7/p1 1.43 1.41 -1.3% PASS
total/synth/PUSH8/p0 0.98 1.15 +16.8% PASS
total/synth/PUSH8/p1 1.41 1.44 +1.7% PASS
total/synth/PUSH9/p0 1.15 0.92 -20.2% PASS
total/synth/PUSH9/p1 1.41 1.40 -0.6% PASS
total/synth/RETURNDATASIZE/a0 3.99 3.99 +0.0% PASS
total/synth/RETURNDATASIZE/a1 3.81 4.00 +5.0% PASS
total/synth/SAR/b0 3.79 3.83 +0.9% PASS
total/synth/SAR/b1 4.33 4.31 -0.4% PASS
total/synth/SGT/b0 2.61 2.61 -0.1% PASS
total/synth/SGT/b1 1.57 1.56 -0.2% PASS
total/synth/SHL/b0 3.04 3.06 +0.6% PASS
total/synth/SHL/b1 1.62 1.63 +1.0% PASS
total/synth/SHR/b0 2.94 2.94 -0.2% PASS
total/synth/SHR/b1 1.65 1.63 -1.3% PASS
total/synth/SIGNEXTEND/b0 3.58 3.58 -0.0% PASS
total/synth/SIGNEXTEND/b1 3.74 3.73 -0.1% PASS
total/synth/SLT/b0 2.62 2.61 -0.1% PASS
total/synth/SLT/b1 1.57 1.56 -0.2% PASS
total/synth/SUB/b0 2.00 1.98 -0.8% PASS
total/synth/SUB/b1 1.99 1.98 -0.5% PASS
total/synth/SWAP1/s0 1.49 1.49 +0.0% PASS
total/synth/SWAP10/s0 1.50 1.50 -0.1% PASS
total/synth/SWAP11/s0 1.50 1.50 +0.1% PASS
total/synth/SWAP12/s0 1.50 1.50 -0.0% PASS
total/synth/SWAP13/s0 1.51 1.51 +0.1% PASS
total/synth/SWAP14/s0 1.51 1.51 +0.1% PASS
total/synth/SWAP15/s0 1.51 1.51 -0.1% PASS
total/synth/SWAP16/s0 1.51 1.51 -0.1% PASS
total/synth/SWAP2/s0 1.49 1.49 +0.0% PASS
total/synth/SWAP3/s0 1.49 1.49 +0.1% PASS
total/synth/SWAP4/s0 1.50 1.49 -0.0% PASS
total/synth/SWAP5/s0 1.50 1.50 +0.1% PASS
total/synth/SWAP6/s0 1.50 1.50 +0.0% PASS
total/synth/SWAP7/s0 1.50 1.50 -0.1% PASS
total/synth/SWAP8/s0 1.50 1.50 +0.1% PASS
total/synth/SWAP9/s0 1.50 1.50 -0.0% PASS
total/synth/XOR/b0 1.55 1.55 -0.0% PASS
total/synth/XOR/b1 1.56 1.56 -0.3% PASS
total/synth/loop_v1 4.32 4.43 +2.7% PASS
total/synth/loop_v2 4.44 4.59 +3.3% PASS

Summary: 194 benchmarks, 1 regressions


✅ Performance Check Passed (multipass)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.61 1.56 -3.1% PASS
total/main/blake2b_huff/empty 0.07 0.07 -0.1% PASS
total/main/blake2b_shifts/8415nulls 5.25 5.24 -0.2% PASS
total/main/sha1_divs/5311 1.89 1.89 -0.0% PASS
total/main/sha1_divs/empty 0.03 0.03 -0.2% PASS
total/main/sha1_shifts/5311 2.76 2.76 -0.1% PASS
total/main/sha1_shifts/empty 0.04 0.04 -0.1% PASS
total/main/snailtracer/benchmark 53.14 53.12 -0.0% PASS
total/main/structarray_alloc/nfts_rank 0.29 0.29 -0.5% PASS
total/main/swap_math/insufficient_liquidity 0.02 0.02 -0.3% PASS
total/main/swap_math/received 0.02 0.02 -0.3% PASS
total/main/swap_math/spent 0.02 0.02 -1.8% PASS
total/main/weierstrudel/1 0.38 0.35 -8.9% PASS
total/main/weierstrudel/15 3.23 3.19 -1.2% PASS
total/micro/JUMPDEST_n0/empty 0.13 0.13 -0.5% PASS
total/micro/jump_around/empty 0.63 0.62 -0.5% PASS
total/micro/loop_with_many_jumpdests/empty 1.97 1.95 -0.7% PASS
total/micro/memory_grow_mload/by1 0.20 0.17 -13.0% PASS
total/micro/memory_grow_mload/by16 0.19 0.19 -3.0% PASS
total/micro/memory_grow_mload/by32 0.20 0.20 -0.1% PASS
total/micro/memory_grow_mload/nogrow 0.18 0.18 -1.4% PASS
total/micro/memory_grow_mstore/by1 0.18 0.18 -1.9% PASS
total/micro/memory_grow_mstore/by16 0.19 0.19 -0.5% PASS
total/micro/memory_grow_mstore/by32 0.21 0.21 +0.9% PASS
total/micro/memory_grow_mstore/nogrow 0.20 0.18 -13.4% PASS
total/micro/signextend/one 0.35 0.35 +1.1% PASS
total/micro/signextend/zero 0.35 0.35 +0.0% PASS
total/synth/ADD/b0 0.01 0.01 -0.0% PASS
total/synth/ADD/b1 0.01 0.01 -0.0% PASS
total/synth/ADDRESS/a0 0.16 0.16 +0.4% PASS
total/synth/ADDRESS/a1 0.16 0.16 -0.0% PASS
total/synth/AND/b0 0.01 0.01 -0.1% PASS
total/synth/AND/b1 0.01 0.01 -0.1% PASS
total/synth/BYTE/b0 1.95 1.95 -0.0% PASS
total/synth/BYTE/b1 2.35 2.35 -0.1% PASS
total/synth/CALLDATASIZE/a0 0.08 0.08 -2.6% PASS
total/synth/CALLDATASIZE/a1 0.08 0.08 -3.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.27 0.27 +0.0% PASS
total/synth/CALLVALUE/a1 0.28 0.28 -0.1% PASS
total/synth/CODESIZE/a0 0.08 0.08 -0.0% PASS
total/synth/CODESIZE/a1 0.08 0.08 -0.0% PASS
total/synth/DUP1/d0 0.01 0.01 -0.0% PASS
total/synth/DUP1/d1 0.01 0.01 -0.1% PASS
total/synth/DUP10/d0 0.01 0.01 -0.1% PASS
total/synth/DUP10/d1 0.01 0.01 +0.0% PASS
total/synth/DUP11/d0 0.01 0.01 -0.0% PASS
total/synth/DUP11/d1 0.01 0.01 -0.1% PASS
total/synth/DUP12/d0 0.01 0.01 -0.0% PASS
total/synth/DUP12/d1 0.01 0.01 -0.1% PASS
total/synth/DUP13/d0 0.01 0.01 +0.1% PASS
total/synth/DUP13/d1 0.01 0.01 -0.1% PASS
total/synth/DUP14/d0 0.01 0.01 +0.1% PASS
total/synth/DUP14/d1 0.01 0.01 +0.1% PASS
total/synth/DUP15/d0 0.01 0.01 -0.2% PASS
total/synth/DUP15/d1 0.01 0.01 +0.0% PASS
total/synth/DUP16/d0 0.01 0.01 -0.1% PASS
total/synth/DUP16/d1 0.01 0.01 -0.1% PASS
total/synth/DUP2/d0 0.01 0.01 -0.1% PASS
total/synth/DUP2/d1 0.01 0.01 +0.0% PASS
total/synth/DUP3/d0 0.01 0.01 -0.0% PASS
total/synth/DUP3/d1 0.01 0.01 +0.1% PASS
total/synth/DUP4/d0 0.01 0.01 +0.1% PASS
total/synth/DUP4/d1 0.01 0.01 -0.1% PASS
total/synth/DUP5/d0 0.01 0.01 -0.1% PASS
total/synth/DUP5/d1 0.01 0.01 -0.2% PASS
total/synth/DUP6/d0 0.01 0.01 +0.1% PASS
total/synth/DUP6/d1 0.01 0.01 -0.0% PASS
total/synth/DUP7/d0 0.01 0.01 -0.1% PASS
total/synth/DUP7/d1 0.01 0.01 -0.1% PASS
total/synth/DUP8/d0 0.01 0.01 -0.1% PASS
total/synth/DUP8/d1 0.01 0.01 -0.0% PASS
total/synth/DUP9/d0 0.01 0.01 +0.1% PASS
total/synth/DUP9/d1 0.01 0.01 +0.0% PASS
total/synth/EQ/b0 0.01 0.01 +0.0% PASS
total/synth/EQ/b1 0.01 0.01 +0.1% PASS
total/synth/GAS/a0 0.80 0.80 -0.1% PASS
total/synth/GAS/a1 0.76 0.76 -0.1% PASS
total/synth/GT/b0 0.01 0.01 +0.2% PASS
total/synth/GT/b1 0.01 0.01 -0.1% PASS
total/synth/ISZERO/u0 0.01 0.01 -0.0% PASS
total/synth/JUMPDEST/n0 0.13 0.13 -0.2% PASS
total/synth/LT/b0 0.01 0.01 -0.0% PASS
total/synth/LT/b1 0.01 0.01 -0.0% PASS
total/synth/MSIZE/a0 0.01 0.01 +0.0% PASS
total/synth/MSIZE/a1 0.01 0.01 -0.2% PASS
total/synth/MUL/b0 0.01 0.01 -0.1% PASS
total/synth/MUL/b1 0.01 0.01 +0.0% PASS
total/synth/NOT/u0 0.01 0.01 +0.0% PASS
total/synth/OR/b0 0.01 0.01 +0.0% PASS
total/synth/OR/b1 0.01 0.01 -0.0% PASS
total/synth/PC/a0 0.01 0.01 +0.1% PASS
total/synth/PC/a1 0.01 0.01 +0.1% PASS
total/synth/PUSH1/p0 0.01 0.01 +0.0% PASS
total/synth/PUSH1/p1 0.01 0.01 -0.0% PASS
total/synth/PUSH10/p0 0.01 0.01 +0.0% PASS
total/synth/PUSH10/p1 0.01 0.01 +0.0% PASS
total/synth/PUSH11/p0 0.01 0.01 +0.1% PASS
total/synth/PUSH11/p1 0.01 0.01 +0.0% PASS
total/synth/PUSH12/p0 0.01 0.01 +0.1% PASS
total/synth/PUSH12/p1 0.01 0.01 +0.0% PASS
total/synth/PUSH13/p0 0.01 0.01 -0.1% PASS
total/synth/PUSH13/p1 0.01 0.01 -0.0% PASS
total/synth/PUSH14/p0 0.01 0.01 +0.0% PASS
total/synth/PUSH14/p1 0.01 0.01 +0.1% PASS
total/synth/PUSH15/p0 0.01 0.01 +0.1% PASS
total/synth/PUSH15/p1 0.01 0.01 -0.1% PASS
total/synth/PUSH16/p0 0.01 0.01 -0.1% PASS
total/synth/PUSH16/p1 0.01 0.01 -0.0% PASS
total/synth/PUSH17/p0 0.01 0.01 -0.0% PASS
total/synth/PUSH17/p1 0.01 0.01 -0.0% PASS
total/synth/PUSH18/p0 0.01 0.01 +0.0% PASS
total/synth/PUSH18/p1 0.01 0.01 +0.1% PASS
total/synth/PUSH19/p0 0.01 0.01 -0.1% PASS
total/synth/PUSH19/p1 0.01 0.01 -0.1% PASS
total/synth/PUSH2/p0 0.01 0.01 -0.0% PASS
total/synth/PUSH2/p1 0.01 0.01 -0.1% PASS
total/synth/PUSH20/p0 0.01 0.01 -0.6% PASS
total/synth/PUSH20/p1 0.01 0.01 +0.0% PASS
total/synth/PUSH21/p0 0.01 0.01 -0.1% PASS
total/synth/PUSH21/p1 0.01 0.01 -0.1% PASS
total/synth/PUSH22/p0 1.16 0.85 -26.7% PASS
total/synth/PUSH22/p1 1.47 1.44 -1.7% PASS
total/synth/PUSH23/p0 1.08 1.16 +7.3% PASS
total/synth/PUSH23/p1 1.47 1.49 +1.0% PASS
total/synth/PUSH24/p0 1.00 1.16 +15.7% PASS
total/synth/PUSH24/p1 1.46 1.44 -1.6% PASS
total/synth/PUSH25/p0 1.16 1.16 -0.1% PASS
total/synth/PUSH25/p1 1.48 1.44 -3.2% PASS
total/synth/PUSH26/p0 0.94 0.92 -2.9% PASS
total/synth/PUSH26/p1 1.51 1.44 -4.4% PASS
total/synth/PUSH27/p0 1.16 1.08 -7.0% PASS
total/synth/PUSH27/p1 1.47 1.44 -2.2% PASS
total/synth/PUSH28/p0 1.04 1.10 +5.9% PASS
total/synth/PUSH28/p1 1.49 1.46 -2.4% PASS
total/synth/PUSH29/p0 1.11 1.16 +4.4% PASS
total/synth/PUSH29/p1 1.47 1.47 -0.5% PASS
total/synth/PUSH3/p0 0.01 0.01 -0.0% PASS
total/synth/PUSH3/p1 0.01 0.01 +0.1% PASS
total/synth/PUSH30/p0 1.21 1.16 -3.8% PASS
total/synth/PUSH30/p1 1.48 1.45 -2.2% PASS
total/synth/PUSH31/p0 1.04 1.16 +11.7% PASS
total/synth/PUSH31/p1 1.59 1.52 -4.5% PASS
total/synth/PUSH32/p0 1.08 0.95 -12.3% PASS
total/synth/PUSH32/p1 1.44 1.47 +1.6% PASS
total/synth/PUSH4/p0 0.01 0.01 +0.0% PASS
total/synth/PUSH4/p1 0.01 0.01 -0.1% PASS
total/synth/PUSH5/p0 0.01 0.01 -0.0% PASS
total/synth/PUSH5/p1 0.01 0.01 -0.1% PASS
total/synth/PUSH6/p0 0.01 0.01 +0.1% PASS
total/synth/PUSH6/p1 0.01 0.01 +0.1% PASS
total/synth/PUSH7/p0 0.01 0.01 +0.1% PASS
total/synth/PUSH7/p1 0.01 0.01 -0.2% PASS
total/synth/PUSH8/p0 0.01 0.01 +0.0% PASS
total/synth/PUSH8/p1 0.01 0.01 -0.0% PASS
total/synth/PUSH9/p0 0.01 0.01 -0.0% PASS
total/synth/PUSH9/p1 0.01 0.01 +0.1% PASS
total/synth/RETURNDATASIZE/a0 0.53 0.53 +0.1% PASS
total/synth/RETURNDATASIZE/a1 0.49 0.49 -0.3% PASS
total/synth/SAR/b0 3.80 3.80 -0.2% PASS
total/synth/SAR/b1 4.33 4.35 +0.4% PASS
total/synth/SGT/b0 0.01 0.01 +0.1% PASS
total/synth/SGT/b1 0.01 0.01 -0.0% PASS
total/synth/SHL/b0 3.08 3.05 -0.9% PASS
total/synth/SHL/b1 1.65 1.63 -1.4% PASS
total/synth/SHR/b0 2.94 2.94 -0.0% PASS
total/synth/SHR/b1 1.63 1.64 +0.5% PASS
total/synth/SIGNEXTEND/b0 3.35 3.35 -0.1% PASS
total/synth/SIGNEXTEND/b1 3.50 3.51 +0.4% PASS
total/synth/SLT/b0 0.01 0.01 +0.0% PASS
total/synth/SLT/b1 0.01 0.01 +0.0% PASS
total/synth/SUB/b0 0.01 0.01 +0.4% PASS
total/synth/SUB/b1 0.01 0.01 -0.0% PASS
total/synth/SWAP1/s0 0.01 0.01 +0.1% PASS
total/synth/SWAP10/s0 0.01 0.01 -0.0% PASS
total/synth/SWAP11/s0 0.01 0.01 +0.1% PASS
total/synth/SWAP12/s0 0.01 0.01 -0.0% PASS
total/synth/SWAP13/s0 0.01 0.01 -0.1% PASS
total/synth/SWAP14/s0 0.01 0.01 +0.0% PASS
total/synth/SWAP15/s0 0.01 0.01 +0.0% PASS
total/synth/SWAP16/s0 0.01 0.01 -0.1% PASS
total/synth/SWAP2/s0 0.01 0.01 +0.0% PASS
total/synth/SWAP3/s0 0.01 0.01 -0.1% PASS
total/synth/SWAP4/s0 0.01 0.01 -0.1% PASS
total/synth/SWAP5/s0 0.01 0.01 +0.0% PASS
total/synth/SWAP6/s0 0.01 0.01 -0.1% PASS
total/synth/SWAP7/s0 0.01 0.01 -0.0% PASS
total/synth/SWAP8/s0 0.01 0.01 -0.1% PASS
total/synth/SWAP9/s0 0.01 0.01 +0.1% PASS
total/synth/XOR/b0 0.01 0.01 -0.1% PASS
total/synth/XOR/b1 0.01 0.01 -0.1% PASS
total/synth/loop_v1 1.39 1.39 +0.2% PASS
total/synth/loop_v2 1.32 1.33 +0.9% 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.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With 1 page of memory, the error address MemBase + INT32_MAX (approximately 2GB) generated by the old code occasionally falls into the guard zone, triggering SIGSEGV. This trap occurs both before and after the fix, making it impossible to distinguish whether the bug exists, rendering the test meaningless.

@cmgCr cmgCr force-pushed the cmgCr/fix_issuse422 branch from a1dc451 to de44b1f Compare March 30, 2026 09:08
Offset64 += (uint32_t)Base.getImm();
if (Offset64 > INT32_MAX) {
Offset = INT32_MAX; // invalid addr
BaseReg = Layout.getScopedTemp<AddrType, ScopedTempReg1>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This feature was specifically designed by me for blockchain scenarios. After this processing, enabling CPU exception checking can ensure that the exception address will definitely fall within the set range.
In non-blockchain scenarios, this is indeed inconsistent with standard behavior,
So we can consider using your fixed version when WASI is enabled, otherwise use my previous version.

@zoowii zoowii merged commit 357dcc0 into DTVMStack:main Apr 1, 2026
16 checks passed
@cmgCr cmgCr deleted the cmgCr/fix_issuse422 branch April 2, 2026 02:04
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

3 participants