gfortran -freal-4-real-16

John Harper harper@msor.vuw.ac.nz
Fri Jul 5 00:35:00 GMT 2013


I have two problems with the -freal-4-real-16 option of gfortran.

(1) The man pages for both versions 4.7.2 and 4.8.1 on our Linux x86_64
system say -freal-4-real-16 is a valid option but the on-line manual
http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gfortran/Fortran-Dialect-Options.html#Fortran-Dialect-Options
and the corresponding one for version 4.7.2 do not include that option. 
Should it be added to the manuals?

(2) The option works with both versions, but I was a little surprised at
the output of the following program when using it.

The program :

implicit none
   integer,parameter:: k = selected_real_kind(1)
   real(k),parameter:: r = 1
   print *,'k           ',k
   print *,'kind(1.0)   ',kind(1.0)
   print *,'kind(1.0_4) ',kind(1.0_4)
   print *,'kind(1.0_16)',kind(1.0_16)
   print *,'kind(1.0_k) ',kind(1.0_k)
   print *,'kind(r)     ',kind(r)
end

The output (the same with both 4.7.2 and 4.8.1) :

  k                      4
  kind(1.0)             16
  kind(1.0_4)           16
  kind(1.0_16)          16
  kind(1.0_k)           16
  kind(r)               16

What surprised me is that k was 4 but every kind(1.0_something) was 16.
Should I have been surprised?

-- John Harper, School of Mathematics Statistics and Operations Research
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@vuw.ac.nz phone (+64)(4)463 5276 fax (+64)(4)463 5045



More information about the Gcc-help mailing list