Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated error message caused by omitting "--via-ir" #15646

Open
haoyang9804 opened this issue Dec 16, 2024 · 3 comments
Open

Repeated error message caused by omitting "--via-ir" #15646

haoyang9804 opened this issue Dec 16, 2024 · 3 comments
Labels

Comments

@haoyang9804
Copy link
Contributor

Description

The reproducible code (I guess the error is not related to the code but only the compilation flags):

contract contract0 {
  event event1(int32 var2);

  struct struct3 {
    string var4;
  }

  struct struct5 {
    struct3[] array6;
    int32 var8;
  }

  struct3 internal struct_instance9;
  string internal var10;

  constructor(string[2] memory array11) {
    emit contract0.event1(int32(-273486664));
  }

  function func13() internal pure returns (int32 var14, int32 var15) {
    struct5 memory struct_instance22;
    struct_instance22 = struct_instance22;
    struct5 memory struct_instance23;
    struct_instance23 = struct_instance23;
    (struct_instance23.var8) ^ struct_instance22.var8;
    struct5 memory struct_instance24;
    struct_instance24 = struct_instance24;
    struct5 memory struct_instance25;
    struct_instance25 = struct_instance25;
    return (struct_instance24.var8, ~struct_instance25.var8);
  }

  function func16(mapping(int32 => int32) storage mapping17) internal returns (string memory var20, struct5 memory struct_instance21) {
    var20 = var20;
    struct_instance21 = struct_instance21;
    bool var26;
    while ((!var26)) {}
  }
}

contract contract27 {
  error error30(uint128[] array31);

  event event28(contract0.struct5 struct_instance29);

  struct struct33 {
    contract0.struct3 struct_instance34;
    mapping(uint128 => string) mapping35;
  }

  struct struct38 {
    string var39;
    mapping(int32 => struct33) mapping40;
  }

  mapping(int32 => struct33) internal mapping47;
  bool internal var43;

  constructor() {
    contract27.struct38 storage struct_instance46;
    struct_instance46 = struct_instance46;
    var43 ? (mapping47) : struct_instance46.mapping40;
  }

  function func44() internal returns (string memory var45) {
    var45 = var45;
    contract0.struct5 memory struct_instance50;
    struct_instance50 = struct_instance50;
    (struct_instance50.var8)++;
  }
}

The command:

../AFLs/new-solidity/build/solc/solc generated_programs/program_2024-12-16_11:25:29_43.sol --bin-runtime --yul-optimizations amexguhEiFCUrOdI --optimize-yul --optimize --model-checker-ext-calls trusted --model-checker-targets balance --model-checker-invariants reentrancy --model-checker-div-mod-no-slacks --model-checker-bmc-loop-iterations 10 --model-checker-show-proved-safe --model-checker-show-unproved --model-checker-engine bmc

Error message

Error: Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables. When compiling inline assembly: Variable dataEnd is 1 slot(s) too deep inside the stack. Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables.

The Try compiling with --via-ir message is thrown by twice.

Environment

  • Compiler version:0.8.29-develop.2024.11.30+commit.b4ecc58b.Linux.g++
@cameel
Copy link
Member

cameel commented Dec 17, 2024

The Try compiling with --via-ir message is thrown by twice.

Regarding this bit, this is caused by AsmCodeGen always prepending a canned message when reporting StackTooDeep errors from the lower layer, regardless of what that intercepted message says:

if (!transform.stackErrors().empty())
assertThrow(
false,
langutil::StackTooDeepError,
util::stackTooDeepString + " When compiling inline assembly" +
(transform.stackErrors().front().comment() ? ": " + *transform.stackErrors().front().comment() : ".")
);

We should perhaps remove that bit from that lower layer message, after making sure that it always gets intercepted.

@z3r086

This comment was marked as spam.

1 similar comment
@z3r086

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@cameel @haoyang9804 @z3r086 and others