public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <Tobias_Burnus@mentor.com>
To: Eric Botcazou <botcazou@adacore.com>, fortran <fortran@gcc.gnu.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch] Fix PR fortran/96983
Date: Wed, 10 Mar 2021 10:23:37 +0100	[thread overview]
Message-ID: <3ffe91c1-4da4-ecd9-1d16-c0135af1c3e9@mentor.com> (raw)
In-Reply-To: <5050796.fM2REodTD2@fomalhaut>

Hi,

On 08.03.21 17:25, Eric Botcazou wrote:
> AFAICS the code in build_round_expr implicitly assumes that __float128 exists,
> which is *not* the common case among 64-bit architectures since "long double"
> is generally already 128-bit for them.

Crossref: Introduced by the Patch for PR96711, https://gcc.gnu.org/pipermail/fortran/2020-August/054920.html

Its testcase causes the fails/this PR, hence, gfortran.dg/pr96711.f90 is the
testcase for this patch.

> Tested on x86-64/Linux and SPARC64/Linux, OK for the mainline?
>
> 2021-03-08  Eric Botcazou  <ebotcazou@adacore.com>
>
>       PR fortran/96983
>       * trans-intrinsic.c (build_round_expr): Do not implicitly assume
>       that __float128 is the 128-bit floating-point type.

I think it is a bad idea to hard-code the real type.
Does the following work for you? If so, I think that
patch is obvious and you can go ahead and commit it.

--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -407,7 +407,7 @@ build_round_expr (tree arg, tree restype)
        if (kind < 0)
         gfc_internal_error ("Could not find real kind with at least %d bits",
                             resprec);
-      arg = fold_convert (gfc_float128_type_node, arg);
+      arg = fold_convert (gfc_get_real_type (kind), arg);
        fn = gfc_builtin_decl_for_float_kind (BUILT_IN_ROUND, kind);
      }
    else

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

  reply	other threads:[~2021-03-10  9:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 16:25 Eric Botcazou
2021-03-10  9:23 ` Tobias Burnus [this message]
2021-03-10 11:34   ` Eric Botcazou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ffe91c1-4da4-ecd9-1d16-c0135af1c3e9@mentor.com \
    --to=tobias_burnus@mentor.com \
    --cc=botcazou@adacore.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).