| 1 |
/* Test scalar_storage_order attribute and pointer fields */ |
| 2 |
|
| 3 |
/* { dg-do run } */ |
| 4 |
/* { dg-options "-Wno-pedantic" } */ |
| 5 |
|
| 6 |
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
| 7 |
struct __attribute__((scalar_storage_order("big-endian"))) Rec |
| 8 |
{ |
| 9 |
int *p; |
| 10 |
}; |
| 11 |
#else |
| 12 |
struct __attribute__((scalar_storage_order("little-endian"))) Rec |
| 13 |
{ |
| 14 |
int *p; |
| 15 |
}; |
| 16 |
#endif |
| 17 |
|
| 18 |
int main (int argc) |
| 19 |
{ |
| 20 |
struct Rec r = { &argc }; |
| 21 |
int *p = &argc; |
| 22 |
|
| 23 |
if (__builtin_memcmp (&r.p, &p, sizeof (int *)) != 0) |
| 24 |
__builtin_abort (); |
| 25 |
|
| 26 |
return 0; |
| 27 |
} |