Abicode v1 causes inconsistent memory allocation
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
## Description
## Environment
- Compiler version: 0.8.25
- Target EVM version (as per compiler settings): None
- Framework/IDE (e.g. Truffle or Remix): None
- EVM execution environment / backend / blockchain client: Command line
- Operating system: Linux
## Steps to Reproduce
## ABICoder V1
```solidity
pragma abicoder v1;
contract C0{
function f0() external pure returns (uint[2] memory) {}
}
contract Test {
function test() public returns (uint) {
C0 c0 = new C0();
c0.f0();
uint freeMemoryAfter;
assembly {
freeMemoryAfter := mload(0x40)
}
return freeMemoryAfter;
}
}
```
freeMemoryAfter=0xc0
## ABICoder V2
```solidity
contract C0{
function f0() external pure returns (uint[2] memory) {}
}
contract Test {
function test() public returns (uint) {
C0 c0 = new C0();
c0.f0();
uint freeMemoryAfter;
assembly {
freeMemoryAfter := mload(0x40)
}
return freeMemoryAfter;
}
}
```
freeMemoryAfter=0x100
Contributor guide
Research direction
Start by reproducing the two command-line compiler cases with Solidity compiler version 0.8.25 on Linux, using the snippets and comparing the reported freeMemoryAfter values. Trace the ABICoder V1 and V2 paths involved in the external call, and consider the issue resolved when the memory allocation behavior is consistent or its intended difference is established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- blockchain, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100