This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct container { | |
| int counter; | |
| }; | |
| /*@ requires \valid(some_container); | |
| requires some_container->counter == 0; | |
| ensures \result->counter == \at(\result->counter, Pre) + 1; | |
| */ | |
| struct container * f(struct container * some_container) { | |
| some_container->counter = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define INT_MAX 2147483647 | |
| typedef struct { | |
| int counter; | |
| } atomic_t; | |
| /*@ requires v.counter < INT_MAX; | |
| ensures v.counter == \old(v.counter) + 1; | |
| */ | |
| static inline void atomic_inc(atomic_t v); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typedef struct { | |
| int counter; | |
| } atomic_t; | |
| /*@ ensures v.counter == \old(v.counter) + 1; | |
| */ | |
| static inline void atomic_inc(atomic_t v); | |
| /*@ assigns \nothing; | |
| ensures 1 == 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int a; | |
| int b; | |
| /*@ behavior ChangeA: | |
| assumes argument == 0; | |
| assigns a; | |
| behavior ChangeB: | |
| assumes argument == 1; | |
| assigns b; | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int a; | |
| int b; | |
| /*@ assigns argument == 0 ? a : b; | |
| */ | |
| void f(int argument) | |
| { | |
| if (argument == 0) | |
| { | |
| a = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int a; | |
| int b; | |
| void child(int child_argument); | |
| /*@ requires parent_argument == 0; | |
| assigns a; | |
| */ | |
| void parent(int parent_argument) | |
| { | |
| child(parent_argument); |