public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Fix build failure on AArch64 ILP32 [PR98370]
@ 2020-12-18 16:26 Patrick Palka
  2020-12-18 17:17 ` Patrick Palka
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Palka @ 2020-12-18 16:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Patrick Palka

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.
---
 libstdc++-v3/src/c++17/floating_to_chars.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/src/c++17/floating_to_chars.cc b/libstdc++-v3/src/c++17/floating_to_chars.cc
index 6470fbb0b95..3f46bce7a15 100644
--- a/libstdc++-v3/src/c++17/floating_to_chars.cc
+++ b/libstdc++-v3/src/c++17/floating_to_chars.cc
@@ -977,7 +977,7 @@ template<typename T>
 	// fd.exponent contain all of the information needed to format the
 	// number in fixed notation "as if by std::printf" (with precision
 	// equal to -fd.exponent).
-	const int whole_digits = max(mantissa_length + fd.exponent, 1);
+	const int whole_digits = max<int>(mantissa_length + fd.exponent, 1);
 	const int expected_output_length
 	  = fd.sign + whole_digits + strlen(".") + -fd.exponent;
 	if (last - first < expected_output_length)
-- 
2.30.0.rc0


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

* Re: [PATCH] libstdc++: Fix build failure on AArch64 ILP32 [PR98370]
  2020-12-18 16:26 [PATCH] libstdc++: Fix build failure on AArch64 ILP32 [PR98370] Patrick Palka
@ 2020-12-18 17:17 ` Patrick Palka
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick Palka @ 2020-12-18 17:17 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jonathan Wakely via Libstdc++

On Fri, Dec 18, 2020 at 11:26 AM Patrick Palka <ppalka@redhat.com> wrote:
>
> 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.

I went ahead and committed this patch under the "obvious" rule as r11-6260.

> ---
>  libstdc++-v3/src/c++17/floating_to_chars.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/src/c++17/floating_to_chars.cc b/libstdc++-v3/src/c++17/floating_to_chars.cc
> index 6470fbb0b95..3f46bce7a15 100644
> --- a/libstdc++-v3/src/c++17/floating_to_chars.cc
> +++ b/libstdc++-v3/src/c++17/floating_to_chars.cc
> @@ -977,7 +977,7 @@ template<typename T>
>         // fd.exponent contain all of the information needed to format the
>         // number in fixed notation "as if by std::printf" (with precision
>         // equal to -fd.exponent).
> -       const int whole_digits = max(mantissa_length + fd.exponent, 1);
> +       const int whole_digits = max<int>(mantissa_length + fd.exponent, 1);
>         const int expected_output_length
>           = fd.sign + whole_digits + strlen(".") + -fd.exponent;
>         if (last - first < expected_output_length)
> --
> 2.30.0.rc0
>


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

end of thread, other threads:[~2020-12-18 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18 16:26 [PATCH] libstdc++: Fix build failure on AArch64 ILP32 [PR98370] Patrick Palka
2020-12-18 17:17 ` Patrick Palka

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