[PATCH] remove DFP conversion support dropped from TR
Janis Johnson
janis187@us.ibm.com
Thu Nov 16 01:47:00 GMT 2006
The C standards committee decided in a meeting last month that the
result of a conversion from a decimal float value to an integer value
that doesn't fit in the result is unspecified. This patch removes
code that saturated the result.
Tested on powerpc64-linux with --enable-decimal-float. OK for mainline?
2006-11-15 Janis Johnson <janis187@us.ibm.com>
* config/dfp-bits.c (DFP_TO_INT): Remove code to saturate result
of conversion that doesn't fit.
Index: gcc/config/dfp-bit.c
===================================================================
--- gcc/config/dfp-bit.c (revision 118865)
+++ gcc/config/dfp-bit.c (working copy)
@@ -415,29 +415,6 @@
decNumberFromString (&qval, (char *) "1.0", &context);
/* Force the exponent to zero. */
decNumberQuantize (&n1, &n2, &qval, &context);
- /* This is based on text in N1107 section 5.1; it might turn out to be
- undefined behavior instead. */
- if (context.status & DEC_Invalid_operation)
- {
-#if defined (L_sd_to_si) || defined (L_dd_to_si) || defined (L_td_to_si)
- if (decNumberIsNegative(&n2))
- return INT_MIN;
- else
- return INT_MAX;
-#elif defined (L_sd_to_di) || defined (L_dd_to_di) || defined (L_td_to_di)
- if (decNumberIsNegative(&n2))
- /* Find a defined constant that will work here. */
- return (-9223372036854775807LL - 1LL);
- else
- /* Find a defined constant that will work here. */
- return 9223372036854775807LL;
-#elif defined (L_sd_to_usi) || defined (L_dd_to_usi) || defined (L_td_to_usi)
- return UINT_MAX;
-#elif defined (L_sd_to_udi) || defined (L_dd_to_udi) || defined (L_td_to_udi)
- /* Find a defined constant that will work here. */
- return 18446744073709551615ULL;
-#endif
- }
/* Get a string, which at this point will not include an exponent. */
decNumberToString (&n1, buf);
/* Ignore the fractional part. */
More information about the Gcc-patches
mailing list