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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot 
gnu.org
   Last reconfirmed|                            |2022-04-30
   Target Milestone|---                         |12.0
      Known to fail|                            |12.0, 13.0
            Summary|The floating point overload |[12/13 Regression] The
                   |of from_chars ignores 'P'   |floating point overload of
                   |for hex format              |from_chars ignores 'P' for
                   |                            |hex format

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Thanks for reporting and analyzing this!

(In reply to 康桓瑋 from comment #2)
> floating_from_chars.cc#L667
> 
> // Parse the written exponent.
> int written_exponent = 0;
> if (first != last && *first == 'p')
>   {
>     // Tentatively consume the 'p' and try to parse a decimal number.
>     const char* const fallback_first = first;
> 
> it seems like it should be
> 
> if (first != last && std::tolower((unsigned char)*first) == 'p')

I'm not sure we can use tolower here because it's locale dependent and charconv
isn't.  So we should just test for 'p' and 'P' directly.  And we should
probably replace the existing use of tolower in find_end_of_float.

I wonder why the SO user is seeing this bug with GCC 11.2?  The new hexfloat
parser (r12-6645-gcc3bf3404e4b1c) is GCC 12 only.

Reply via email to