public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
@ 2020-12-18 10:43 pexu@gcc-bugzilla.mail.kapsi.fi
  2020-12-18 13:55 ` [Bug libstdc++/98370] " acoplan at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: pexu@gcc-bugzilla.mail.kapsi.fi @ 2020-12-18 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98370
           Summary: libstdc++-v3/src/c++17/floating_to_chars.cc fails to
                    compile unless `int32_t' is `int'
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pexu@gcc-bugzilla.mail.kapsi.fi
  Target Milestone: ---
            Target: aarch64-*-elf

Hi.

Using GCC 11.0.0 20201218.

libstdc++-v3/src/c++17/floating_to_chars.cc:
 978         const int whole_digits = max(mantissa_length + fd.exponent, 1);

`mantissa_length' is `int' while `fd.exponent' is `int32_t'.  If targetting
e.g. AArch64 ILP32 `__INT32_TYPE__' is `long int' and this causes failure with
`max(const _Tp&, const _Tp&)'.

There appears to be no other problematic locations for AArch64 ILP32.


<...>libstdc++-v3/src/c++17/floating_to_chars.cc: In instantiation of
'std::to_chars_result std::__floating_to_chars_shortest(char*, char*, T,
std::chars_format) [with T = float]':
<...>libstdc++-v3/src/c++17/floating_to_chars.cc:1484:73:   required from here
<...>libstdc++-v3/src/c++17/floating_to_chars.cc:978:37: error: no matching
function for call to 'max(long int, int)'
  978 |         const int whole_digits = max(mantissa_length + fd.exponent, 1);
      |                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from <...>libstdc++-v3/include/bits/specfun.h:45,
                 from <...>libstdc++-v3/include/cmath:1927,
                 from <...>libstdc++-v3/src/c++17/floating_to_chars.cc:33:
<...>/libstdc++-v3/include/bits/stl_algobase.h:254:5: note: candidate:
'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/98370] libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
  2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
@ 2020-12-18 13:55 ` acoplan at gcc dot gnu.org
  2020-12-18 15:01 ` ppalka at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2020-12-18 13:55 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |acoplan at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2020-12-18

--- Comment #1 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Confirmed. Presumably started with g:3c57e692357c79ee7623dfc1586652aee2aefb8f?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/98370] libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
  2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
  2020-12-18 13:55 ` [Bug libstdc++/98370] " acoplan at gcc dot gnu.org
@ 2020-12-18 15:01 ` ppalka at gcc dot gnu.org
  2020-12-18 16:26 ` ppalka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-12-18 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/98370] libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
  2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
  2020-12-18 13:55 ` [Bug libstdc++/98370] " acoplan at gcc dot gnu.org
  2020-12-18 15:01 ` ppalka at gcc dot gnu.org
@ 2020-12-18 16:26 ` ppalka at gcc dot gnu.org
  2020-12-18 16:55 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-12-18 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2020-December/562287.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/98370] libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
  2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
                   ` (2 preceding siblings ...)
  2020-12-18 16:26 ` ppalka at gcc dot gnu.org
@ 2020-12-18 16:55 ` cvs-commit at gcc dot gnu.org
  2020-12-18 16:58 ` hp at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-18 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:22a7e82c200d01d12e34e757e86dc9796a9bf085

commit r11-6260-g22a7e82c200d01d12e34e757e86dc9796a9bf085
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Dec 18 11:52:24 2020 -0500

    libstdc++: Fix build failure on AArch64 ILP32 [PR98370]

    This should fix a build failure on AArch64 ILP32 due to int32_t mapping
    to long int instead of int on this platform, which causes type deduction
    to fail in the below call to std::max as reported in the PR.

    libstdc++-v3/ChangeLog:

            PR libstdc++/98370
            * src/c++17/floating_to_chars.cc (__floating_to_chars_shortest):
            Provide explicit template arguments to the call to std::max.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/98370] libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
  2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
                   ` (3 preceding siblings ...)
  2020-12-18 16:55 ` cvs-commit at gcc dot gnu.org
@ 2020-12-18 16:58 ` hp at gcc dot gnu.org
  2020-12-18 17:15 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hp at gcc dot gnu.org @ 2020-12-18 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
JFTR, likely all "32-bit targets".

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/98370] libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
  2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
                   ` (4 preceding siblings ...)
  2020-12-18 16:58 ` hp at gcc dot gnu.org
@ 2020-12-18 17:15 ` ppalka at gcc dot gnu.org
  2020-12-18 19:36 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-12-18 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Hans-Peter Nilsson from comment #4)
> JFTR, likely all "32-bit targets".

Thanks, and sorry about the build breakage.  I just committed the fix r11-6260
for this particular build failure.  Let me know if you're still seeing
problems.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/98370] libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
  2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
                   ` (5 preceding siblings ...)
  2020-12-18 17:15 ` ppalka at gcc dot gnu.org
@ 2020-12-18 19:36 ` redi at gcc dot gnu.org
  2020-12-18 23:49 ` hp at gcc dot gnu.org
  2020-12-23  4:16 ` hp at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2020-12-18 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Hans-Peter Nilsson from comment #4)
> JFTR, likely all "32-bit targets".

Not x86, that uses int for int32_t.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/98370] libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
  2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
                   ` (6 preceding siblings ...)
  2020-12-18 19:36 ` redi at gcc dot gnu.org
@ 2020-12-18 23:49 ` hp at gcc dot gnu.org
  2020-12-23  4:16 ` hp at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: hp at gcc dot gnu.org @ 2020-12-18 23:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #6)
> (In reply to Hans-Peter Nilsson from comment #4)
> > JFTR, likely all "32-bit targets".
> 
> Not x86, that uses int for int32_t.

So on closer inspection, all ILP32 newlib targets, by largest group.

(That is, plus assorted others that happen to set INT32_TYPE to "long int" by
other means than through newlib-stdint.h.)

Might be good to know the next time this happens.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/98370] libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int'
  2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
                   ` (7 preceding siblings ...)
  2020-12-18 23:49 ` hp at gcc dot gnu.org
@ 2020-12-23  4:16 ` hp at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: hp at gcc dot gnu.org @ 2020-12-23  4:16 UTC (permalink / raw)
  To: gcc-bugs

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

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
Good deed of the year: I'm closing this as it's fixed for cris-elf *and* I see
posted test-results for aarch64-elf/mabi=32 post r11-6260 (the fix), like
https://gcc.gnu.org/pipermail/gcc-testresults/2020-December/639753.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-12-23  4:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18 10:43 [Bug libstdc++/98370] New: libstdc++-v3/src/c++17/floating_to_chars.cc fails to compile unless `int32_t' is `int' pexu@gcc-bugzilla.mail.kapsi.fi
2020-12-18 13:55 ` [Bug libstdc++/98370] " acoplan at gcc dot gnu.org
2020-12-18 15:01 ` ppalka at gcc dot gnu.org
2020-12-18 16:26 ` ppalka at gcc dot gnu.org
2020-12-18 16:55 ` cvs-commit at gcc dot gnu.org
2020-12-18 16:58 ` hp at gcc dot gnu.org
2020-12-18 17:15 ` ppalka at gcc dot gnu.org
2020-12-18 19:36 ` redi at gcc dot gnu.org
2020-12-18 23:49 ` hp at gcc dot gnu.org
2020-12-23  4:16 ` hp at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).