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


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

Re: New boost regressions since yesterday for gcc 3.0.1


Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> writes:

| After applying your patch all test cases of
| ../libs/integer/integer_traits_test.cpp pass, except for the following
| test case tps.C. std::numeric_limits<signed char>::min() and
| std::numeric_limits<signed char>::min() both return the same value, \200,
| which is -128, equivalent to CHAR_MIN.

Grrr, this is what happens when you do copy-n-paste.
Fixed with a testcase.  

Tested on an i686-pc-linux. 

Thanks for your patience.

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/ChangeLog,v
retrieving revision 1.746
diff -p -r1.746 ChangeLog
*** ChangeLog	2001/08/14 21:06:48	1.746
--- ChangeLog	2001/08/14 23:29:18
***************
*** 1,3 ****
--- 1,9 ----
+ 2001-08-15  Gabriel Dos Reis  <gdr@merlin.codesourcery.com>
+ 
+ 	* testsuite/18_support/numeric_limits.cc: Add more tests.
+ 	* include/bits/std_limits.h (numeric_limits<char>::max): Fix
+ 	typo. 
+ 
  2001-08-14  Gabriel Dos Reis  <gdr@codesourcery.com>
  
  	* include/bits/std_limits.h: Fix thinko.
Index: include/bits/std_limits.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/std_limits.h,v
retrieving revision 1.3
diff -p -r1.3 std_limits.h
*** std_limits.h	2001/08/14 21:06:48	1.3
--- std_limits.h	2001/08/14 23:29:18
*************** namespace std
*** 1123,1129 ****
        static signed char min() throw()
        { return __glibcpp_signed_char_min; }
        static signed char max() throw()
!       { return __glibcpp_signed_char_min; }
  
        static const int digits = __glibcpp_signed_char_digits;
        static const int digits10 = __glibcpp_signed_char_digits10;
--- 1123,1129 ----
        static signed char min() throw()
        { return __glibcpp_signed_char_min; }
        static signed char max() throw()
!       { return __glibcpp_signed_char_max; }
  
        static const int digits = __glibcpp_signed_char_digits;
        static const int digits10 = __glibcpp_signed_char_digits10;
Index: testsuite/18_support/numeric_limits.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/testsuite/18_support/numeric_limits.cc,v
retrieving revision 1.5
diff -p -r1.5 numeric_limits.cc
*** numeric_limits.cc	2001/08/07 03:38:26	1.5
--- numeric_limits.cc	2001/08/14 23:29:18
***************
*** 21,30 ****
--- 21,88 ----
  // 18.2.1.1 template class numeric_limits
  
  #include <limits>
+ #include <limits.h>
+ #include <float.h>
  #include <testsuite_hooks.h>
  
+ template<typename T>
+ struct extrema {
+   static T min;
+   static T max;
+ };
+ 
+ 
+ #define DEFINE_EXTREMA(T, m, M) \
+   template<> T extrema<T>::min = m; \
+   template<> T extrema<T>::max = M
+ 
+ DEFINE_EXTREMA(char, CHAR_MIN, CHAR_MAX);
+ DEFINE_EXTREMA(signed char, SCHAR_MIN, SCHAR_MAX);
+ DEFINE_EXTREMA(unsigned char, 0, UCHAR_MAX);
+ DEFINE_EXTREMA(short, SHRT_MIN, SHRT_MAX);
+ DEFINE_EXTREMA(unsigned short, 0, USHRT_MAX);
+ DEFINE_EXTREMA(int, INT_MIN, INT_MAX);
+ DEFINE_EXTREMA(unsigned, 0U, UINT_MAX);
+ DEFINE_EXTREMA(long, LONG_MIN, LONG_MAX);
+ DEFINE_EXTREMA(unsigned long, 0UL, ULONG_MAX);
+ 
+ DEFINE_EXTREMA(float, FLT_MIN, FLT_MAX);
+ DEFINE_EXTREMA(double, DBL_MIN, DBL_MAX);
+ DEFINE_EXTREMA(long double, LDBL_MIN, LDBL_MAX);
+ 
+ #undef DEFINE_EXTREMA
  
  template<typename T>
+ void test_extrema()
+ {
+   VERIFY( extrema<T>::min == std::numeric_limits<T>::min() );
+   VERIFY( extrema<T>::max == std::numeric_limits<T>::max() );
+ }
+ 
+ #ifdef __CHAR_UNSIGNED__
+ #define char_is_signed false
+ #else
+ #define char_is_signed true
+ #endif
+ 
+ void test_sign()
+ {
+   VERIFY( std::numeric_limits<char>::is_signed == char_is_signed );
+   VERIFY( std::numeric_limits<signed char>::is_signed == true );
+   VERIFY( std::numeric_limits<unsigned char>::is_signed == false );
+   VERIFY( std::numeric_limits<short>::is_signed == true );
+   VERIFY( std::numeric_limits<unsigned short>::is_signed == false );
+   VERIFY( std::numeric_limits<int>::is_signed == true );
+   VERIFY( std::numeric_limits<unsigned>::is_signed == false );
+   VERIFY( std::numeric_limits<long>::is_signed == true );
+   VERIFY( std::numeric_limits<unsigned long>::is_signed == false );
+   VERIFY( std::numeric_limits<float>::is_signed == true );
+   VERIFY( std::numeric_limits<double>::is_signed == true );
+   VERIFY( std::numeric_limits<long double>::is_signed == true );
+ }
+ 
+ 
+ template<typename T>
    struct A 
    {
      int key;
*************** int main()
*** 96,100 ****
  {
    test01();
    test02();
!   return 0;
  }
--- 154,178 ----
  {
    test01();
    test02();
! 
!   test_extrema<char>();
!   test_extrema<signed char>();
!   test_extrema<unsigned char>();
!   
!   test_extrema<short>();
!   test_extrema<unsigned short>();
! 
!   test_extrema<int>();
!   test_extrema<unsigned>();
! 
!   test_extrema<long>();
!   test_extrema<unsigned long>();
! 
!   test_extrema<float>();
!   test_extrema<double>();
!   test_extrema<long double>();
! 
!   test_sign();
! 
!     return 0;
  }


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