| 1 |
/* PR middle-end/27945 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-options "" } */ |
| 4 |
|
| 5 |
extern int printf (const char *, ...); |
| 6 |
extern void abort (); |
| 7 |
|
| 8 |
int func(int levels) |
| 9 |
{ |
| 10 |
struct bar { |
| 11 |
unsigned char a; |
| 12 |
int b[levels]; |
| 13 |
} __attribute__ ((__packed__)) bar; |
| 14 |
|
| 15 |
struct foo { |
| 16 |
unsigned char a; |
| 17 |
int b[4]; |
| 18 |
} __attribute__ ((__packed__)) foo; |
| 19 |
|
| 20 |
printf("foo %d\n", sizeof(foo)); |
| 21 |
printf("bar %d\n", sizeof(bar)); |
| 22 |
|
| 23 |
if (sizeof (foo) != sizeof (bar)) |
| 24 |
abort (); |
| 25 |
} |
| 26 |
|
| 27 |
int main() |
| 28 |
{ |
| 29 |
func(4); |
| 30 |
return 0; |
| 31 |
} |