gcc/testsuite/gcc.c-torture/execute/931031-1.c
raw| 1 | /* { dg-additional-options "-std=gnu89" } */ |
| 2 | |
| 3 | /* The bit-field below would have a problem if __INT_MAX__ is too |
| 4 | small. */ |
| 5 | #if __INT_MAX__ < 2147483647 |
| 6 | int |
| 7 | main (void) |
| 8 | { |
| 9 | exit (0); |
| 10 | } |
| 11 | #else |
| 12 | struct foo |
| 13 | { |
| 14 | unsigned y:1; |
| 15 | unsigned x:32; |
| 16 | }; |
| 17 | |
| 18 | int |
| 19 | f (x) |
| 20 | struct foo x; |
| 21 | { |
| 22 | int t = x.x; |
| 23 | if (t < 0) |
| 24 | return 1; |
| 25 | return t+1; |
| 26 | } |
| 27 | |
| 28 | main () |
| 29 | { |
| 30 | struct foo x; |
| 31 | x.x = -1; |
| 32 | if (f (x) == 0) |
| 33 | abort (); |
| 34 | exit (0); |
| 35 | } |
| 36 | #endif |