-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from ManuelLerchner/precission
added regression test for precission usage
- Loading branch information
Showing
3 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// PARAM: --enable ana.int.bitfield --enable annotation.int.enabled | ||
#include <goblint.h> | ||
|
||
#define ANY_ERROR 5 // 0b0101 | ||
void example1(void) __attribute__((goblint_precision("no-bitfield"))); | ||
void example2(void) __attribute__((goblint_precision("bitfield"))); | ||
|
||
int main() { | ||
example1(); | ||
example2(); | ||
} | ||
|
||
void example1(){ | ||
int state; | ||
int r = rand() % 3; | ||
switch (r) { | ||
case 0: | ||
state = 0; /* 0b0000 */ | ||
break; | ||
case 1: | ||
state = 8; /* 0b1000 */ | ||
break; | ||
default: | ||
state = 10; /* 0b1010 */ | ||
break; | ||
} | ||
|
||
__goblint_check((state & ANY_ERROR) == 0); //UNKNOWN | ||
} | ||
|
||
void example2(){ | ||
int state; | ||
int r = rand() % 3; | ||
switch (r) { | ||
case 0: | ||
state = 0; /* 0b0000 */ | ||
break; | ||
case 1: | ||
state = 8; /* 0b1000 */ | ||
break; | ||
default: | ||
state = 10; /* 0b1010 */ | ||
break; | ||
} | ||
|
||
__goblint_check((state & ANY_ERROR) == 0); //SUCCESS | ||
} |