argotorg / argotorg/solidity

IR-based Codegen fails to compile at version of 0.8.13

Open
#15,045 0 comments 0 reactions 0 assignees View on GitHub
bug :bug: documentation :book: low effort low impact
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Description

When I try to reproduce this bug [DataLocationChangeInInternalOverride](https://soliditylang.org/blog/2022/05/17/data-location-inheritance-bug/) I find that IR-based Codegen fails to compile at version of 0.8.13.
## Environment

- Compiler version: 0.8.13
- 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
abstract contract I {
// The base contract uses "calldata"
function f(uint[] calldata x) virtual internal;
}
contract C is I {
// The derived contract uses "memory" and the compiler
// does not complain - this is the bug in the compiler.
function f(uint[] memory x) override internal {
// If you use `x`, it will access memory
// even if `D.g` passed us a calldata pointer.
// This leads to the wrong data being accessed.
}
}
abstract contract D is I {
function g(uint[] calldata x) external {
// Since D only "knows" `I`, the signature of `f`
// uses calldata, while the virtual lookup ends
// up with `C.f`, which uses memory. This results
// in the calldata pointer `x` being passed and
// interpreted as a memory pointer.
f(x);
}
}
contract X is C, D { }
```
```
solc-0813 test.sol --via-ir
```
1713706385207

Contributor guide

Open the contributing guide

Research direction

Start by running `solc-0813 test.sol --via-ir` with the Solidity snippet in the issue and inspect the failure. Trace the IR-based compiler path for internal overrides with differing calldata and memory locations, then add a regression case showing that the example compiles correctly and preserves the intended data access semantics.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.