[Patch, Fortran, F08] PR 85537: Invalid memory reference at runtime when calling subroutine through procedure pointer
Thomas Koenig
tkoenig@netcologne.de
Wed Mar 27 21:54:00 GMT 2019
Hi Janus,
> the attached patch implements some missing constraints from Fortran
> 2008 concerning procedure pointer initialization (cf. the standard
> quote in comment #18), thus fixing two accepts-invalid and
> ICE-on-invalid problems.
I do not think this is correct.
F2008:
# 12.2.2.4 Procedure pointers
# A procedure pointer is a procedure that has the EXTERNAL and POINTER
# attributes; it may be pointer associated with an external procedure, #
# an internal procedure, [...]
So a procedure pointer can be associated with an internal procedure.
Comment#18 from the PR does not quote anything that says that
a procedure pointer cannot be associated with an internal procedure.
Also, for clarification, see Note 12.8, which states
# An internal procedure cannot be invoked using a procedure pointer from
# either Fortran or C after the host instance completes execution,
# because the pointer is then undefined. While the host instance is
# active, however, the internal procedure may be invoked from outside of
# the host procedure scoping unit if that internal procedure was passed
# as an actual argument or is the target of a procedure pointer.
So, we have to support this.
Regards
Thomas
More information about the Fortran
mailing list