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

Precondition on return value in modular arithmetic #117

Closed
hajduakos opened this issue Nov 30, 2019 · 1 comment
Closed

Precondition on return value in modular arithmetic #117

hajduakos opened this issue Nov 30, 2019 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@hajduakos
Copy link
Member

In modular arithmetic we add range assumption preconditions for variables appearing in the postcondition. However, we should not do this for the return values because Boogie cannot access them in preconditions:

contract C {
    /// @notice postcondition x == 1
    function f() public pure returns (int x) {
        return 1;
    }
}
$ solc-verify.py Test.sol --arithmetic mod
Error while running verifier, details:
Parsing /tmp/tmp1ijaey2i/Test.sol.bpl
/tmp/tmp1ijaey2i/Test.sol.bpl(16,219): Error: undeclared identifier: x#4
/tmp/tmp1ijaey2i/Test.sol.bpl(16,228): Error: undeclared identifier: x#4
2 name resolution errors detected in /tmp/tmp1ijaey2i/Test.sol.bpl

I think we can just skip these preconditions and instead add them as assumes in the beginning of the function. Or it might even not be needed if return values are properly initialized to default value (see #116).

@hajduakos hajduakos added the bug Something isn't working label Nov 30, 2019
@hajduakos hajduakos self-assigned this Dec 5, 2019
@hajduakos
Copy link
Member Author

Fixed by f8adb1b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant