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]

fix libstdc++/47387 AIX ctype mask override


Per bug 47387, the attached patch fixes the problem, found by the libstdc++ regression suite, where ctype mask override isn't working. It applies only to AIX.

The existing testcase '22_locale/ctype/is/char/3.cc' is sufficient to verify the fix.

   PR libstdc++/47387
   * config/os/aix/ctype_inline.h: Use _M_table if provided.

I have run the regression suite with this change on powerpc-ibm-aix5.3.0.0, verifying 4 multilib combinations: '', 'ppc64', 'pthread', and 'pthread/ppc64' in the 4.5.2 release code.

Index: libstdc++-v3/config/os/aix/ctype_inline.h
===================================================================
--- libstdc++-v3/config/os/aix/ctype_inline.h	(revision 169055)
+++ libstdc++-v3/config/os/aix/ctype_inline.h	(working copy)
@@ -39,14 +39,23 @@
   bool
   ctype<char>::
   is(mask __m, char __c) const
-  { return __OBJ_DATA(__lc_ctype)->mask[__c] & __m; }
+  { 
+    if(_M_table)
+      return _M_table[static_cast<unsigned char>(__c)] & __m;
+    else
+      return __OBJ_DATA(__lc_ctype)->mask[__c] & __m;
+  }
 
   const char*
   ctype<char>::
   is(const char* __low, const char* __high, mask* __vec) const
   {
-    while (__low < __high)
-      *__vec++ = __OBJ_DATA(__lc_ctype)->mask[*__low++];
+    if(_M_table)
+      while (__low < __high)
+	*__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
+    else
+      while (__low < __high)
+        *__vec++ = __OBJ_DATA(__lc_ctype)->mask[*__low++];
     return __high;
   }
 

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