Incorrect SSA for conditional after previous dominating conditional
Open
bug
ir
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Slither generates incorrect SSA for the following program:
```solidity
pragma solidity >=0.4.16 <0.7.0;
contract Contract {
function f() public returns (int) {
int a = 1;
if (a > 0) {
a = 2;
}
if (a == 3) {
a = 6;
}
return a;
}
}
```
```
f:
a_1(int256) := 1(int256)
TMP_0(bool) = a_1 > 0
CONDITION TMP_0
a_2(int256) := 2(int256)
a_3(int256) := ϕ(['a_2', 'a_1'])
TMP_1(bool) = a_3 == 3
CONDITION TMP_1
a_4(int256) := 6(int256)
a_5(int256) := ϕ(['a_4', 'a_1']) // ERROR
RETURN a_5
```
The ERROR line should be replaced with `a_5(int256) := ϕ(['a_4', 'a_3'])`.
Contributor guide
Assessment
This issue has not been assessed yet.