This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] libstdc++/8949


Hi,

in case my previous analysis is correct, I propose the
following fix, tested x86-linux.

Ok as soon as mainline reopens?

Paolo.

//////////
2002-12-15  Paolo Carlini  <pcarlini@unitus.it>

	* include/std/std_limits.h
	(struct numeric_limits<short>,
	struct numeric_limits<unsigned short>,
	struct numeric_limits<int>,
	struct numeric_limits<unsigned int>,
	struct numeric_limits<long>,
	struct numeric_limits<unsigned long>,
	struct numeric_limits<long long>,
	struct numeric_limits<unsigned long long>): According
	to 18.2.1.2,53 and 18.2.1.5,1 is_iec559 shall be false.
	* testsuite/18_support/numeric_limits.cc: Add test04.
diff -urN libstdc++-v3-orig/include/std/std_limits.h libstdc++-v3/include/std/std_limits.h
--- libstdc++-v3-orig/include/std/std_limits.h	2002-09-28 00:39:28.000000000 +0200
+++ libstdc++-v3/include/std/std_limits.h	2002-12-15 20:45:23.000000000 +0100
@@ -508,7 +508,7 @@
       static short denorm_min() throw()
       { return short(); }
 
-      static const bool is_iec559 = true;
+      static const bool is_iec559 = false;
       static const bool is_bounded = true;
       static const bool is_modulo = true;
 
@@ -558,7 +558,7 @@
       static unsigned short denorm_min() throw()
       { return static_cast<unsigned short>(0); }
 
-      static const bool is_iec559 = true;
+      static const bool is_iec559 = false;
       static const bool is_bounded = true;
       static const bool is_modulo = true;
 
@@ -608,7 +608,7 @@
       static int denorm_min() throw()
       { return static_cast<int>(0); }
 
-      static const bool is_iec559 = true;
+      static const bool is_iec559 = false;
       static const bool is_bounded = true;
       static const bool is_modulo = true;
 
@@ -658,7 +658,7 @@
       static unsigned int denorm_min() throw()
       { return static_cast<unsigned int>(0); }
 
-      static const bool is_iec559 = true;
+      static const bool is_iec559 = false;
       static const bool is_bounded = true;
       static const bool is_modulo = true;
 
@@ -708,7 +708,7 @@
       static long denorm_min() throw()
       { return static_cast<long>(0); }
 
-      static const bool is_iec559 = true;
+      static const bool is_iec559 = false;
       static const bool is_bounded = true;
       static const bool is_modulo = true;
 
@@ -758,7 +758,7 @@
       static unsigned long denorm_min() throw()
       { return static_cast<unsigned long>(0); }
 
-      static const bool is_iec559 = true;
+      static const bool is_iec559 = false;
       static const bool is_bounded = true;
       static const bool is_modulo = true;
 
@@ -808,7 +808,7 @@
       static long long denorm_min() throw()
       { return static_cast<long long>(0); }
 
-      static const bool is_iec559 = true;
+      static const bool is_iec559 = false;
       static const bool is_bounded = true;
       static const bool is_modulo = true;
 
@@ -858,7 +858,7 @@
       static unsigned long long denorm_min() throw()
       { return static_cast<unsigned long long>(0); }
 
-      static const bool is_iec559 = true;
+      static const bool is_iec559 = false;
       static const bool is_bounded = true;
       static const bool is_modulo = true;
 
diff -urN libstdc++-v3-orig/testsuite/18_support/numeric_limits.cc libstdc++-v3/testsuite/18_support/numeric_limits.cc
--- libstdc++-v3-orig/testsuite/18_support/numeric_limits.cc	2002-10-22 11:35:10.000000000 +0200
+++ libstdc++-v3/testsuite/18_support/numeric_limits.cc	2002-12-15 21:07:50.000000000 +0100
@@ -289,12 +289,33 @@
   return test;
 }
 
+// libstdc++/8949
+bool test04()
+{
+  bool test = true;
+
+  VERIFY( !std::numeric_limits<short>::is_iec559 );
+  VERIFY( !std::numeric_limits<unsigned short>::is_iec559 );
+  VERIFY( !std::numeric_limits<int>::is_iec559 );
+  VERIFY( !std::numeric_limits<unsigned int>::is_iec559 );
+  VERIFY( !std::numeric_limits<long>::is_iec559 );
+  VERIFY( !std::numeric_limits<unsigned long>::is_iec559 );
+  VERIFY( !std::numeric_limits<long long>::is_iec559 );
+  VERIFY( !std::numeric_limits<unsigned long long>::is_iec559 );
+
+#ifdef DEBUG_ASSERT
+  assert(test);
+#endif
+
+  return test;
+}
 
 int main()
 {
   test01();
   test02();
   test03();
+  test04();
 
   test_extrema<char>();
   test_extrema<signed char>();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]