Skip to content

fix(llvm): keep the panics of div, mod and constant indexing - #825

Merged
hedgar2017 merged 1 commit into
mainfrom
fix-op-lowering-checks
Nov 5, 2026
Merged

hedgar2017 merged 1 commit into
mainfrom
fix-op-lowering-checks

Conversation

@hedgar2017

Copy link
Copy Markdown
Contributor

Bumps solx-llvm to NomicFoundation/solx-llvm#192, which restores three checks legacy solc performs:

  • an unused a % b or unchecked a / b panics 0x12 on a zero divisor
  • b[uint8(i)] on fixed bytes checks the cleaned index
  • a constant index past the end of a fixed-size array panics 0x32 in storage, memory and calldata

Copilot AI left a comment

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.

🔵 Needs a closer look

The external LLVM backend revision containing the implementation requires final human review.

0 open findings

What changed in this PR

Adds regression coverage for legacy solc panic semantics restored by the LLVM backend update.

Changes:

  • Tests zero-divisor panics for discarded modulo and unchecked division.
  • Tests cleaned fixed-bytes indices.
  • Tests constant out-of-bounds array access across storage, memory, and calldata.
File Description
tests/​solidity/​simple/​operator/​casting/​fixed_bytes_index_not_cleaned.sol Covers fixed-bytes index cleanup.
tests/​solidity/​simple/​operator/​arithmetic/​unused_division_by_zero.sol Covers retained zero-divisor panics.
tests/​solidity/​simple/​array/​fixed_constant_index_out_of_bounds.sol Covers fixed-array bounds panics.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Coverage Summary

Crate Line Coverage Function Coverage
solx 🟢 83.8% 🔴 20.0%
solx-benchmark-converter 🔴 0.0% 🔴 0.0%
solx-codegen-evm 🟡 56.6% 🟡 51.5%
solx-compiler-downloader 🔴 0.0% 🔴 0.0%
solx-core 🔴 47.2% 🟡 58.8%
solx-dev 🔴 2.2% 🔴 2.1%
solx-mlir 🔴 49.3% 🔴 48.2%
solx-slang 🔴 30.4% 🔴 34.7%
solx-solc-test-adapter 🔴 1.7% 🔴 2.1%
solx-standard-json 🔴 38.8% 🔴 42.5%
solx-tester 🔴 36.6% 🔴 34.6%
solx-utils 🔴 44.7% 🔴 45.2%
Total 🔴 13.2% 🔴 16.5%

Codecov Report | HTML Report | Workflow Run

@hedgar2017
hedgar2017 requested review from a team October 14, 2026 12:16
nebasuke added a commit that referenced this pull request Oct 21, 2026
slang fails `test_RevertIf_ModError` because an unused `100 % a`
loses its division-by-zero panic once optimized, which makes the
Foundry step fail on a candidate-over-reference mismatch.
#825 restores the panic; until then forge skips
the test for both compilers, so the rest of the job can go green.
@hedgar2017
hedgar2017 force-pushed the fix-op-lowering-checks branch from 7c2327c to f66d1dd Compare November 5, 2026 14:17
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Compile-time benchmark (--standard-json)

pr: slang v0.2.0, LLVM-based Solidity compiler for the EVM, Front end: Slang, LLVM build: aa85cc01f794bafd0e17846f9914bde8fb16b0e0
main: slang v0.2.0, LLVM-based Solidity compiler for the EVM, Front end: Slang, LLVM build: a14e23763f5fe90d896c27c422478dedd046b94a
prerelease: slang v0.2.0, LLVM-based Solidity compiler for the EVM, Front end: Slang, LLVM build: 716613b727e0de5b086556ca69b475aa3e496c06
runner: solx-bench-ams-1
commits: pr cc633ec1 merged into main, main 2bf6cd1a

ens-verifiable-factory-solx--solx-legacy-dwarf

binary median mean ± σ min … max vs baseline
pr 0.263 s 0.263 s ± 0.006 s 0.255 s … 0.274 s 1.005×
main 0.262 s 0.261 s ± 0.004 s 0.253 s … 0.265 s 1.000×
prerelease 0.501 s 0.501 s ± 0.006 s 0.491 s … 0.511 s 1.916×

openzeppelin-contracts-0.34--solx-legacy-dwarf

binary median mean ± σ min … max vs baseline
pr 1.970 s 1.968 s ± 0.005 s 1.960 s … 1.975 s 1.001×
main 1.967 s 1.967 s ± 0.003 s 1.963 s … 1.974 s 1.000×
prerelease 3.201 s 3.200 s ± 0.013 s 3.175 s … 3.221 s 1.627×

uniswap-v4-core-solx--solx-legacy-dwarf

binary median mean ± σ min … max vs baseline
pr 0.804 s 0.811 s ± 0.014 s 0.798 s … 0.841 s 0.994×
main 0.809 s 0.812 s ± 0.014 s 0.792 s … 0.842 s 1.000×
prerelease 2.086 s 2.101 s ± 0.027 s 2.074 s … 2.140 s 2.577×

@hedgar2017
hedgar2017 force-pushed the fix-op-lowering-checks branch from f66d1dd to f3c4e6b Compare November 5, 2026 19:21
@hedgar2017
hedgar2017 force-pushed the fix-op-lowering-checks branch from f3c4e6b to cc633ec Compare November 5, 2026 20:17
@hedgar2017
hedgar2017 enabled auto-merge November 5, 2026 20:19
@hedgar2017
hedgar2017 added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit c46d2a9 Nov 5, 2026
49 checks passed
@hedgar2017
hedgar2017 deleted the fix-op-lowering-checks branch November 5, 2026 22:21
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.

3 participants