This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/71500] regex::icase only works on first character in a range
- From: "timshen at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 11 Jun 2016 07:59:09 +0000
- Subject: [Bug libstdc++/71500] regex::icase only works on first character in a range
- Auto-submitted: auto-generated
- References: <bug-71500-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71500
Tim Shen <timshen at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |timshen at gcc dot gnu.org
--- Comment #2 from Tim Shen <timshen at gcc dot gnu.org> ---
(In reply to Michael Duggan from comment #1)
> I can confirm this issue exists in debian's libstdc++-6-dev (6.1.1-5)
> package.
>
> I've done some tracing, and here is what I have been able to determine:
>
> (All of the below refers to functions in bits/regex_compiler.tcc.)
>
Thanks for the investigation!
I post a patch here: https://gcc.gnu.org/ml/libstdc++/2016-06/msg00012.html
> When std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, true,
> false>::_M_apply is called, _M_char_set contains just {'a'}, and
> _M_range_set contains {{first='A', second='F'}}.
This is not expected. _M_char_set should be empty, since in the bracket
expression there is only a range A-F. This is due to a bug where __last_char is
not defined correctly.
After fixing that, the output should be:
aaa : Nope
AAA : Match
fff : Nope
FFF : Match
, which is incorrect in an expected way :).
Then it's easy to fix - simply change _RegexTranslator::_M_transform to
consider icase first by calling _M_translate.