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

SMTChecker: Unable to correctly determine the result of function pointer comparison #15011

Closed
Subway2023 opened this issue Apr 12, 2024 · 1 comment
Labels

Comments

@Subway2023
Copy link

Description

When comparing two internal functions, the SMTChecker is unable to determine the comparison result correctly.

Environment

  • Compiler version: 0.8.25
  • Target EVM version (as per compiler settings): No restrictions
  • Framework/IDE (e.g. Truffle or Remix): Remix and Command-line
  • EVM execution environment / backend / blockchain client: None
  • Operating system: Linux

Steps to Reproduce

contract C {
    function f() internal {}
    function g() internal {}

    function test() public {
        assert(C.f != C.g);
    }
}

Remix

Execute normally, no revert

SMTChecker

solc C.sol --model-checker-engine all

1712924682657

@blishko
Copy link
Contributor

blishko commented Apr 25, 2024

Function pointers are not supported in SMTChecker and it issues a warning about that on this example:
Warning: SMTChecker: 1 unsupported language feature(s). Enable the model checker option "show unsupported" to see all of them.

Moreover, the compiler also issues a warning that comparison of internal function pointers will be disallowed in the next breaking release:
Warning: Comparison of internal function pointers can yield unexpected results in the legacy pipeline with the optimizer enabled, and will be disallowed entirely in the next breaking release.

Since SMTChecker over-approximates in the presence of unsupported features, the assertion violation warning is to be expected.

@blishko blishko closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
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

3 participants