gcc/testsuite/gcc.c-torture/execute/20031003-1.c
raw| 1 | /* PR optimization/9325 */ |
| 2 | |
| 3 | /* { dg-additional-options "-fno-trapping-math" } */ |
| 4 | |
| 5 | #include <limits.h> |
| 6 | |
| 7 | extern void abort (void); |
| 8 | |
| 9 | int f1() |
| 10 | { |
| 11 | return (int)2147483648.0f; |
| 12 | } |
| 13 | |
| 14 | int f2() |
| 15 | { |
| 16 | return (int)(float)(2147483647); |
| 17 | } |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | #if INT_MAX == 2147483647 |
| 22 | if (f1() != 2147483647) |
| 23 | abort (); |
| 24 | if (f2() != 2147483647) |
| 25 | abort (); |
| 26 | #endif |
| 27 | return 0; |
| 28 | } |
| 29 |