1 /* Test support of scalar_storage_order pragma */
4 /* { dg-require-effective-target int32plus } */
6 #pragma scalar_storage_order /* { dg-warning "missing .big-endian.little-endian.default." } */
8 #pragma scalar_storage_order big-endian
15 struct __attribute__((scalar_storage_order("little-endian"))) S2
20 #pragma scalar_storage_order little-endian
27 struct __attribute__((scalar_storage_order("big-endian"))) S4
32 #pragma scalar_storage_order default
39 #pragma scalar_storage_order other /* { dg-warning "expected .big-endian.little-endian.default." } */
41 struct S1 my_s1
= { 0x12345678 };
42 struct S2 my_s2
= { 0x12345678 };
43 struct S3 my_s3
= { 0x12345678 };
44 struct S4 my_s4
= { 0x12345678 };
45 struct S5 my_s5
= { 0x12345678 };
47 unsigned char big_endian_pattern
[4] = { 0x12, 0x34, 0x56, 0x78 };
48 unsigned char little_endian_pattern
[4] = { 0x78, 0x56, 0x34, 0x12 };
52 if (__builtin_memcmp (&my_s1
, &big_endian_pattern
, 4) != 0)
55 if (__builtin_memcmp (&my_s2
, &little_endian_pattern
, 4) != 0)
58 if (__builtin_memcmp (&my_s3
, &little_endian_pattern
, 4) != 0)
61 if (__builtin_memcmp (&my_s4
, &big_endian_pattern
, 4) != 0)
64 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
65 if (__builtin_memcmp (&my_s5
, &little_endian_pattern
, 4) != 0)
68 if (__builtin_memcmp (&my_s5
, &big_endian_pattern
, 4) != 0)