aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/sso-12.c
blob: 3bed280e1734a0b83771adc16c58620f642d12ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Test scalar_storage_order attribute and pointer fields */

/* { dg-do run } */
/* { dg-options "-Wno-pedantic" } */

#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
struct __attribute__((scalar_storage_order("big-endian"))) Rec
{
  int *p;
};
#else
struct __attribute__((scalar_storage_order("little-endian"))) Rec
{
  int *p;
};
#endif

int main (int argc)
{
  struct Rec r = { &argc };
  int *p = &argc;

  if (__builtin_memcmp (&r.p, &p, sizeof (int *)) != 0)
    __builtin_abort ();

  return 0;
}