diff options
author | Harald Anlauf <anlauf@gmx.de> | 2021-04-24 20:38:06 +0200 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2021-04-24 20:39:14 +0200 |
commit | 32c4d970ea3a9fc330d6aa8fd83f9dae0b9afc64 (patch) | |
tree | 7867cd89d0b0c7451755945496cb74b1cd23b6c6 /gcc/fortran/expr.c | |
parent | a1765b421eb3d01ecc88fb0cdec9f06bfdaab8e2 (diff) | |
download | gcc-32c4d970ea3a9fc330d6aa8fd83f9dae0b9afc64.zip gcc-32c4d970ea3a9fc330d6aa8fd83f9dae0b9afc64.tar.gz gcc-32c4d970ea3a9fc330d6aa8fd83f9dae0b9afc64.tar.bz2 |
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/ptr-func-4.f90: New test.
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 92a6700..956003e 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -6121,7 +6121,9 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, } if (!pointer && sym->attr.flavor != FL_VARIABLE && !(sym->attr.flavor == FL_PROCEDURE && sym == sym->result) - && !(sym->attr.flavor == FL_PROCEDURE && sym->attr.proc_pointer)) + && !(sym->attr.flavor == FL_PROCEDURE && sym->attr.proc_pointer) + && !(sym->attr.flavor == FL_PROCEDURE + && sym->attr.function && sym->attr.pointer)) { if (context) gfc_error ("%qs in variable definition context (%s) at %L is not" |