gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c
raw| 1 | void abort (void); |
| 2 | void exit (int); |
| 3 | |
| 4 | struct foo |
| 5 | { |
| 6 | unsigned half:16; |
| 7 | unsigned long whole:32 __attribute__ ((packed)); |
| 8 | }; |
| 9 | |
| 10 | void |
| 11 | f (struct foo *q) |
| 12 | { |
| 13 | if (q->half != 0x1234) |
| 14 | abort (); |
| 15 | if (q->whole != 0x56789abcL) |
| 16 | abort (); |
| 17 | } |
| 18 | |
| 19 | int |
| 20 | main (void) |
| 21 | { |
| 22 | struct foo bar; |
| 23 | |
| 24 | bar.half = 0x1234; |
| 25 | bar.whole = 0x56789abcL; |
| 26 | f (&bar); |
| 27 | exit (0); |
| 28 | } |