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

Solang crashes when Yul functions are nested multiple levels deep. #1700

Open
lum7na opened this issue Jan 20, 2025 · 0 comments
Open

Solang crashes when Yul functions are nested multiple levels deep. #1700

lum7na opened this issue Jan 20, 2025 · 0 comments

Comments

@lum7na
Copy link

lum7na commented Jan 20, 2025

Compile: solang compile a.sol --target solana

contract Test {
  function test1(uint256 _value) private returns(uint256 result) {
    assembly  {
      {
        function f1()
        {
          {
            function f2()
            {
              function f3()
              {
                leave
                function f4()
                {
                  
                }
              }
              leave
            }
          }
          if 0x80000 { leave }
          leave
          f1()
        }
      }
    }
  }

  function test2(uint256 layout) public returns(uint8) {
    assembly  {
      {
        function f() -> v
        { }
        switch f()
        case 1 { }
        case 2 { }
        default { }
      }
    }
    return 0;
  }

}

Output:

thread 'main' panicked at src/codegen/solana_accounts/account_collection.rs:224:29:
index out of bounds: the len is 4 but the index is 4
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant