[Bug libstdc++/124015] regex_traits::lookup_classname returns ctype_base::alpha for "graph" with icase=true
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 9 11:50:57 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124015
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:5de2b42cebaa2f1455034a47e25ff7b9eaf0a2be
commit r15-10929-g5de2b42cebaa2f1455034a47e25ff7b9eaf0a2be
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Feb 5 17:32:23 2026 +0000
libstdc++: Fix std::regex_traits::lookup_classname [PR124015]
This fixes a bug in regex_traits::lookup_classname(f, l, true) where the
result was always ctype_base::alpha for any input sequence [f, l) that
has the ctype_base::lower or ctype_base::upper bits set. For targets
that define alpha as lower|upper (rather than having a distinct bit for
alpha) this bug meant that all masks which have lower or upper bits set
were replaced with alpha when the icase parameter is true. This has the
effect that trying to do a case insensitive match for [:alnum:],
[:graph:], or [:print:] was equivalent to matching [:alpha:] instead,
which is obviously not correct.
Based on inspection of the ctype_base.h files under the config/os
directory, the bug appears to affect newlib, picolibc, qnx and vxworks.
libstdc++-v3/ChangeLog:
PR libstdc++/124015
* include/bits/regex.tcc (regex_traits::lookup_classname): Fix
handling of icase parameter.
Reviewed-by: Tomasz KamiÅski <tkaminsk@redhat.com>
(cherry picked from commit 49d219a5d7a8ad570992a4065268b58a581b7d9f)
More information about the Gcc-bugs
mailing list