argotorg / argotorg/solidity

[SMTChecker] Unreachable code inside a loop with if statement and break statement in its body is not detected

Open
#14,218 1 comment 0 reactions 1 assignee Claimed by @pgebal View on GitHub
bug :bug: low impact should have smt
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Environment

- Compiler version:
commit https://github.com/ethereum/solidity/commit/a1b79de64235f13e6b06e088fe6365c5a12d13d3

## Steps to Reproduce
Use the following standard json settings file:
```
{
"language": "Solidity",
"sources": {
"C.sol": {
"urls": ["./C.sol"]
}
},
"settings": {
"modelChecker": {
"contracts": {
"C.sol": ["C"]
},
"engine": "bmc",
"showUnproved": true,
"solvers": ["z3"],
"targets": ["assert"]
}
}
}
```
to compile the following contract

```solidity
contract C {
function f() public pure {
uint x = 0;
while (x < 3) {
if (x >= 0) {
++x;
break;
}
++x;
}
assert(x == 1);
}
}
```
unreachable code in line 9 is not reported.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.