From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20682 invoked by alias); 9 Jul 2013 23:38:45 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 20657 invoked by uid 48); 9 Jul 2013 23:38:41 -0000 From: "john.harper at vuw dot ac.nz" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/57871] New: gfortran -freal-4-real-16 gives wrong result for selected_real_kind(1) Date: Tue, 09 Jul 2013 23:38:00 -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: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: john.harper at vuw dot ac.nz X-Bugzilla-Status: UNCONFIRMED 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 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-07/txt/msg00569.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57871 Bug ID: 57871 Summary: gfortran -freal-4-real-16 gives wrong result for selected_real_kind(1) Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: john.harper at vuw dot ac.nz 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. Same problem with -freal-4-real-10 giving real(10) instead of real(8). Evidence: cayley[~/Jfh] % cat testprecision.f90 implicit none integer,parameter:: p1 = selected_real_kind(1), dp = kind(1d0) print *,'kind(1.0_p1)',kind(1.0_p1),'precision(1.0_p1)',precision(1.0_p1) print *,'kind(1.0_dp)',kind(1.0_dp),'precision(1.0_dp)',precision(1.0_dp) end cayley[~/Jfh] % /local/scratch/gf/bin/gfortran -freal-4-real-16 -Wall -Wextra -fno-strict-aliasing -fwrapv testprecision.f90 cayley[~/Jfh] % ./a.out kind(1.0_p1) 16 precision(1.0_p1) 33 kind(1.0_dp) 8 precision(1.0_dp) 15 cayley[~/Jfh] % /local/scratch/gf/bin/gfortran -freal-4-real-10 -Wall -Wextra -fno-strict-aliasing -fwrapv testprecision.f90 cayley[~/Jfh] % ./a.out kind(1.0_p1) 10 precision(1.0_p1) 18 kind(1.0_dp) 8 precision(1.0_dp) 15 cayley[~/Jfh] % /local/scratch/gf/bin/gfortran -v Using built-in specs. COLLECT_GCC=/local/scratch/gf/bin/gfortran COLLECT_LTO_WRAPPER=/local/scratch/gf/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /local/scratch/gcc-4.8-20130530/configure --prefix=/local/scratch/gf --enable-languages=c,fortran --disable-libada --with-local-prefix=/local/scratch --with-gmp=/local/scratch Thread model: posix gcc version 4.8.1 20130530 (prerelease) (GCC) cayley[~/Jfh] %