1 /* { dg-do compile } */
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 struct X { int *p; } REV_ENDIANNESS;
11 
12 struct X x;
13 
foo(int * p)14 struct X __attribute__((noinline)) foo (int *p)
15 {
16   struct X x;
17   x.p = p;
18   return x;
19 }
20 
bar(void)21 void __attribute((noinline)) bar (void)
22 {
23   *x.p = 1;
24 }
25 
26 extern void abort (void);
27 
main(void)28 int main (void)
29 {
30   int i = 0;
31   x = foo(&i);
32   bar();
33   if (i != 1)
34     abort ();
35   return 0;
36 }
37