From patchwork Mon Jan 24 18:47:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: fix libstdc++/47387 AIX ctype mask override Date: Mon, 24 Jan 2011 08:47:49 -0000 From: Graham Reed X-Patchwork-Id: 80228 Message-Id: <4D3DC955.8060207@pobox.com> To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org 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:: is(mask __m, char __c) const - { return __OBJ_DATA(__lc_ctype)->mask[__c] & __m; } + { + if(_M_table) + return _M_table[static_cast(__c)] & __m; + else + return __OBJ_DATA(__lc_ctype)->mask[__c] & __m; + } const char* ctype:: 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(*__low++)]; + else + while (__low < __high) + *__vec++ = __OBJ_DATA(__lc_ctype)->mask[*__low++]; return __high; }