comparison gcc/testsuite/gcc.dg/packed-vla.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* PR middle-end/27945 */
2 /* { dg-do run } */
3 /* { dg-options "" } */
4 /* { dg-require-effective-target alloca } */
5
6 extern int printf (const char *, ...);
7 extern void abort ();
8
9 int func(int levels)
10 {
11 struct bar {
12 unsigned char a;
13 int b[levels];
14 } __attribute__ ((__packed__)) bar;
15
16 struct foo {
17 unsigned char a;
18 int b[4];
19 } __attribute__ ((__packed__)) foo;
20
21 printf("foo %d\n", sizeof(foo));
22 printf("bar %d\n", sizeof(bar));
23
24 if (sizeof (foo) != sizeof (bar))
25 abort ();
26 }
27
28 int main()
29 {
30 func(4);
31 return 0;
32 }