sstore and push in IR-base codegen cause bytes variable difference
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
## Description
After assigning and pushing to a bytes variable, the results of this variable differ between the code generated by legacy codegen and IR-based codegen.
## Environment
- Compiler version: 0.8.26
- Target EVM version (as per compiler settings): None
- Framework/IDE (e.g. Truffle or Remix): Remix
- EVM execution environment / backend / blockchain client: None
- Operating system: None
## Steps to Reproduce
```solidity
contract D {
bytes otherData;
function fromMemoryAndStorage() public{
assembly { sstore(otherData.slot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) }
otherData.push();
}
}
```
### Legacy Codegen
storage:
```
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02
```
### IR-based Codegen
storage:
```
0xff00000000000000000000000000000000000000000000000000000000000002
```
The IR-based codegen incorrectly cleared the value in the bytes variable.
Contributor guide
Research direction
Start by reproducing the contract in the issue with compiler 0.8.26, comparing legacy and IR-based codegen storage results after sstore and bytes.push(). Trace the codegen path responsible for the bytes variable update; done when both codegen modes preserve the same storage value and the regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100