1 // { dg-do run { target i?86-*-linux* i?86-*-freebsd* } }
2 // { dg-options "-malign-double" }
3 // Origin: Alex Samuel <samuel@codesourcery.com>
5 /* Test the data layout of C aggregates by checking aggregate size and
6 alignment and field offsets for compliance with the IA-64 ABI. */
18 return (unsigned) & ((S *) 0)->object_;
21 /* Computes the alignment, in bytes, of TYPE. */
23 #define alignof(type) (alignmentof<type> ())
25 /* Computes the offset of FIELD in AGGREGATE. */
27 #define offsetof(aggregate, field) \
28 ((unsigned) (& ((aggregate*) 0)->field))
31 /* Structs S1, S2, S3, S4, and union U5 are taken from Intel, "IA-64
32 Software Conventions and Runtime Architecture Guide", version of
73 if (sizeof (struct S1) != 1)
75 if (alignof (struct S1) != 1)
77 if (offsetof (struct S1, c) != 0)
80 if (sizeof (struct S2) != 8)
82 if (alignof (struct S2) != 4)
84 if (offsetof (struct S2, c) != 0)
86 if (offsetof (struct S2, d) != 1)
88 if (offsetof (struct S2, s) != 2)
90 if (offsetof (struct S2, n) != 4)
93 if (sizeof (struct S3) != 4)
95 if (alignof (struct S3) != 2)
97 if (offsetof (struct S3, c) != 0)
99 if (offsetof (struct S3, s) != 2)
102 if (sizeof (struct S4) != 24)
104 if (alignof (struct S4) != 8)
106 if (offsetof (struct S4, c) != 0)
108 if (offsetof (struct S4, d) != 8)
110 if (offsetof (struct S4, s) != 16)
113 if (sizeof (union U5) != 4)
115 if (alignof (union U5) != 4)
117 if (offsetof (union U5, c) != 0)
119 if (offsetof (union U5, s) != 0)
121 if (offsetof (union U5, j) != 0)