aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/feasibility-pr107582-1.c
blob: 15799d0284562093db375c896227b434a35cb354 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* { dg-require-effective-target pthread }  */

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
#include <unistd.h>

#include "analyzer-decls.h"

int z;

static void func(void * o)
{
  (void) o;
}

int main(int    argc,
         int ** argv)
{
  struct timespec now;

  int * x;
  int   ret = 0;

  pthread_cleanup_push(func, NULL);

  while (ret != ETIMEDOUT)
    ret = rand() % 1000;

  if (ret != ETIMEDOUT)
    x = &z;

  pthread_cleanup_pop(1);

  if (ret == ETIMEDOUT)
    return 0;

  __analyzer_dump_path (); /* { dg-bogus "path" } */
  printf("x = %d\n", *x); /* { dg-bogus "use of uninitialized value 'x'" } */

  return 0;
}