ICE: Variable slot is too deep inside stack
- Dominant language
- Rust
- Stars
- 1.7k
- Forks
- 218
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
### What is wrong?
Please include information like:
* full output of the error you received
```
Error: Internal exception in StandardCompiler::compile: /solidity/libyul/backends/evm/EVMObjectCompiler.cpp(67): Throw in function void solidity::yul::EVMObjectCompiler::run(solidity::yul::Object&, bool)
Dynamic exception type: boost::wrapexcept
std::exception::what: Variable return_val is 1 slot(s) too deep inside the stack.
[solidity::util::tag_comment*] = Variable return_val is 1 slot(s) too deep inside the stack.
thread 'main' panicked at 'Yul compilation failed with the above errors', crates/driver/src/lib.rs:90:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
* what command you ran
```
cargo run --features solc-backend -- --optimize false foo.fe
```
* the code that caused the failure (see [this link](https://help.github.com/articles/basic-writing-and-formatting-syntax/) for help with formatting code)
```
contract TooManyVariables:
pub fn foo(self):
let x0: i32 = 1
let x1: i32 = 1
let x2: i32 = 1
let x3: i32 = 1
let x4: i32 = 1
let x5: i32 = 1
let x6: i32 = 1
let x7: i32 = 1
let x8: i32 = 1
let x9: i32 = 1
let x10: i32 = 1
let x11: i32 = 1
let x12: i32 = 1
let x13: i32 = 1
let x14: i32 = 1
let x15: i32 = 1
```
### How can it be fixed
Ref: https://github.com/ethereum/solidity/issues/5766
I don't have any idea to fix the issue other than implementing the `spill` concept used in register allocation, though I feel implementing it is far beyond the scope of the `Fe`. But at least, it would be better to report this error to users instead of panicking.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with `cargo run --features solc-backend -- --optimize false foo.fe`, then inspect `crates/driver/src/lib.rs:90` and the reported `EVMObjectCompiler.cpp(67)` failure path. Done means this StackTooDeepError is reported to the user as a compiler error rather than causing a panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, 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