public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99355] New: -freal-X-real-Y -freal-Z-real-X promotes Z to Y
@ 2021-03-03  7:00 nickpapior at gmail dot com
  2021-03-03  7:00 ` [Bug fortran/99355] " nickpapior at gmail dot com
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: nickpapior at gmail dot com @ 2021-03-03  7:00 UTC (permalink / raw)
  To: gcc-bugs

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).

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-03-05  9:46 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03  7:00 [Bug fortran/99355] New: -freal-X-real-Y -freal-Z-real-X promotes Z to Y nickpapior at gmail dot com
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

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).