https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95879
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to sandra from comment #5)
> The ICE from the z1.90 example is gone on mainline now. I don't know if the
> error on y1.f90 is correct or not without further research.
y1.f90 is invalid code. However, gfortran's checking looks suspicious to me.
Rewriting the testcase slightly:
module m
implicit none
contains
integer function f(x) bind(c)
use iso_c_binding, only: c_funloc
real, intent(in) :: x
c_funloc(f) = x
f = 0
end
end
This would give:
pr95879-y1.f90:7:13:
7 | c_funloc(f) = x
| 1
Error: Function result 'f' at (1) is invalid as X argument to C_FUNLOC
I think this is wrong.
F2018: 18.2.3.5 C_FUNLOC (X)
Argument. X shall be a procedure; if it is a procedure pointer it shall be
associated. It shall not be a coindexed object.
Deactivating the related check in gfc_check_c_funloc, I get:
pr95879-y1.f90:7:4:
7 | c_funloc(f) = x
| 1
Error: The function result on the lhs of the assignment at (1) must have the
pointer attribute.
That looks like a more reasonable error.