[Bug fortran/95640] gfortran ieee_selected_real_kind returns 10

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 11 14:56:58 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95640

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
         Depends on|                            |69101

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to Bill Long from comment #0)
> > cat test.f90

> Gfortran: 
> 
> > module swap PrgEnv-intel PrgEnv-gnu
> > gfortran test.f90
> > ./a.out
>      selected_real_kind(16) = 10
> ieee_selected_real_kind(16) = 10
> 
> The output from gfortran is problematic because ieee_selected_real_kind
> should not return 10.   If the users want KIND=10 (i.e. the
> Intel-proprietary 80-bit x87 floats), then they need to use
> selected_real_kind and not the IEEE version.

IEEE-754 permits the extended double type (See 3.7 Extended and
extendable precisions).  I do not see in the Fortran standard that
the output from ieee_seleted_real_kind must select binary32,
binary64, or binary128.

That said, ieee_selected_real_kind is completely broken.
See PR69101.  I used to have patch that fixed this PR,
but never got around to committing it.  The patch attached
in 69101 is not correct.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69101
[Bug 69101] [F03] IEEE_SELECTED_REAL_KIND is not generic


More information about the Gcc-bugs mailing list