aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/pr94099.c
blob: 1d7a5d771d6223291452e69bc31a2429fd20ef26 (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
/* { dg-additional-options "-O1" } */

struct cg {
  int hk;
  int *bg;
};

union vb {
  struct cg gk;
};

void
l3 (union vb *);

void
pl (void)
{
  union vb th = { 0, };
  int sc;

  for (sc = 0; sc < 1; ++sc)
    {
      th.gk.hk = 0;
      th.gk.bg[sc] = 0; /* { dg-warning "dereference of NULL '0'" } */
      // TODO: above message could be improved
      l3 (&th);
    }
}