IR-based Codegen fails to generate bin at version of 0820
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
## Description
When I want to reproduce this bug [AbiReencodingHeadOverflowWithStaticArrayCleanup](https://github.com/ethereum/solidity/blob/develop/docs/bugs.json#L53), I find that IR-based Codegen fails to generate bin under version of 0821. However, if I use solc-0821, IR-based Codegen success.
## Environment
- Compiler version: 0.8.20
- Target EVM version (as per compiler settings): No restrictions
- Framework/IDE (e.g. Truffle or Remix): Command-line
- EVM execution environment / backend / blockchain client: None
- Operating system: Linux
## Steps to Reproduce
```solidity
contract Bug {
function f(uint[2] calldata b) pure public returns (bytes memory){
return abi.encode("aaaa", b);
}
}
contract Executor {
function run() external returns(string memory){
Bug bug = new Bug();
bytes memory r = bug.f([uint(1), 2]);
(string memory a, uint[2] memory b) = abi.decode(r, (string, uint[2]));
return a;
}
}
```
```bash
solc-0820 --via-ir --bin-runtime test.sol
```

If I remove **--bin-runtime,** test.sol can be compiled successfully.
Contributor guide
Research direction
Reproduce the failure with the provided Solidity contracts using `solc-0820 --via-ir --bin-runtime test.sol`, then compare the result with solc-0.8.21 and without `--bin-runtime`. Trace the IR-based code-generation path for this ABI encoding and decoding case; done means 0.8.20 generates runtime bytecode successfully and the regression is covered by an appropriate compiler 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