gcc/testsuite/gcc.c-torture/execute/ieee/minuszero.c
raw| 1 | void abort (void); |
| 2 | void exit (int); |
| 3 | |
| 4 | int |
| 5 | main (void) |
| 6 | { |
| 7 | union |
| 8 | { |
| 9 | double d; |
| 10 | unsigned short i[sizeof (double) / sizeof (short)]; |
| 11 | } u; |
| 12 | int a = 0; |
| 13 | int b = -5; |
| 14 | int j; |
| 15 | |
| 16 | u.d = (double) a / b; |
| 17 | |
| 18 | /* Look for the right pattern, but be sloppy since |
| 19 | we don't know the byte order. */ |
| 20 | for (j = 0; j < sizeof (double) / sizeof (short); j++) |
| 21 | { |
| 22 | if (u.i[j] == 0x8000) |
| 23 | exit (0); |
| 24 | } |
| 25 | abort (); |
| 26 | } |