[Patch] PR fortran/100218 - target of pointer from evaluation of function-reference

Harald Anlauf anlauf@gmx.de
Thu Apr 22 20:25:05 GMT 2021


Dear Fortranners,

while analyzing a different PR (PR100154), Tobias pointed out that the
target of a pointer from the evaluation of function-reference is allowed
to be used in a variable definition context and thus as an actual
argument to a function or subroutine.

This seems to be a more general issue that seems to have been overlooked.
The attached simple patch allows to compile and run the attached example,
which is by the way already yet rejected with -std=f2003.

Regtested on x86_64-pc-linux-gnu.  OK for mainline?
Shall we backport this to (at least) 11?

Thanks,
Harald


Fortran - allow target of pointer from evaluation of function-reference

Fortran allows the target of a pointer from the evaluation of a
function-reference in a variable definition context (e.g. F2018:R902).

gcc/fortran/ChangeLog:

	PR fortran/100218
	* expr.c (gfc_check_vardef_context): Extend check to allow pointer
	from a function reference.

gcc/testsuite/ChangeLog:

	PR fortran/100218
	* gfortran.dg/pr100218.f90: New test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr100218.patch
Type: text/x-patch
Size: 1334 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210422/f060d62a/attachment.bin>


More information about the Gcc-patches mailing list