gcc/testsuite/gcc.dg/attr-ms_struct-packed1.c
raw| 1 | /* Test for MS structure with packed attribute. */ |
| 2 | /* { dg-do run { target i?86-*-* x86_64-*-* } } |
| 3 | /* { dg-options "-std=gnu99" } */ |
| 4 | |
| 5 | extern void abort (); |
| 6 | |
| 7 | union u |
| 8 | { |
| 9 | int a; |
| 10 | } __attribute__((__ms_struct__, __packed__)); |
| 11 | |
| 12 | struct s |
| 13 | { |
| 14 | char c; |
| 15 | union u u; |
| 16 | }; |
| 17 | |
| 18 | int |
| 19 | main (void) |
| 20 | { |
| 21 | if (sizeof (struct s) != (sizeof (char) + sizeof (union u))) |
| 22 | abort (); |
| 23 | |
| 24 | return 0; |
| 25 | } |