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

Yul compilation failed: ParserError: Switch statement without any cases. #219

Closed
agroce opened this issue Jan 31, 2021 · 1 comment
Closed

Comments

@agroce
Copy link

agroce commented Jan 31, 2021

Compiling this file:

contract Foo:
    my_u128: u128
thread 'main' panicked at 'Yul compilation failed: {"errors":[{"component":"general","formattedMessage":"ParserError: Switch statement without any cases.\n --> input.yul:1:3990:\n  |\n1 |  ... ta_size)) } } switch cloadn(0, 4)  }   }  }\n  |                                         ^\n\n","message":"Switch statement without any cases.","severity":"error","sourceLocation":{"end":3990,"file":"input.yul","start":3989},"type":"ParserError"},{"component":"general","formattedMessage":"ParserError: Expected end of source but got '}'\n --> input.yul:1:3997:\n  |\n1 |  ... )) } } switch cloadn(0, 4)  }   }  }\n  |                                         ^\n\n","message":"Expected end of source but got '}'","severity":"error","sourceLocation":{"end":3997,"file":"input.yul","start":3996},"type":"ParserError"}]}', compiler/src/lib.rs:45:27
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c0b64d97beebb09325b5587abed39f4f1621026f/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/c0b64d97beebb09325b5587abed39f4f1621026f/library/std/src/panicking.rs:435:5
   2: fe_compiler::compile
   3: fe::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Aborted

On latest github master, built with

[profile.dev]
debug = true
panic = "abort"

for fuzzing. Using https://github.com/agroce/afl-compiler-fuzzer (we've found more than 50 bugs (that were worth fixing, and have been fixed) in solc using this afl variant) + afl.rs.

The PR works nicely!

@cburgdorf
Copy link
Collaborator

Ah yeah, that's a good one. I ran into it manually recently. Contracts without any methods trigger that error.

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

No branches or pull requests

2 participants