argotorg / argotorg/solidity

Uncaught exception: YUL StackLimitEvader optimizer

Open
#14,174 3 comments 0 reactions 0 assignees View on GitHub
bug :bug: low impact medium effort should report better error
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

## Description

The .yul snippet below

```
{
let _1 := memoryguard(1111111111111111111111100)
mstore(0x40, _1)
mstore8(add(_1, 31), 200)
mstore(_1, 300)
return(_1, add(_1, 100))
}
```

produces:

```
Uncaught exception:
/solidity/libyul/optimiser/StackLimitEvader.cpp(183): Throw in function static void solidity::yul::StackLimitEvader::run(solidity::yul::OptimiserStepContext&, solidity::yul::Object&, const std::map >&)
Dynamic exception type: boost::wrapexcept
std::exception::what: Yul assertion failed
[solidity::util::tag_comment*] = Yul assertion failed
```
when compiled with

`solc --strict-assembly --optimize test.yul`

## Environment

- Compiler version: all versions since 0.8.7+commit.e28d00a7
- Target EVM version (as per compiler settings): N/A
- Framework/IDE (e.g. Truffle or Remix): N/A
- EVM execution environment / backend / blockchain client: N/A
- Operating system: Ubuntu 22.04, Windows 11

## Steps to Reproduce

Description is self-sufficient

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with `solc --strict-assembly --optimize test.yul` using the provided snippet, then inspect `solidity/libyul/optimiser/StackLimitEvader.cpp` around line 183. Done means the snippet compiles without the uncaught Yul assertion across the affected compiler versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.