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

ICE in UserDefinedValueType::underlyingType() when the the type is used before it is declared #12159

Closed
agroce opened this issue Oct 18, 2021 · 3 comments · Fixed by #12186
Closed
Assignees
Labels
bug 🐛 should compile without error Error is reported even though it shouldn't. Source is fine.

Comments

@agroce
Copy link

agroce commented Oct 18, 2021

Description

This contract:

contract C {
    Left[] pu1;
}
type Left is bytes2;
contract C {
}

produces:

Internal compiler error:
/solidity/libsolidity/ast/Types.cpp(2539): Throw in function const solidity::frontend::Type &solidity::frontend::UserDefinedValueType::underlyingType() const
Dynamic exception type: boost::wrapexcept<solidity::langutil::InternalCompilerError>
std::exception::what: Solidity assertion failed
[solidity::util::tag_comment*] = Solidity assertion failed

when compiled with solc

On master, using AFL fuzzing. Another discovery using https://github.com/agroce/afl-compiler-fuzzer

Environment

  • Compiler version: 0.8.10-develop.2021.10.14+commit.1e630fc5.Linux.clang
  • Target EVM version (as per compiler settings): N/A
  • Framework/IDE (e.g. Truffle or Remix): N/A
  • EVM execution environment / backend / blockchain client: N/A
  • Operating system: Ubuntu 20.04 in docker

Steps to Reproduce

Above shows pretty clearly, I think.

@agroce
Copy link
Author

agroce commented Oct 18, 2021

Fails on 0.8.10-develop.2021.10.18+commit.f50dcd45.Linux.clang too

@bshastry
Copy link
Contributor

Thank you for reporting the issue! Smaller repro

contract C {
    Left[] pu1;
}
type Left is bytes2;

@bshastry bshastry added the should compile without error Error is reported even though it shouldn't. Source is fine. label Oct 19, 2021
@agroce
Copy link
Author

agroce commented Oct 19, 2021

BTW, either solc is getting less buggy over time, or is being fuzzed pretty aggressively; my fuzzer instances don't come up with anything new very often now, though there is a minor sticking point that they report many instances of crashes due to FixedPointType not implemented. or solfuzzer hitting a stack limit in json parsing.

@cameel cameel changed the title ICE in const solidity::frontend::Type &solidity::frontend::UserDefinedValueType::underlyingType() const ICE in UserDefinedValueType::underlyingType() when the the type is used before it is declared Oct 24, 2021
@Marenz Marenz assigned Marenz and hrkrshnn and unassigned Marenz Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 should compile without error Error is reported even though it shouldn't. Source is fine.
Projects
None yet
4 participants