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: p...@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) | ^~~