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