argotorg / argotorg/solidity

[Codegen] Self imported code compiled via legacy results in EVMC_STACK_OVERFLOW whereas via-ir results in a panic (underflow)

Open
#13,839 2 comments 0 reactions 0 assignees View on GitHub
bug :bug: low impact
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

```
==== Source: s1.sol ====
import {f as g, g as h} from "s1.sol";
function f() pure returns (uint) { return 100 + h() - g(); }
==== Source: s2.sol ====
import {f as h} from "s1.sol";
function f() pure returns (uint) { return 2; }
function g() pure returns (uint) { return 4; }
==== Source: s3.sol ====
import "s2.sol";
contract C {
function foo() public pure returns (uint) {
return f() - g() - h();
}
}
// ----
// foo() -> FAILURE
```

To reproduce, copy the test file in `test/libsolidity/semanticTests/test.sol` and run

```
$ isoltest --show-messages semanticTests/test
```

Contributor guide

Open the contributing guide

Research direction

Copy the reproducer into test/libsolidity/semanticTests/test.sol and run `isoltest --show-messages semanticTests/test`. Compare the legacy and via-ir code-generation paths for the self-imported functions, then verify the regression no longer produces EVMC_STACK_OVERFLOW or a panic from underflow in either mode.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.