| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-Os" } */ |
| 3 |
|
| 4 |
extern void abort (void); |
| 5 |
|
| 6 |
void foo (unsigned long x) |
| 7 |
{ |
| 8 |
} |
| 9 |
|
| 10 |
typedef struct a { |
| 11 |
volatile unsigned int a1, a2, a3, a4, a5; |
| 12 |
} *A; |
| 13 |
typedef struct { |
| 14 |
volatile unsigned int b1, b2, b3, b4, b5; |
| 15 |
} *B; |
| 16 |
struct C { |
| 17 |
void *c1, *c2; |
| 18 |
A c3; |
| 19 |
unsigned char c4; |
| 20 |
}; |
| 21 |
|
| 22 |
void |
| 23 |
bar (struct C *c, unsigned int *d) |
| 24 |
{ |
| 25 |
*d = *d | 1; |
| 26 |
((c->c4 >= 2) |
| 27 |
? (*(volatile unsigned int *) ((void *)(&((A)c->c3)->a5)) = *d) |
| 28 |
: (*(volatile unsigned int *) ((void *)(&((B)c->c3)->b5)) = *d)); |
| 29 |
|
| 30 |
foo (50); |
| 31 |
} |
| 32 |
|
| 33 |
int main (void) |
| 34 |
{ |
| 35 |
struct a a; |
| 36 |
struct C c; |
| 37 |
unsigned int d = 8; |
| 38 |
c.c3 = &a; |
| 39 |
c.c4 = 0; |
| 40 |
bar (&c, &d); |
| 41 |
if (a.a5 != 9) |
| 42 |
abort (); |
| 43 |
return 0; |
| 44 |
} |