[RFA:] fix 27_io/basic_ostream/inserters_arithmetic/char/4402.cc

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Fri Mar 23 11:34:00 GMT 2007


Changes to warnings for overflowing floating-point numbers
between 123135 and 123143 cause a testsuite regression for
cris-axis-elf (supposedly any target where sizeof double ==
sizeof (long double)) for the above test:
 x/27_io/basic_ostream/inserters_arithmetic/char/4402.cc:36: warning: floating constant exceeds range of 'long double'

(Oddly enough, this is the only regression due to this change.)

This lets it pass for cris-axis-elf.
Ok to commit?

	* testsuite/27_io/basic_ostream/inserters_arithmetic/char/4402.cc
	(test02): Avoid warnings by letting LDBL_MAX_10_EXP control the
	"very long float" value. 

:ADDPATCH: libstdc++:

--- 4402.cc.orig	Wed Jan  3 13:20:09 2007
+++ 4402.cc	Fri Mar 23 12:04:01 2007
@@ -1,7 +1,7 @@
 // 1999-11-15 Kevin Ediger  <kediger@licor.com>
 // test the floating point inserters (facet num_put)
 
-// Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -19,6 +19,7 @@
 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 // USA.
 
+#include <cfloat>
 #include <cstdio> // for sprintf
 #include <iostream>
 #include <iomanip>
@@ -33,7 +34,15 @@ test02()
   bool test __attribute__((unused)) = true;
 
   // make sure we can output a very long float
+#if LDBL_MAX_10_EXP > 1000
   long double val = 1.2345678901234567890123456789e+1000L;
+#elif LDBL_MAX_10_EXP > 200
+  long double val = 1.2345678901234567890123456789e+200L;
+#elif LDBL_MAX_10_EXP > 30
+  long double val = 1.2345678901234567890123456789e+30L;
+#else
+#error "Unreasonable limits for a long double."
+#endif
   int prec = numeric_limits<long double>::digits10;
 
   ostringstream os;

brgds, H-P



More information about the Gcc-patches mailing list