This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[v3] Generic bits for 11844/11740


Hi,

Andreas noticed a couple of regressions on Darwin:
FAIL: 22_locale/ctype/is/char/1.cc execution test
FAIL: 22_locale/ctype/scan/char/1.cc execution test


Indeed, the generic ctype_inline.h needed the same treatment that
ctype<wchar_t>::do_is received for 11740.

Tested powerpc-apple-darwin6.3 (and i686-pc-linux-gnu to be safe),
committed.

Paolo.

/////////
2003-10-12  Andreas Tobler  <a.tobler@schweiz.ch>
	    Paolo Carlini  <pcarlini@unitus.it>

	PR libstdc++/11844/11740 (cont)
	* config/os/generic/ctype_inline.h (ctype<char>::is):
	Generically, use a bitmasksize of 15 (instead of 10);
	Fix the logic to actually return (M & m) != 0 as per
	22.2.1.1.2.
diff -urN libstdc++-v3-orig/config/os/generic/ctype_inline.h libstdc++-v3/config/os/generic/ctype_inline.h
--- libstdc++-v3-orig/config/os/generic/ctype_inline.h	2003-09-25 18:37:23.000000000 +0200
+++ libstdc++-v3/config/os/generic/ctype_inline.h	2003-10-12 09:17:18.000000000 +0200
@@ -49,16 +49,14 @@
       return _M_table[static_cast<unsigned char>(__c)] & __m;
     else
       {
-	bool __ret = true;
-	bool __any_match = false;
-	const size_t __bitmasksize = 10; 
+	bool __ret = false;
+	const size_t __bitmasksize = 15; 
 	size_t __bitcur = 0; // Lowest bitmask in ctype_base == 0
-	for (;__ret && __bitcur <= __bitmasksize; ++__bitcur)
+	for (; __bitcur <= __bitmasksize; ++__bitcur)
 	  {
-	    mask __bit = static_cast<mask>(1 << __bitcur);
+	    const mask __bit = static_cast<mask>(1 << __bitcur);
 	    if (__m & __bit)
 	      {
-		__any_match = true;
 		bool __testis;
 		switch (__bit)
 		  {
@@ -99,10 +97,10 @@
 		    __testis = false;
 		    break;
 		  }
-		__ret &= __testis;
+		__ret |= __testis;
 	      }
 	  }
-	return __ret & __any_match;
+	return __ret;
       }
   }
    
@@ -116,7 +114,7 @@
     else
       {
 	// Highest bitmask in ctype_base == 10.
-	const size_t __bitmasksize = 10; 
+	const size_t __bitmasksize = 15; 
 	for (;__low < __high; ++__vec, ++__low)
 	  {
 	    mask __m = 0;
@@ -124,7 +122,7 @@
 	    size_t __i = 0; 
 	    for (;__i <= __bitmasksize; ++__i)
 	      {
-		mask __bit = static_cast<mask>(1 << __i);
+		const mask __bit = static_cast<mask>(1 << __i);
 		if (this->is(__bit, *__low))
 		  __m |= __bit;
 	      }

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