summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Warray-bounds-33.c
blob: 28f14b4722cb6a5dcf5e80c61860ea38f2653f5d (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
/* PR tree-optimization/86741 - ICE in -Warray-bounds indexing into
   an object of incomplete type
   { dg-do compile }
   { dg-options "-O2 -Wall" }  */

struct S
{
  int s;
};

void f (void);

void test_void (void)
{
  extern void v;
  struct S *b = (struct S*)&v;
  if (b->s)
    f ();
}

void test_incomplete_enum (void)
{
  extern enum E e;
  struct S *b = (struct S*)&e;
  if (b->s)
    f ();
}

void test_func (void)
{
  struct S *b = (struct S*)&f;
  if (b->s)
    f ();
}

/* { dg-prune-output "taking address of expression of type .void." } */