Skip to content

Strange behaviour of programs with contract #22

@jesper-amilon

Description

@jesper-amilon

This contract verifies as safe, but it seems it should not, since the assertion in main() does not follow from the post-condition for foo(). If you change the contract to "ensures x >= 0", it seems to verify.
int x;
/*@
ensures x > 0;
*/
void foo(){
x =2;
}

void main() {
foo();
assert(x == 2);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions