gcc/testsuite/gcc.c-torture/execute/960909-1.c
raw| 1 | void abort (void); |
| 2 | void exit (int); |
| 3 | |
| 4 | int |
| 5 | ffs (x) |
| 6 | int x; |
| 7 | { |
| 8 | int bit, mask; |
| 9 | |
| 10 | if (x == 0) |
| 11 | return 0; |
| 12 | |
| 13 | for (bit = 1, mask = 1; !(x & mask); bit++, mask <<= 1) |
| 14 | ; |
| 15 | |
| 16 | return bit; |
| 17 | } |
| 18 | |
| 19 | void |
| 20 | f (x) |
| 21 | int x; |
| 22 | { |
| 23 | int y; |
| 24 | y = ffs (x) - 1; |
| 25 | if (y < 0) |
| 26 | abort (); |
| 27 | } |
| 28 | |
| 29 | int |
| 30 | main (void) |
| 31 | { |
| 32 | f (1); |
| 33 | exit (0); |
| 34 | } |