| 1 |
/* PR tree-optimization/86741 - ICE in -Warray-bounds indexing into |
| 2 |
an object of incomplete type |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O2 -Wall" } */ |
| 5 |
|
| 6 |
struct S |
| 7 |
{ |
| 8 |
int s; |
| 9 |
}; |
| 10 |
|
| 11 |
void f (void); |
| 12 |
|
| 13 |
void test_void (void) |
| 14 |
{ |
| 15 |
extern void v; |
| 16 |
struct S *b = (struct S*)&v; |
| 17 |
if (b->s) |
| 18 |
f (); |
| 19 |
} |
| 20 |
|
| 21 |
void test_incomplete_enum (void) |
| 22 |
{ |
| 23 |
extern enum E e; |
| 24 |
struct S *b = (struct S*)&e; |
| 25 |
if (b->s) |
| 26 |
f (); |
| 27 |
} |
| 28 |
|
| 29 |
void test_func (void) |
| 30 |
{ |
| 31 |
struct S *b = (struct S*)&f; |
| 32 |
if (b->s) /* { dg-warning "accessing data memory with program memory address.*" "" { target avr-*-* } } */ |
| 33 |
f (); |
| 34 |
} |
| 35 |
|
| 36 |
/* { dg-prune-output "taking address of expression of type .void." } */ |