[Bug libstdc++/51772] --enable-clocale=generic makes unsafe assumptions about ctype_base::mask

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 6 18:10:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51772

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-06
     Ever Confirmed|0                           |1
           Severity|normal                      |minor

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-06 18:10:04 UTC ---
I see the actual problem now, it's not as bad as I initially thought (it was
late at night when I started debugging this!)

The code in generic/ctype_members.cc assumes that each ctype_base::mask
constant will either be a single bit, or be the bitwise-or of other
ctype_base::mask constants, which works because e.g. if alnum is
upper|lower|digit, then do_is(alnum, L'c') will match on lower.

But netbsd defines ctype_base::xdigit as _N|_X where _N is ctype_base::digit
but _X corresponds to [A-Fa-f] and is not used in any other ctype_base::mask
constant, so the wide characters [A-Fa-f] cannot be matched by xdigit.

newlib similarly uses _X|_N for xdigit, but has --enable-clocale=newlib so
doesn't use the generic code.

bionic uses _X|_N but I don't think it supports wchar_t anyway

I believe vxworks and qnx would fail to match is(ctype::space, L' ') and
is(ctype::print, L' ') for similar reasons, if they support wchar_t



More information about the Gcc-bugs mailing list