public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57871] New: gfortran -freal-4-real-16 gives wrong result for selected_real_kind(1)
@ 2013-07-09 23:38 john.harper at vuw dot ac.nz
  2013-07-10 13:07 ` [Bug fortran/57871] " dominiq at lps dot ens.fr
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: john.harper at vuw dot ac.nz @ 2013-07-09 23:38 UTC (permalink / raw)
  To: gcc-bugs

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] %


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

end of thread, other threads:[~2021-03-07 13:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-09 23:38 [Bug fortran/57871] New: gfortran -freal-4-real-16 gives wrong result for selected_real_kind(1) john.harper at vuw dot ac.nz
2013-07-10 13:07 ` [Bug fortran/57871] " dominiq at lps dot ens.fr
2013-07-10 17:42 ` kargl at gcc dot gnu.org
2013-07-10 20:02 ` sgk at troutmask dot apl.washington.edu
2013-07-10 21:31 ` harper at msor dot vuw.ac.nz
2013-07-11 22:30 ` harper at msor dot vuw.ac.nz
2013-07-11 22:51 ` sgk at troutmask dot apl.washington.edu
2013-11-25  0:59 ` kargl at gcc dot gnu.org
2021-03-04 11:59 ` dominiq at lps dot ens.fr
2021-03-05  9:43 ` cvs-commit at gcc dot gnu.org
2021-03-05  9:53 ` burnus at gcc dot gnu.org
2021-03-07 13:19 ` dominiq at lps dot ens.fr

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