https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105012
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #10)
> likely triggered by the INTENT(out), it looks like gfortran fails to properly
> name-lookup a variable of the same name as the function? The intent is
> likely
> to have the return value assigned by CALERF_r8. So it also looks like
> gfortran miscompiles such testcase.
>
> The following sketches a miscompiled testcase (but my fortran fu is too weak
> to make it compile)
>
> PROCEDURE Y (Z)
> real(8), intent(out) :: Z
> Z = 1.
> END PROCEDURE Y
> FUNCTION X
> real(8) :: X
> CALL Y (X)
> END FUNCTION X
> PROGRAM TEST
> real(8) :: Z
> Z = X();
> if (Z.ne.1.) STOP 1
> END
SUBROUTINE Y (Z)
real(8), intent(out) :: Z
Z = 1.
END SUBROUTINE Y
FUNCTION X()
real(8) :: X
CALL Y (X)
END FUNCTION X
PROGRAM TEST
real(8) :: Z
Z = X();
if (Z.ne.1.) STOP 1
END PROGRAM
but still
t.f90:11:9:
11 | Z = X();
| 1
Error: Return type mismatch of function 'x' at (1) (REAL(4)/REAL(8))