public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* fix libstdc++/47387 AIX ctype mask override
@ 2011-01-24 18:54 Graham Reed
  2011-01-24 20:39 ` Paolo Carlini
  0 siblings, 1 reply; 2+ messages in thread
From: Graham Reed @ 2011-01-24 18:54 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

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.


[-- Attachment #2: gcc-r169055-aix-ctype_inline.patch --]
[-- Type: text/x-patch, Size: 956 bytes --]

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;
   }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: fix libstdc++/47387 AIX ctype mask override
  2011-01-24 18:54 fix libstdc++/47387 AIX ctype mask override Graham Reed
@ 2011-01-24 20:39 ` Paolo Carlini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Carlini @ 2011-01-24 20:39 UTC (permalink / raw)
  To: Graham Reed; +Cc: libstdc++, gcc-patches

On 01/24/2011 07:47 PM, Graham Reed wrote:
> 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.
>
Excellent. I think the path is fine for mainline, I can take care of
applying it. Note the ChangeLog entry should mention the touched
functions, thus, I would say, concisely:

    PR libstdc++/47387
    * config/os/aix/ctype_inline.h (ctype<char>::is): Use _M_table if
provided.

Thanks,
Paolo.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-24 19:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-24 18:54 fix libstdc++/47387 AIX ctype mask override Graham Reed
2011-01-24 20:39 ` Paolo Carlini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).