Skip to content

[ICE] Returning large nested arrays causes StackTooDeep error in Yul backend #1134

@Subway2023

Description

@Subway2023

Fe version: 0.26.0
Description: When returning a large nested array (e.g., Array<Array<u256, 100>, 100>), the Fe compiler crashes with a Yul StackTooDeepError.

contract C {
  pub fn get(self) -> Array<Array<u256, 100>, 100> {
      let arr: Array<Array<u256, 100>, 100> = [[0; 100]; 100]
      return arr
  }
}
Error: Internal exception in StandardCompiler::compile: /solidity/libyul/backends/evm/EVMObjectCompiler.cpp(107): Throw in function void solidity::yul::EVMObjectCompiler::run(solidity::yul::Object&, bool)
Dynamic exception type: boost::wrapexcept<solidity::yul::StackTooDeepError>
std::exception::what: Cannot swap Variable $arg96 with Variable $ptr: too deep in the stack by 81 slots in [ RET $arg99 $arg98 $arg97 $arg96 $arg95 $arg94 $arg93 $arg92 $arg91 $arg90 $arg89 $arg88 $arg87 $arg86 $arg85 $arg84 $arg83 $arg82 $arg81 $arg80 $arg79 $arg78 $arg77 $arg76 $arg75 $arg74 $arg73 $arg72 $arg71 $arg70 $arg69 $arg68 $arg67 $arg66 $arg65 $arg64 $arg63 $arg62 $arg61 $arg60 $arg59 $arg58 $arg57 $arg56 $arg55 $arg54 $arg53 $arg52 $arg51 $arg50 $arg49 $arg48 $arg47 $arg46 $arg45 $arg44 $arg43 $arg42 $arg41 $arg40 $arg39 $arg38 $arg37 $arg36 $arg35 $arg34 $arg33 $arg32 $arg31 $arg30 $arg29 $arg28 $arg27 $arg26 $arg25 $arg24 $arg23 $arg22 $arg21 $arg20 $arg19 $arg18 $arg17 $arg16 $arg15 $arg14 $arg13 $arg12 $arg11 $arg10 $arg9 $arg8 $arg7 $arg6 $arg5 $arg4 $arg3 $arg2 $arg1 $arg0 $ptr ]
No memoryguard was present. Consider using memory-safe assembly only and annotating it via 'assembly ("memory-safe") { ... }'.
[solidity::util::tag_comment*] = Cannot swap Variable $arg96 with Variable $ptr: too deep in the stack by 81 slots in [ RET $arg99 $arg98 $arg97 $arg96 $arg95 $arg94 $arg93 $arg92 $arg91 $arg90 $arg89 $arg88 $arg87 $arg86 $arg85 $arg84 $arg83 $arg82 $arg81 $arg80 $arg79 $arg78 $arg77 $arg76 $arg75 $arg74 $arg73 $arg72 $arg71 $arg70 $arg69 $arg68 $arg67 $arg66 $arg65 $arg64 $arg63 $arg62 $arg61 $arg60 $arg59 $arg58 $arg57 $arg56 $arg55 $arg54 $arg53 $arg52 $arg51 $arg50 $arg49 $arg48 $arg47 $arg46 $arg45 $arg44 $arg43 $arg42 $arg41 $arg40 $arg39 $arg38 $arg37 $arg36 $arg35 $arg34 $arg33 $arg32 $arg31 $arg30 $arg29 $arg28 $arg27 $arg26 $arg25 $arg24 $arg23 $arg22 $arg21 $arg20 $arg19 $arg18 $arg17 $arg16 $arg15 $arg14 $arg13 $arg12 $arg11 $arg10 $arg9 $arg8 $arg7 $arg6 $arg5 $arg4 $arg3 $arg2 $arg1 $arg0 $ptr ]
No memoryguard was present. Consider using memory-safe assembly only and annotating it via 'assembly ("memory-safe") { ... }'.

thread 'main' panicked at crates/driver/src/lib.rs:356:13:
Yul compilation failed with the above errors
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

You've hit an internal compiler error. This is a bug in the Fe compiler.
Fe is still under heavy development, and isn't yet ready for production use.

If you would, please report this bug at the following URL:
  https://github.com/ethereum/fe/issues/new

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions