-
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 #1659 from goblint/issue_1658
Consider pointees separately for refinement
- Loading branch information
Showing
3 changed files
with
98 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// PARAM: --enable ana.int.interval | ||
|
||
int two = 2; | ||
int three = 3; | ||
|
||
struct s { int content; }; | ||
struct s twostruct = {2}; | ||
struct s threestruct = {3}; | ||
|
||
int main() { | ||
int* ptr; | ||
struct s* ptrstruct; | ||
int top; | ||
|
||
if(top) { | ||
ptr = &two; | ||
ptrstruct = &twostruct; | ||
} else { | ||
ptr = &three; | ||
ptrstruct = &threestruct; | ||
} | ||
|
||
if(*ptr == 2) { | ||
__goblint_check(ptr == &two); | ||
} | ||
|
||
if(ptrstruct->content == 2) { | ||
__goblint_check(ptrstruct == &twostruct); | ||
} | ||
|
||
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,27 @@ | ||
// PARAM: --enable ana.int.interval | ||
|
||
int two = 2; | ||
int three = 5; | ||
|
||
int main() { | ||
int* ptr; | ||
int top; | ||
|
||
int indicator = 1; | ||
|
||
if(top) { | ||
ptr = &two; | ||
} else { | ||
ptr = &three; | ||
} | ||
|
||
// Evaluating this in the interval domain yields [2,5] | ||
// Only trying to optimize per-pointer discovers that this in fact dead code (https://github.com/goblint/analyzer/pull/1659) | ||
if(*ptr == 3) { | ||
// Dead | ||
indicator = 0; | ||
} | ||
|
||
__goblint_check(indicator == 1); | ||
return 0; | ||
} |