Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / sso-7.c
blob51902ab0e28d1ad72d4dd6c18e4eb8a8b0b3d17c
1 /* Test support of scalar_storage_order pragma */
3 /* { dg-do run } */
4 /* { dg-options "-fsso-struct=big-endian" } */
5 /* { dg-require-effective-target int32plus } */
7 struct S1
9 int i;
12 #pragma scalar_storage_order little-endian
14 struct S2
16 int i;
19 #pragma scalar_storage_order default
21 struct S3
23 int i;
26 struct S1 my_s1 = { 0x12345678 };
27 struct S2 my_s2 = { 0x12345678 };
28 struct S3 my_s3 = { 0x12345678 };
30 unsigned char big_endian_pattern[4] = { 0x12, 0x34, 0x56, 0x78 };
31 unsigned char little_endian_pattern[4] = { 0x78, 0x56, 0x34, 0x12 };
33 int main (void)
35 if (__builtin_memcmp (&my_s1, &big_endian_pattern, 4) != 0)
36 __builtin_abort ();
38 if (__builtin_memcmp (&my_s2, &little_endian_pattern, 4) != 0)
39 __builtin_abort ();
41 if (__builtin_memcmp (&my_s3, &big_endian_pattern, 4) != 0)
42 __builtin_abort ();
44 return 0;