public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nickpapior at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/99355] New: -freal-X-real-Y -freal-Z-real-X promotes Z to Y
Date: Wed, 03 Mar 2021 07:00:03 +0000	[thread overview]
Message-ID: <bug-99355-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 99355
           Summary: -freal-X-real-Y -freal-Z-real-X promotes Z to Y
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nickpapior at gmail dot com
  Target Milestone: ---

Created attachment 50291
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50291&action=edit
Same as code snippet

I came about this in LAPACK which allows compiling in quad precision.

However, mixed precision algorithms will no longer be mixed precision since
*everything* gets promoted.

See this code snippet (and attached as well):

program test
  real :: r1
  real*4:: r2
  real(4) :: r3
  real(selected_real_kind(p=6)) :: r4

  double precision :: d1
  real*8 :: d2
  real(8) :: d3
  real(kind(1.d0)) :: d4
  real(selected_real_kind(p=15)) :: d5

  print '(tr3,a10,10(tr1,i2))', 'single', kind(r1), kind(r2), kind(r3),
kind(r4)
  print '(tr3,a10,10(tr1,i2))', 'double', kind(d1), kind(d2), kind(d3),
kind(d4), kind(d5)
end program test


Here listed with 4 different flag combinations:

#FLAGS = 
       single  4  4  4  4
       double  8  8  8  8  8
#FLAGS = -freal-4-real-8
       single  8  8  8  8
       double  8  8  8  8  8
#FLAGS = -freal-8-real-16
       single  4  4  4  4
       double 16 16 16 16 16
#FLAGS = -freal-8-real-16 -freal-4-real-8 (order doesn't matter)
       single  8 16 16 16
       double 16 16 16 16 16

The first 3 flag combinations works as intended.
The last one behaves bad.

I would have expected 8->16 and 4->8 (without double promotion).

             reply	other threads:[~2021-03-03  7:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  7:00 nickpapior at gmail dot com [this message]
2021-03-03  7:00 ` [Bug fortran/99355] " nickpapior at gmail dot com
2021-03-03  8:31 ` rguenth at gcc dot gnu.org
2021-03-03  9:16 ` nickpapior at gmail dot com
2021-03-03 14:38 ` burnus at gcc dot gnu.org
2021-03-03 20:39 ` nickpapior at gmail dot com
2021-03-04  7:20 ` cvs-commit at gcc dot gnu.org
2021-03-04  7:20 ` burnus at gcc dot gnu.org
2021-03-04 12:02 ` dominiq at lps dot ens.fr
2021-03-04 12:37 ` burnus at gcc dot gnu.org
2021-03-04 13:03 ` dominiq at lps dot ens.fr
2021-03-04 14:01 ` burnus at gcc dot gnu.org
2021-03-04 14:13 ` burnus at gcc dot gnu.org
2021-03-04 14:41 ` dominiq at lps dot ens.fr
2021-03-04 16:04 ` burnus at gcc dot gnu.org
2021-03-04 16:24 ` dominiq at lps dot ens.fr
2021-03-04 22:32 ` burnus at gcc dot gnu.org
2021-03-05  9:43 ` cvs-commit at gcc dot gnu.org
2021-03-05  9:46 ` burnus 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-99355-4@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).