[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 Oct 17 09:09:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51772
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
In config/locale/newlib/ctype_members.cc:
default:
// Different from the generic version, xdigit and print in
// newlib are defined as bitwise-OR result of bitmasks:
// xdigit = _X | _N;
// print = _P | _U | _L | _N | _B;
// in which _X and _B don't correspond to any ctype mask.
// In order to get the wmask correctly converted when __m is
// equal to _X or _B, the two cases are specifically handled
// here.
if (__m & xdigit)
__ret = wctype("xdigit");
else if (__m & print)
__ret = wctype("print");
else
__ret = __wmask_type();
}
This doesn't only apply to the masks defined in config/os/newlib/ctype_base.h,
but also netbsd and openbsd and bionic.
Something similar is also needed for qnx, as config/os/qnx/qnx6.1/ctype_base.h
uses several bitmasks that do not correspond to any ctype, e.g. _XA, _SP, _XS,
_XB
More information about the Gcc-bugs
mailing list