https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104587

            Bug ID: 104587
           Summary: Cygwin fails wide-character regex match to class
                    [[:xdigit:]]
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hbbroe...@t-online.de
  Target Milestone: ---

I believe I have analyzed a bug report from reddit (https://redd.it/sp52gq) to
be caused by the way libstdc++ builds on Cygwin.

The reported problem in a nutshell is that 

 regex_match(L"a", std::wregex(L"[[:xdigit:]]"))

erroneously evaluates to zero on current Cygwin, using GCC 11.2.0.  AFAICS this
happens because the cygwin target uses the generic version of ctype_members.cc,
when it almost certainly should be picking up the newlib edition instead.

As-is, the generic version of _M_initialize_ctype tries to set up its 16-bit
character class masks, but the type of the array it stores those in,
std::ctype_base::mask, is just a plain 8-bit char in
config/os/newlib/ctype_base.h.

In terms of configuration options, Cygwin currently combines

   os_include_dir=os/newlib

with 

   --enable-clocale-generic (by default)

and that fails to work.

Reply via email to