public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/109186] nearest(huge(x),-1.0_kind(x)) half of correct value
Date: Sun, 19 Mar 2023 19:30:13 +0000	[thread overview]
Message-ID: <bug-109186-4-pCiqZ6fvc6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109186-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109186

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-03-19
           Keywords|                            |wrong-code

--- Comment #3 from anlauf at gcc dot gnu.org ---
Confirmed.

This is a compile-time issue.  When the first argument of NEAREST is a
variable and not a constant expression, I get the correct result:

program p
  real, parameter :: x = huge(1.0)
  real :: y, z
  y = x
  z = nearest (y, -1.0)
  print *, nearest (x, -1.0), z
end

This prints:

   1.70141173E+38   3.40282326E+38

Seems to affect all versions at least down to 7.

  parent reply	other threads:[~2023-03-19 19:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19  1:46 [Bug fortran/109186] New: " john.harper at vuw dot ac.nz
2023-03-19  5:06 ` [Bug fortran/109186] " jvdelisle at gcc dot gnu.org
2023-03-19  8:47 ` john.harper at vuw dot ac.nz
2023-03-19 19:30 ` anlauf at gcc dot gnu.org [this message]
2023-03-19 19:58 ` anlauf at gcc dot gnu.org
2023-03-19 20:45 ` anlauf at gcc dot gnu.org
2023-03-20 17:46 ` cvs-commit at gcc dot gnu.org
2023-03-22 18:00 ` cvs-commit at gcc dot gnu.org
2023-03-24 18:41 ` cvs-commit at gcc dot gnu.org
2023-03-24 18:44 ` cvs-commit at gcc dot gnu.org
2023-03-24 18:46 ` 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-109186-4-pCiqZ6fvc6@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).