From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 86A3D3857C68; Wed, 3 Mar 2021 07:00:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86A3D3857C68 From: "nickpapior at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nickpapior at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2021 07:00:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99355 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=3D50291&action=3Dedit 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=3D6)) :: r4 double precision :: d1 real*8 :: d2 real(8) :: d3 real(kind(1.d0)) :: d4 real(selected_real_kind(p=3D15)) :: 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 =3D=20 single 4 4 4 4 double 8 8 8 8 8 #FLAGS =3D -freal-4-real-8 single 8 8 8 8 double 8 8 8 8 8 #FLAGS =3D -freal-8-real-16 single 4 4 4 4 double 16 16 16 16 16 #FLAGS =3D -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).=