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

Default values for uninitialized memory struct #102

Closed
hajduakos opened this issue Oct 11, 2019 · 1 comment
Closed

Default values for uninitialized memory struct #102

hajduakos opened this issue Oct 11, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@hajduakos
Copy link
Member

pragma solidity>=0.5.0;

contract Issue102 {
    struct S {
        int x;
        bool b;
    }

    function() external payable {
        S memory s; // Allocate new and set default values
        assert(s.x == 0);
        assert(s.b == false);
    }
}
$ solc-verify.py issues/Issue102.sol --show-warnings
issues/Issue102.sol:10:9: solc-verify warning: Unhandled default value, verification might fail
Issue102::[fallback]: ERROR
 - issues/Issue102.sol:11:9: Assertion might not hold.
 - issues/Issue102.sol:12:9: Assertion might not hold.
Issue102::[implicit_constructor]: OK
Errors were found by the verifier.

(Asserts should hold)

@hajduakos
Copy link
Member Author

Works in af8257d if there is no nesting, closing this issue. See #114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant