PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / packed-vla.c
blobe673b729b5463819169be4294b171526f51bfb92
1 /* PR middle-end/27945 */
2 /* { dg-do run } */
3 /* { dg-options "" } */
4 /* { dg-require-effective-target alloca } */
6 extern int printf (const char *, ...);
7 extern void abort ();
9 int func(int levels)
11 struct bar {
12 unsigned char a;
13 int b[levels];
14 } __attribute__ ((__packed__)) bar;
16 struct foo {
17 unsigned char a;
18 int b[4];
19 } __attribute__ ((__packed__)) foo;
21 printf("foo %d\n", sizeof(foo));
22 printf("bar %d\n", sizeof(bar));
24 if (sizeof (foo) != sizeof (bar))
25 abort ();
28 int main()
30 func(4);
31 return 0;