PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 991014-1.c
blobe0bcd6d8bef809e6fec5e93afcfd16283c06c162
2 typedef __SIZE_TYPE__ Size_t;
4 #if __SIZEOF_LONG__ < __SIZEOF_POINTER__
5 #define bufsize ((1LL << (8 * sizeof(Size_t) - 2))-256)
6 #else
7 #define bufsize ((1L << (8 * sizeof(Size_t) - 2))-256)
8 #endif
10 struct huge_struct
12 short buf[bufsize];
13 int a;
14 int b;
15 int c;
16 int d;
19 union huge_union
21 int a;
22 char buf[bufsize];
25 Size_t union_size()
27 return sizeof(union huge_union);
30 Size_t struct_size()
32 return sizeof(struct huge_struct);
35 Size_t struct_a_offset()
37 return (Size_t)(&((struct huge_struct *) 0)->a);
40 int main()
42 /* Check the exact sizeof value. bufsize is aligned on 256b. */
43 if (union_size() != sizeof(char) * bufsize)
44 abort();
46 if (struct_size() != sizeof(short) * bufsize + 4*sizeof(int))
47 abort();
49 if (struct_a_offset() < sizeof(short) * bufsize)
50 abort();
52 return 0;