| 1 |
/* Excess precision tests. Test C99 semantics for conversions from |
| 2 |
integers to floating point: no excess precision for either explicit |
| 3 |
or implicit conversions. */ |
| 4 |
/* { dg-do run } */ |
| 5 |
/* { dg-options "-std=c99 -mfpmath=387 -fexcess-precision=standard" } */ |
| 6 |
|
| 7 |
#ifdef __cplusplus |
| 8 |
extern "C" { |
| 9 |
#endif |
| 10 |
extern void abort (void); |
| 11 |
extern void exit (int); |
| 12 |
#ifdef __cplusplus |
| 13 |
} |
| 14 |
#endif |
| 15 |
|
| 16 |
int |
| 17 |
main (void) |
| 18 |
{ |
| 19 |
float f = 1.0f; |
| 20 |
int i; |
| 21 |
|
| 22 |
i = 0x10001234; |
| 23 |
if ((float) i != 0x10001240) |
| 24 |
abort (); |
| 25 |
|
| 26 |
i = 0x10001234; |
| 27 |
i += f; |
| 28 |
if (i != 0x10001241) |
| 29 |
abort (); |
| 30 |
|
| 31 |
i = 0x10001234; |
| 32 |
i += 1.0f; |
| 33 |
if (i != 0x10001241) |
| 34 |
abort (); |
| 35 |
|
| 36 |
i = 0x10001234; |
| 37 |
i = i + f; |
| 38 |
if (i != 0x10001241) |
| 39 |
abort (); |
| 40 |
|
| 41 |
i = 0x10001234; |
| 42 |
i = i + 1.0f; |
| 43 |
if (i != 0x10001241) |
| 44 |
abort (); |
| 45 |
|
| 46 |
exit (0); |
| 47 |
} |