public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/96711] Internal Compiler Error on NINT() Function
Date: Wed, 19 Aug 2020 22:04:13 +0000 [thread overview]
Message-ID: <bug-96711-4-RfW5VrzOzh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96711-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96711
--- Comment #9 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Aug 19, 2020 at 09:36:32PM +0000, anlauf at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96711
>
> --- Comment #8 from anlauf at gcc dot gnu.org ---
> A very quick hack seems to solve the issue for me. For some reason the
> final fold_convert seems to create a problem. Does anybody know why?
> It there a shorter solution?
>
> diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
> index 2483f016d8e..deb3030b75d 100644
> --- a/gcc/fortran/trans-intrinsic.c
> +++ b/gcc/fortran/trans-intrinsic.c
> @@ -395,11 +395,26 @@ build_round_expr (tree arg, tree restype)
> fn = builtin_decl_for_precision (BUILT_IN_LROUND, argprec);
> else if (resprec <= LONG_LONG_TYPE_SIZE)
> fn = builtin_decl_for_precision (BUILT_IN_LLROUND, argprec);
> + else if (resprec >= argprec && resprec == 128)
> + {
> + /* Search for a real kind suitable as temporary for conversion. */
> + int kind = -1;
> + for (int i = 0; kind < 0 && gfc_real_kinds[i].kind != 0; i++)
> + if (gfc_real_kinds[i].mode_precision >= resprec)
> + kind = gfc_real_kinds[i].kind;
> + 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);
> + fn = gfc_builtin_decl_for_float_kind (BUILT_IN_ROUND, kind);
> + }
> else
> gcc_unreachable ();
>
> - return fold_convert (restype, build_call_expr_loc (input_location,
> - fn, 1, arg));
> + return convert (restype, build_call_expr_loc (input_location,
> + fn, 1, arg));
> + /* return fold_convert (restype, build_call_expr_loc (input_location, */
> + /* fn, 1, arg)); */
> }
I tried an even uglier hack, and also got stumped by GIMPLE.
Jakub can probably shed some light on how to handle
quad precision and GIMPLE.
next prev parent reply other threads:[~2020-08-19 22:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-19 15:18 [Bug fortran/96711] New: " bre08 at eggen dot co.uk
2020-08-19 15:21 ` [Bug fortran/96711] " bre08 at eggen dot co.uk
2020-08-19 15:25 ` bre08 at eggen dot co.uk
2020-08-19 15:26 ` bre08 at eggen dot co.uk
2020-08-19 17:28 ` kargl at gcc dot gnu.org
2020-08-19 18:12 ` kargl at gcc dot gnu.org
2020-08-19 19:37 ` anlauf at gcc dot gnu.org
2020-08-19 20:11 ` toon at moene dot org
2020-08-19 21:36 ` anlauf at gcc dot gnu.org
2020-08-19 22:04 ` sgk at troutmask dot apl.washington.edu [this message]
2020-08-20 13:47 ` bre08 at eggen dot co.uk
2020-08-20 15:39 ` sgk at troutmask dot apl.washington.edu
2020-08-20 15:54 ` bre08 at eggen dot co.uk
2020-08-20 16:58 ` sgk at troutmask dot apl.washington.edu
2020-08-25 20:29 ` anlauf at gcc dot gnu.org
2020-09-07 19:42 ` cvs-commit at gcc dot gnu.org
2020-10-07 7:19 ` schwab@linux-m68k.org
2020-10-07 14:53 ` sgk at troutmask dot apl.washington.edu
2020-10-07 14:59 ` schwab@linux-m68k.org
2020-10-07 15:22 ` kargl at gcc dot gnu.org
2020-10-07 15:26 ` schwab@linux-m68k.org
2020-10-07 21:32 ` anlauf at gcc dot gnu.org
2021-05-20 8:12 ` burnus at gcc dot gnu.org
2021-05-20 9:21 ` bernd.eggen at gmail dot com
2021-07-23 19:59 ` anlauf at gcc dot gnu.org
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=bug-96711-4-RfW5VrzOzh@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@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).