public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, committed] Fortran: call of overloaded ‘abs(long long int&)’ is ambiguous [PR109492]
@ 2023-04-13 20:56 Harald Anlauf
  0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2023-04-13 20:56 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

Dear all,

I've committed the attached patch which fixes a portability issue
when bootstrapping on Solaris.  Discussed and confirmed in the PR
by Jonathan for Solaris and regtested by me on x86_64-pc-linux-gnu.

https://gcc.gnu.org/g:43816633afd275a9057232a6ebfdc19e441f09ec

(Unfortunately the commit message contains Unicode characters
that I got by using copy&paste of the error message.  I wonder
if "git gcc-verify" could have warned me ...)

Thanks,
Harald


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr109492.patch --]
[-- Type: text/x-patch, Size: 1332 bytes --]

From 43816633afd275a9057232a6ebfdc19e441f09ec Mon Sep 17 00:00:00 2001
From: Harald Anlauf <anlauf@gmx.de>
Date: Thu, 13 Apr 2023 22:42:23 +0200
Subject: [PATCH] =?UTF-8?q?Fortran:=20call=20of=20overloaded=20=E2=80=98ab?=
 =?UTF-8?q?s(long=20long=20int&)=E2=80=99=20is=20ambiguous=20[PR109492]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

gcc/fortran/ChangeLog:

	PR fortran/109492
	* trans-expr.cc (gfc_conv_power_op): Use absu_hwi and
	unsigned HOST_WIDE_INT for portability.
---
 gcc/fortran/trans-expr.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 79367fa2ae0..09cdd9263c4 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -3400,11 +3400,12 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
       && TREE_CODE (TREE_TYPE (rse.expr)) == INTEGER_TYPE)
     {
       wi::tree_to_wide_ref wlhs = wi::to_wide (lse.expr);
-      HOST_WIDE_INT v, w;
+      HOST_WIDE_INT v;
+      unsigned HOST_WIDE_INT w;
       int kind, ikind, bit_size;

       v = wlhs.to_shwi ();
-      w = abs (v);
+      w = absu_hwi (v);

       kind = expr->value.op.op1->ts.kind;
       ikind = gfc_validate_kind (BT_INTEGER, kind, false);
--
2.35.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-13 20:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-13 20:56 [Patch, committed] Fortran: call of overloaded ‘abs(long long int&)’ is ambiguous [PR109492] Harald Anlauf

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