blob: d8a711d65767f60ca3d7a1725457edc8ece51afb (
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
|
/* { dg-do compile } */
/* { 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
struct X { int *p; } REV_ENDIANNESS;
struct X x;
struct X __attribute__((noinline)) foo (int *p)
{
struct X x;
x.p = p;
return x;
}
void __attribute((noinline)) bar (void)
{
*x.p = 1;
}
extern void abort (void);
int main (void)
{
int i = 0;
x = foo(&i);
bar();
if (i != 1)
abort ();
return 0;
}
|