| 1 |
/* PR tree-optimization/86492 */ |
| 2 |
|
| 3 |
union U |
| 4 |
{ |
| 5 |
unsigned int r; |
| 6 |
struct S |
| 7 |
{ |
| 8 |
unsigned int a:12; |
| 9 |
unsigned int b:4; |
| 10 |
unsigned int c:16; |
| 11 |
} f; |
| 12 |
}; |
| 13 |
|
| 14 |
__attribute__((noipa)) unsigned int |
| 15 |
foo (unsigned int x) |
| 16 |
{ |
| 17 |
union U u; |
| 18 |
u.r = 0; |
| 19 |
u.f.c = x; |
| 20 |
u.f.b = 0xe; |
| 21 |
return u.r; |
| 22 |
} |
| 23 |
|
| 24 |
int |
| 25 |
main () |
| 26 |
{ |
| 27 |
union U u; |
| 28 |
if (__CHAR_BIT__ * __SIZEOF_INT__ != 32 || sizeof (u.r) != sizeof (u.f)) |
| 29 |
return 0; |
| 30 |
u.r = foo (0x72); |
| 31 |
if (u.f.a != 0 || u.f.b != 0xe || u.f.c != 0x72) |
| 32 |
__builtin_abort (); |
| 33 |
return 0; |
| 34 |
} |