PATCH: Fix gcc.dg/dfp/convert-bfp-11.c

H.J. Lu hjl@lucon.org
Thu Sep 13 02:38:00 GMT 2007


On Tue, Sep 11, 2007 at 02:11:57PM -0700, Janis Johnson wrote:
> One of the new tests I added yesterday for conversions between decimal
> and binary floating point types fails for BID with a link error because
> __bid128_isfin isn't found.  There is a definition of this file in
> libbid, but the file isn't included in libgcc.
> 
> This is probably obvious, but I thought I'd make sure; HJ?
> 
> With this patch, test gcc.dg/dfp/convert-bfp-4.c builds successfully,
> although now it fails at execution time as does test convert-bfp-5.c
> dealing with NaNs.
> 

Our latest BID library passes all DFP tests, except convert-bfp-11.c.
In convert-bfp-11.c, the following four test cases fail (starting at
line #28):

/* Check values that are too large for the result type.  */
CONVERT_TO_PINF (301, dd, tf, 1.8e+308dd, l)
CONVERT_TO_PINF (302, dd, tf, 9.9e+384dd, l)
CONVERT_TO_PINF (303, td, tf, 1.8e+308dl, l)
CONVERT_TO_PINF (304, td, tf, 9.9e+384dl, l)

But this is incorrect: the test cases assume that the decimal values in
the fourth argument of the macro do not fit in the tf data type. They
fit, because tf is the 128-bit floating-point data type (quad
precision). Intention was to test these values for the destination
format df (64-bit, double precision floating-point data type) because
1.8e+308dd is right above the largest value you can represent with the
double precision type (1.7976 e+308), so the conversions listed above
will have a result of positive infinity. The correct ones should be:

/* Check values that are too large for the result type.  */
CONVERT_TO_PINF (301, dd, df, 1.8e+308dd, l)
CONVERT_TO_PINF (302, dd, df, 9.9e+384dd, l)
CONVERT_TO_PINF (303, td, df, 1.8e+308dl, l)
CONVERT_TO_PINF (304, td, df, 9.9e+384dl, l)


H.J.
---
2007-09-12  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.dg/dfp/convert-bfp-11.c: Correct tests 301, 302, 303
	and 304.

--- gcc/testsuite/gcc.dg/dfp/convert-bfp-11.c.inf	2007-09-11 16:41:28.000000000 -0700
+++ gcc/testsuite/gcc.dg/dfp/convert-bfp-11.c	2007-09-12 18:09:33.000000000 -0700
@@ -26,10 +26,10 @@ CONVERT_VALID (203, tf, td, 1.79768e+308
 CONVERT_VALID (204, td, tf, 1.79768e+308dl, 1.79768e+308l, 2.e292l)
 
 /* Check values that are too large for the result type.  */
-CONVERT_TO_PINF (301, dd, tf, 1.8e+308dd, l)
-CONVERT_TO_PINF (302, dd, tf, 9.9e+384dd, l)
-CONVERT_TO_PINF (303, td, tf, 1.8e+308dl, l)
-CONVERT_TO_PINF (304, td, tf, 9.9e+384dl, l)
+CONVERT_TO_PINF (301, dd, df, 1.8e+308dd, l)
+CONVERT_TO_PINF (302, dd, df, 9.9e+384dd, l)
+CONVERT_TO_PINF (303, td, df, 1.8e+308dl, l)
+CONVERT_TO_PINF (304, td, df, 9.9e+384dl, l)
 
 CONVERT_TO_PINF (311, tf, sd, 1.0e+97L, d32)
 CONVERT_TO_PINF (312, tf, sd, 1.6e+308L, d32)



More information about the Gcc-patches mailing list