Rules › Solidity

Compiler older than 0.8 (no overflow checks)

mediumSolidityRule sol-old-compiler

Before Solidity 0.8, arithmetic wraps silently unless every operation uses SafeMath.

Why it matters

Solidity 0.8 made arithmetic overflow and underflow revert by default. Code compiled with 0.7 or earlier wraps silently unless every operation goes through SafeMath, and older compilers also carry known code-generation bugs. Moving to a current 0.8.x release is usually straightforward and removes a whole class of bugs.

Vulnerable

pragma solidity 0.7.6;

function add(uint256 a, uint256 b) internal pure returns (uint256) {
    return a + b; // wraps on overflow
}

Fixed

pragma solidity 0.8.28;

function add(uint256 a, uint256 b) internal pure returns (uint256) {
    return a + b; // reverts on overflow
}

What other tools call it

ToolDetector or reference
Slithersolc-version
Solhintcompiler-version
SWC registrySWC-101, SWC-102

Check your code

Paste a contract into the in-browser checker, or let the Claude Code plugin scan before every deploy. The quick check for this rule is a pattern match: treat a hit as "look here", and a miss as no guarantee.

Static analysis finds known bug classes; it can't prove code is safe and isn't an audit. Get a professional audit before deploying code that will hold value.