| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target ia32 } */ |
| 3 |
/* { dg-options "-O2 -mpreferred-stack-boundary=2 -march=i686 -frename-registers" } */ |
| 4 |
|
| 5 |
extern void abort (void) __attribute__((noreturn)); |
| 6 |
|
| 7 |
struct wrapper { |
| 8 |
union setconflict |
| 9 |
{ |
| 10 |
short a[20]; |
| 11 |
int b[10]; |
| 12 |
} a; |
| 13 |
}; |
| 14 |
|
| 15 |
int |
| 16 |
main () |
| 17 |
{ |
| 18 |
int sum = 0; |
| 19 |
{ |
| 20 |
struct wrapper a; |
| 21 |
short *c; |
| 22 |
c = a.a.a; |
| 23 |
asm ("": "=r" (c):"0" (c)); |
| 24 |
*c = 0; |
| 25 |
asm ("": "=r" (c):"0" (c)); |
| 26 |
sum += *c; |
| 27 |
} |
| 28 |
{ |
| 29 |
struct wrapper a; |
| 30 |
int *c; |
| 31 |
c = a.a.b; |
| 32 |
asm ("": "=r" (c):"0" (c)); |
| 33 |
*c = 1; |
| 34 |
asm ("": "=r" (c):"0" (c)); |
| 35 |
sum += *c; |
| 36 |
} |
| 37 |
|
| 38 |
if (sum != 1) |
| 39 |
abort(); |
| 40 |
return 0; |
| 41 |
} |
| 42 |
|