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 treats unimplemented syntax as unreachable code leading to a crash #1698

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

Comments

@lum7na
Copy link

lum7na commented Jan 20, 2025

When including selfdestruct IR, solang does not generate a "not implemented" error, but instead produces other errors. It seems to treat the "not implemented" case as an "entered unreachable code".

solang compile a.sol --target solana

contract Test {
  function test(int a, uint b, uint c) public returns(int) {
    if (c < 45) {
      b = 1;
    } else if (c >= 45 && c < 64) {
      b = 1;
    } else if (c >= 64 && c < 85) {
      assembly  {
        {
          selfdestruct(true)
        }
      }
      b = 1;
    }
    return 0;
  }
}
thread 'main' panicked at src/emit/expression.rs:2415:14:
internal error: entered unreachable code
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