[Bug fortran/57871] gfortran -freal-4-real-16 gives wrong result for selected_real_kind(1)

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Sun Oct 1 13:20:00 GMT 2017


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

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> The reason I sent that bug report is that I had read the manual and
> found that -freal-4-real-16 makes the available real kinds 8, 10, 16.
> The Fortran standard says selected_real_kind(1) must give the kind with
> the smallest available decimal precision that has precison at least 1. 
> In the circumstances that is kind 8. The manual refers to promotion of
> REAL(KIND=M) entities. Selected_real_kind is an integer entity not a
> real one.

AFAIU this is based on the expectation that the conversion options act as a
"pre-processor", i.e., take place before the compilation really starts. The
results show that expectation is not true and that the options act as a
"post-processor", i.e., the code is compiled as if the option was not provided,
then the conversion takes place.

selected_real_kind is probably the only function that can show the difference.

IMO this should be documented and the PR closed as WONTFIX.


More information about the Gcc-bugs mailing list