| 1 |
/* { dg-require-effective-target pthread } */ |
| 2 |
|
| 3 |
#include <stdio.h> |
| 4 |
#include <stdlib.h> |
| 5 |
#include <pthread.h> |
| 6 |
#include <errno.h> |
| 7 |
#include <unistd.h> |
| 8 |
|
| 9 |
#include "analyzer-decls.h" |
| 10 |
|
| 11 |
int z; |
| 12 |
|
| 13 |
static void func(void * o) |
| 14 |
{ |
| 15 |
(void) o; |
| 16 |
} |
| 17 |
|
| 18 |
int main(int argc, |
| 19 |
int ** argv) |
| 20 |
{ |
| 21 |
struct timespec now; |
| 22 |
|
| 23 |
int * x; |
| 24 |
int ret = 0; |
| 25 |
|
| 26 |
pthread_cleanup_push(func, NULL); |
| 27 |
|
| 28 |
while (ret != ETIMEDOUT) |
| 29 |
ret = rand() % 1000; |
| 30 |
|
| 31 |
if (ret != ETIMEDOUT) |
| 32 |
x = &z; |
| 33 |
|
| 34 |
pthread_cleanup_pop(1); |
| 35 |
|
| 36 |
if (ret == ETIMEDOUT) |
| 37 |
return 0; |
| 38 |
|
| 39 |
__analyzer_dump_path (); /* { dg-bogus "path" } */ |
| 40 |
printf("x = %d\n", *x); /* { dg-bogus "use of uninitialized value 'x'" } */ |
| 41 |
|
| 42 |
return 0; |
| 43 |
} |