gcc/testsuite/gcc.c-torture/execute/compndlit-1.c
raw| 1 | /* The bit-field below would have a problem if __INT_MAX__ is too |
| 2 | small. */ |
| 3 | void abort (void); |
| 4 | void exit (int); |
| 5 | |
| 6 | #if __INT_MAX__ < 2147483647 |
| 7 | int |
| 8 | main (void) |
| 9 | { |
| 10 | exit (0); |
| 11 | } |
| 12 | #else |
| 13 | struct S |
| 14 | { |
| 15 | int a:3; |
| 16 | unsigned b:1, c:28; |
| 17 | }; |
| 18 | |
| 19 | struct S x = {1, 1, 1}; |
| 20 | |
| 21 | int |
| 22 | main (void) |
| 23 | { |
| 24 | x = (struct S) {b:0, a:0, c:({ struct S o = x; o.a == 1 ? 10 : 20;})}; |
| 25 | if (x.c != 10) |
| 26 | abort (); |
| 27 | exit (0); |
| 28 | } |
| 29 | #endif |