gcc/testsuite/gcc.c-torture/execute/struct-ret-2.c
raw| 1 | void abort (void); |
| 2 | void exit (int); |
| 3 | |
| 4 | typedef struct |
| 5 | { |
| 6 | unsigned char a __attribute__ ((packed)); |
| 7 | unsigned short b __attribute__ ((packed)); |
| 8 | } three_byte_t; |
| 9 | |
| 10 | unsigned char |
| 11 | f (void) |
| 12 | { |
| 13 | return 0xab; |
| 14 | } |
| 15 | |
| 16 | unsigned short |
| 17 | g (void) |
| 18 | { |
| 19 | return 0x1234; |
| 20 | } |
| 21 | |
| 22 | int |
| 23 | main (void) |
| 24 | { |
| 25 | three_byte_t three_byte; |
| 26 | |
| 27 | three_byte.a = f (); |
| 28 | three_byte.b = g (); |
| 29 | if (three_byte.a != 0xab || three_byte.b != 0x1234) |
| 30 | abort (); |
| 31 | exit (0); |
| 32 | } |
| 33 |