PR middle-end/27945
[official-gcc.git] / gcc / testsuite / gcc.dg / packed-vla.c
blobd5fef5c4ccfb2726c8d0440ac31ab51aeb35ca90
1 /* { dg-do run } */
2 /* { dg-options "" } */
4 extern int printf (const char *, ...);
5 extern void abort ();
7 int func(int levels)
9 struct bar {
10 unsigned char a;
11 int b[levels];
12 } __attribute__ ((__packed__)) bar;
14 struct foo {
15 unsigned char a;
16 int b[4];
17 } __attribute__ ((__packed__)) foo;
19 printf("foo %d\n", sizeof(foo));
20 printf("bar %d\n", sizeof(bar));
22 if (sizeof (foo) != sizeof (bar))
23 abort ();
26 int main()
28 func(4);
29 return 0;