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: struct variable push() cause false positive #15408

Open
Subway2023 opened this issue Sep 5, 2024 · 1 comment
Open

SMTChecker: struct variable push() cause false positive #15408

Subway2023 opened this issue Sep 5, 2024 · 1 comment

Comments

@Subway2023
Copy link

Environment

  • Compiler version: 0.8.27
  • Target EVM version (as per compiler settings): None
  • Framework/IDE (e.g. Truffle or Remix): None
  • EVM execution environment / backend / blockchain client: None
  • Operating system: Linux

Steps to Reproduce

contract C {
    struct S {
        int a;
        bytes5 b;
    }
    S[] b;
    function f() public {
        b.push(S({a: 1, b: "12345"}));
        S[] storage bStorage = b;
        b.push();
        assert(bStorage[0].a == 1);
    }
}
solc b.sol --model-checker-ext-calls trusted --model-checker-timeout 0 --model-checker-engine chc --model-checker-solvers z3
Warning: CHC: Out of bounds access happens here.
  --> test/b.sol:11:16:
   |
11 |         assert(bStorage[0].a == 1);
   |                ^^^^^^^^^^^

Warning: CHC: Assertion violation happens here.
  --> test/b.sol:11:9:
   |
11 |         assert(bStorage[0].a == 1);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^

If i delete b.push(), there is no false positive

@Stanmar01

This comment was marked as spam.

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

3 participants