Unnamed return variable is displayed incorrectly in counter example
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
## Description
When the return value is unnamed, the left side of the equality sign in the counterexample appears empty.
```solidity
contract C {
function f(uint256 value) public payable returns(bool) {
value = value / value;
}
}
```
Compiled with `solc --model-checker-engine all a.sol`:
```
Warning: CHC: Division by zero happens here.
Counterexample:
value = 0
= false // The left side of the equality sign here is empty.
Transaction trace:
C.constructor()
C.f(0){ msg.value: 19 }
--> out.sol:3:13:
|
3 | value = value / value;
| ^^^^^^^^^^^^^
```
## Environment
- Compiler version: 0.8.26
Contributor guide
Research direction
Start by reproducing the issue with `solc --model-checker-engine all a.sol` using the Solidity example in the report, then trace the model-checker counterexample output. Done means the unnamed return value no longer produces an empty left-hand side in the counterexample, with regression coverage for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- blockchain, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100