]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/sso-15.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / sso-15.c
CommitLineData
4e3129b0
EB
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
10struct X { int *p; } REV_ENDIANNESS;
11
12struct X x;
13
14struct X __attribute__((noinline)) foo (int *p)
15{
16 struct X x;
17 x.p = p;
18 return x;
19}
20
21void __attribute((noinline)) bar (void)
22{
23 *x.p = 1;
24}
25
26extern void abort (void);
27
28int main (void)
29{
30 int i = 0;
31 x = foo(&i);
32 bar();
33 if (i != 1)
34 abort ();
35 return 0;
36}