Incorrect SSA for indirect call to function modifying global state
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
SSA doesn't track global state modification through indirect call. Consider the following two test cases, one performs the correct behavior but the other doesn't. I have attached screenshots of the resulting SSA IR in graph form
## Correct:
```
pragma solidity >=0.4.16 <0.7.0;
contract Contract {
int public a;
function f() public {
e();
a += 1;
}
function e() public {
a -= 1;
}
}
```

## Incorrect:
```
pragma solidity >=0.4.16 <0.7.0;
pragma solidity >=0.4.16 <0.7.0;
contract Contract {
int public a;
function f() public {
g();
a += 1;
}
function e() public {
a -= 1;
}
function g() public {
e();
}
}
```

---
The correct version uses a phi node to track the alteration to global state through the function call. However, when we add one more layer of indirection, it no longer tracks that alteration.
Contributor guide
Assessment
This issue has not been assessed yet.