-
Notifications
You must be signed in to change notification settings - Fork 77
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 #1468 from goblint/issue_1467
Make meet in AddressDomain more precise
- Loading branch information
Showing
4 changed files
with
96 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
31 changes: 31 additions & 0 deletions
31
tests/regression/13-privatized/89-write-lacking-precision.c
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,31 @@ | ||
// PARAM: --set ana.base.privatization write | ||
#include<pthread.h> | ||
struct a { | ||
char* b; | ||
}; | ||
|
||
struct a *c; | ||
struct a h = {""}; | ||
struct a i = {"string"}; | ||
|
||
void* d(void* args) { | ||
if (c->b) { | ||
// Handled by privatization as a write | ||
// Without fix (#1468) causes both h.b and i.b to become unknown string | ||
__goblint_check(strlen(h.b) == 0); // Check h.b is still known | ||
} | ||
} | ||
|
||
int main() { | ||
int top; | ||
|
||
if(top) { | ||
c = &h; | ||
} else { | ||
c = &i; | ||
} | ||
|
||
pthread_t t; | ||
pthread_create(&t, 0, d, 0); | ||
return 0; | ||
} |
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,51 @@ | ||
//PARAM: --enable ana.int.interval | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <time.h> | ||
|
||
int more_intricate() { | ||
int arr[20]; | ||
|
||
int top; | ||
|
||
int i = 2; | ||
int j = 8; | ||
if(top) { | ||
i = 8; | ||
j = 9; | ||
} | ||
|
||
int* imprecise1 = &arr[i]; // &arr[2..8] | ||
int* imprecise2 = &arr[j]; // &arr[8..9] | ||
|
||
if(imprecise1 == imprecise2) { | ||
__goblint_check(imprecise1 == &arr[8]); | ||
__goblint_check(imprecise2 == &arr[8]); //TODO (Refinement should happen in both directions!) | ||
} | ||
|
||
if(imprecise1 == &arr[j]) { | ||
__goblint_check(imprecise1 == &arr[8]); | ||
} | ||
|
||
} | ||
|
||
|
||
int main() { | ||
int arr[20]; | ||
|
||
int top; | ||
|
||
int i = 2; | ||
if(top) { | ||
i = 8; | ||
} | ||
|
||
int* imprecise = &arr[i]; | ||
|
||
if(imprecise == &arr[2]) { | ||
__goblint_check(imprecise == &arr[2]); | ||
} | ||
|
||
more_intricate(); | ||
return 0; | ||
} |