argotorg / argotorg/solidity

[Yul -> EVM code transform] ICE due to stack underflow

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

Description

```
contract C {
function f0(int8 i0) external {
assembly
{
{
// Dummy function with 19 input parameters and 17 output parameters
function af0(ai0, ai1, ai2, ai3, ai4, ai5, ai6, ai7, ai8, ai9, ai10, a1, ai12, ai13, ai14, ai15, ai16, ai17, ai18) -> ao0, ao1, ao2, ao3, ao4, ao5, ao6, ao7, ao8, ao9, ao10, ao11, ao12, ao13, ao14, ao15, ao16
{
}
}
i0 := 1
}
}
}
```

throws

https://github.com/ethereum/solidity/blob/80d49f37028b13e162951b6b67b0a42f477ba93c/libevmasm/Assembly.cpp#L53

Repro

```
$ solc --optimize --asm test.sol
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with `solc --optimize --asm test.sol` using the Solidity/Yul example in the issue. Start at `libevmasm/Assembly.cpp` near line 53 and trace the stack handling during the Yul-to-EVM transform. Done means this input compiles without the stack-underflow ICE and the existing behavior remains valid.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.