| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
typedef unsigned long NI; |
| 5 |
|
| 6 |
struct inner_t_Content |
| 7 |
{ |
| 8 |
int x[8], y[16]; |
| 9 |
char a[10], b[20], c[30]; |
| 10 |
}; |
| 11 |
|
| 12 |
struct inner_t { |
| 13 |
NI len; |
| 14 |
struct inner_t_Content* p; |
| 15 |
}; |
| 16 |
|
| 17 |
struct outer_t { |
| 18 |
struct inner_t bytes; |
| 19 |
NI position; |
| 20 |
}; |
| 21 |
|
| 22 |
struct localo_t { |
| 23 |
struct outer_t fo; |
| 24 |
char stuff[222]; |
| 25 |
}; |
| 26 |
|
| 27 |
struct alien_t { |
| 28 |
NI Field0; |
| 29 |
struct inner_t Field1; |
| 30 |
}; |
| 31 |
|
| 32 |
static struct inner_t_Content gic; |
| 33 |
struct inner_t gis; |
| 34 |
struct outer_t gos; |
| 35 |
volatile int vgi; |
| 36 |
|
| 37 |
int __attribute__((noipa)) |
| 38 |
get_int (void) |
| 39 |
{ |
| 40 |
return 0; |
| 41 |
} |
| 42 |
|
| 43 |
struct inner_t __attribute__((noipa)) |
| 44 |
get_inner_t () |
| 45 |
{ |
| 46 |
struct inner_t v = {0, (void *)0}; |
| 47 |
return v; |
| 48 |
} |
| 49 |
|
| 50 |
void __attribute__((noipa)) |
| 51 |
use_inner_t (struct inner_t v) |
| 52 |
{ |
| 53 |
gis = v; |
| 54 |
} |
| 55 |
|
| 56 |
void __attribute__((noipa)) |
| 57 |
init (void) |
| 58 |
{ |
| 59 |
gos.bytes.len = 15; |
| 60 |
gos.bytes.p = &gic; |
| 61 |
} |
| 62 |
|
| 63 |
void __attribute__((noipa)) |
| 64 |
check (void) |
| 65 |
{ |
| 66 |
if (gis.p != &gic) |
| 67 |
__builtin_abort (); |
| 68 |
} |
| 69 |
|
| 70 |
static void foo (int m, struct outer_t *a) |
| 71 |
{ |
| 72 |
struct inner_t lis; |
| 73 |
|
| 74 |
if (m == 20) |
| 75 |
((struct alien_t *) a)->Field1.len = 0; |
| 76 |
if (m == 21) |
| 77 |
lis = get_inner_t (); |
| 78 |
else |
| 79 |
lis = a->bytes; |
| 80 |
|
| 81 |
vgi = get_int (); |
| 82 |
if (m < 1) |
| 83 |
use_inner_t (lis); |
| 84 |
if (get_int ()) |
| 85 |
vgi = ((struct alien_t *) a)->Field1.len; |
| 86 |
|
| 87 |
} |
| 88 |
|
| 89 |
void bar (struct outer_t pos) |
| 90 |
{ |
| 91 |
struct localo_t los; |
| 92 |
los.fo = pos; |
| 93 |
los.fo.bytes.len = get_int (); |
| 94 |
foo (get_int (), &los.fo); |
| 95 |
gos = los.fo; |
| 96 |
} |
| 97 |
|
| 98 |
int main (int argc, char **argv) |
| 99 |
{ |
| 100 |
init (); |
| 101 |
for (int i = 0; i <= get_int (); i++) |
| 102 |
bar (gos); |
| 103 |
check (); |
| 104 |
return 0; |
| 105 |
} |