This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/57871] gfortran -freal-4-real-16 gives wrong result for selected_real_kind(1)
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 01 Oct 2017 13:20:06 +0000
- Subject: [Bug fortran/57871] gfortran -freal-4-real-16 gives wrong result for selected_real_kind(1)
- Auto-submitted: auto-generated
- References: <bug-57871-4@http.gcc.gnu.org/bugzilla/>
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.