-
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 #1492 from goblint/issue_1489
Fix `mutex-meet` for malloc after thread creation
- Loading branch information
Showing
4 changed files
with
64 additions
and
1 deletion.
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,21 @@ | ||
// SKIP PARAM: --set ana.activated[+] apron --set ana.relation.privatization mutex-meet --set ana.apron.domain interval --set sem.int.signed_overflow assume_none | ||
// Checks that assinging to malloc'ed memory does not cause both branches to be dead | ||
#include <pthread.h> | ||
#include <goblint.h> | ||
void nop(void* arg) { | ||
} | ||
|
||
void main() { | ||
pthread_t thread; | ||
pthread_create(&thread, 0, &nop, 0); | ||
|
||
long *k = malloc(sizeof(long)); | ||
*k = 5; | ||
if (1) | ||
; | ||
|
||
__goblint_check(*k >= 5); // Reachable and true | ||
|
||
*k = *k+1; | ||
__goblint_check(*k >= 5); // Reachable and true | ||
} |
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,21 @@ | ||
// SKIP PARAM: --set ana.activated[+] apron --set ana.path_sens[+] threadflag --set ana.relation.privatization mutex-meet-tid --set ana.apron.domain interval --set sem.int.signed_overflow assume_none | ||
// Checks that assinging to malloc'ed memory does not cause both branches to be dead | ||
#include <pthread.h> | ||
#include <goblint.h> | ||
void nop(void* arg) { | ||
} | ||
|
||
void main() { | ||
pthread_t thread; | ||
pthread_create(&thread, 0, &nop, 0); | ||
|
||
long *k = malloc(sizeof(long)); | ||
*k = 5; | ||
if (1) | ||
; | ||
|
||
__goblint_check(*k >= 5); // Reachable and true | ||
|
||
*k = *k+1; | ||
__goblint_check(*k >= 5); // Reachable and true | ||
} |
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,21 @@ | ||
// SKIP PARAM: --set ana.activated[+] apron --set ana.relation.privatization mutex-meet-atomic --set ana.apron.domain interval --set sem.int.signed_overflow assume_none | ||
// Checks that assinging to malloc'ed memory does not cause both branches to be dead | ||
#include <pthread.h> | ||
#include <goblint.h> | ||
void nop(void* arg) { | ||
} | ||
|
||
void main() { | ||
pthread_t thread; | ||
pthread_create(&thread, 0, &nop, 0); | ||
|
||
long *k = malloc(sizeof(long)); | ||
*k = 5; | ||
if (1) | ||
; | ||
|
||
__goblint_check(*k >= 5); // Reachable and true | ||
|
||
*k = *k+1; | ||
__goblint_check(*k >= 5); // Reachable and true | ||
} |