| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
| 5 |
#define REV_ENDIANNESS __attribute__((scalar_storage_order("big-endian"))) |
| 6 |
#else |
| 7 |
#define REV_ENDIANNESS __attribute__((scalar_storage_order("little-endian"))) |
| 8 |
#endif |
| 9 |
|
| 10 |
typedef unsigned long long u64; |
| 11 |
|
| 12 |
union DST { |
| 13 |
u64 val; |
| 14 |
|
| 15 |
struct { |
| 16 |
u64 x : 1; |
| 17 |
u64 y : 1; |
| 18 |
u64 r: 62; |
| 19 |
} REV_ENDIANNESS; |
| 20 |
} REV_ENDIANNESS; |
| 21 |
|
| 22 |
|
| 23 |
struct SRC { |
| 24 |
u64 a; |
| 25 |
} REV_ENDIANNESS; |
| 26 |
|
| 27 |
[[gnu::noipa]] |
| 28 |
void foo () {__builtin_abort();} |
| 29 |
|
| 30 |
[[gnu::noinline]] |
| 31 |
int bar(struct SRC *src) |
| 32 |
{ |
| 33 |
union DST dst; |
| 34 |
|
| 35 |
dst.val = src->a; |
| 36 |
|
| 37 |
if (dst.y) { |
| 38 |
foo(); |
| 39 |
} |
| 40 |
return 0; |
| 41 |
} |
| 42 |
|
| 43 |
int main(void) |
| 44 |
{ |
| 45 |
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
| 46 |
struct SRC t = {-1ull & (~(0x01ull<<62))}; |
| 47 |
#else |
| 48 |
struct SRC t = {-1ull & (~(0x01ull<<1))}; |
| 49 |
#endif |
| 50 |
bar(&t); |
| 51 |
return 0; |
| 52 |
} |