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

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).