forked from goblint/analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add testcases for thread return and pthread_exit in thread different …
…from main.
- Loading branch information
Showing
4 changed files
with
55 additions
and
2 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,26 @@ | ||
//PARAM: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak --set ana.activated[+] thread | ||
#include <stdlib.h> | ||
#include <pthread.h> | ||
|
||
int *m1; | ||
|
||
void *f2(void *arg) { | ||
m1 = malloc(sizeof(int)); | ||
while (1); | ||
return NULL; | ||
} | ||
|
||
void *f1(void *arg) { | ||
pthread_t t2; | ||
pthread_create(&t2, NULL, f2, NULL); | ||
|
||
return NULL; | ||
} | ||
|
||
int main(int argc, char const *argv[]) { | ||
pthread_t t1; | ||
pthread_create(&t1, NULL, f1, NULL); | ||
pthread_join(t1, NULL); | ||
|
||
return 0; // WARN | ||
} |
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: --set ana.malloc.unique_address_count 1 --set ana.activated[+] memLeak --set ana.activated[+] thread | ||
#include <stdlib.h> | ||
#include <pthread.h> | ||
|
||
int *m1; | ||
|
||
void *f2(void *arg) { | ||
m1 = malloc(sizeof(int)); | ||
while (1); | ||
return NULL; | ||
} | ||
|
||
void *f1(void *arg) { | ||
pthread_t t2; | ||
pthread_create(&t2, NULL, f2, NULL); | ||
|
||
pthread_exit(NULL); | ||
return NULL; | ||
} | ||
|
||
int main(int argc, char const *argv[]) { | ||
pthread_t t1; | ||
pthread_create(&t1, NULL, f1, NULL); | ||
pthread_join(t1, NULL); | ||
|
||
return 0; // WARN | ||
} |