public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/57871] gfortran -freal-4-real-16 gives wrong result for selected_real_kind(1)
Date: Wed, 10 Jul 2013 17:42:00 -0000 [thread overview]
Message-ID: <bug-57871-4-QUxd12VTD0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57871-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57871
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Last reconfirmed| |2013-07-10
CC| |kargl at gcc dot gnu.org
Resolution|INVALID |---
Ever confirmed|0 |1
--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #1)
> > gfortran 4.8.1 -freal-4-real-16 gives real(16) kind with
> > selected_real_kind(1) but it ought to give real(8) because that is
> > the smallest decimal precision available with that compiler option.
>
> and your example does exactly that: Closing as INVALID.
I think that you may have been a little too hasty in closing
this PR. The issue lies in the code for selected_real_kind.
implicit none
integer,parameter:: p1 = selected_real_kind(1)
This initialization expression is requesting the type with
smallest precision that exceeds 1. With -freal-4-real-16,
that type is double precision (ie kind=8). The problem
lies in gfc_simplify_selected_real_kind. It has no knowledge
of the -freal-*-real-* options. The loop (lines 5447-5457)
for (i = 0; gfc_real_kinds[i].kind != 0; i++)
{
if (gfc_real_kinds[i].precision >= precision)
found_precision = 1;
if (gfc_real_kinds[i].range >= range)
found_range = 1;
if (gfc_real_kinds[i].radix >= radix)
found_radix = 1;
if (gfc_real_kinds[i].precision >= precision
&& gfc_real_kinds[i].range >= range
&& gfc_real_kinds[i].radix >= radix && gfc_real_kinds[i].kind < kind)
kind = gfc_real_kinds[i].kind;
}
searchs the ordered set [24, 53, 53, 113] (on FreeBSD-i386) or
[24, 53, 64, 113] (on FreeBSD-amd64). In either case, the
initialization expression returns REAL(4). However, with
-freal-4-real-16, one might expect the ordered set to be
searched is [113, 53, 64, 113] as REAL(4) has been promoted
to REAL(16).
next prev parent reply other threads:[~2013-07-10 17:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-09 23:38 [Bug fortran/57871] New: " john.harper at vuw dot ac.nz
2013-07-10 13:07 ` [Bug fortran/57871] " dominiq at lps dot ens.fr
2013-07-10 17:42 ` kargl at gcc dot gnu.org [this message]
2013-07-10 20:02 ` sgk at troutmask dot apl.washington.edu
2013-07-10 21:31 ` harper at msor dot vuw.ac.nz
2013-07-11 22:30 ` harper at msor dot vuw.ac.nz
2013-07-11 22:51 ` sgk at troutmask dot apl.washington.edu
2013-11-25 0:59 ` kargl at gcc dot gnu.org
2021-03-04 11:59 ` dominiq at lps dot ens.fr
2021-03-05 9:43 ` cvs-commit at gcc dot gnu.org
2021-03-05 9:53 ` burnus at gcc dot gnu.org
2021-03-07 13:19 ` dominiq at lps dot ens.fr
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-57871-4-QUxd12VTD0@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).