2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-flex-array-4.c
blobab20cf07cc468dd72ab9a22067938456a59cdaba
1 /* Test for flexible array members. Test for agreement of offset and
2 structure size. This is expected to fail, because of a possible
3 defect in the standard. */
4 /* Origin: http://gcc.gnu.org/ml/gcc/2002-05/msg02844.html
5 from Tony Finch <dot@dotat.at>, adapted to a testcase by Joseph Myers
6 <jsm28@cam.ac.uk>. See also WG14 reflector messages 9571-3. */
7 /* { dg-do compile } */
8 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
10 #include <stddef.h>
12 struct foo {
13 int a;
14 short b;
15 char pad[];
18 struct bar {
19 int a;
20 short b;
21 char pad[1024];
24 char x[(sizeof(struct foo) == offsetof(struct foo, pad)) ? 1 : -1]; /* { dg-bogus "negative" "sizeof != offsetof" { xfail *-*-* } } */
25 char y[(offsetof(struct foo, pad) == offsetof(struct bar, pad)) ? 1 : -1];