aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-09-07 12:29:05 +0200
committerTobias Burnus <tobias@codesourcery.com>2020-09-07 12:30:11 +0200
commit2b0df0a6ac79b34f5fac4f3d456e8e14db220e4a (patch)
treebfab26a04edec139916a27476b2d98fe079bf2e8 /gcc/fortran/resolve.c
parentc9c87dc958a2ef3203cbdb88ed1b0575564a4279 (diff)
downloadgcc-2b0df0a6ac79b34f5fac4f3d456e8e14db220e4a.zip
gcc-2b0df0a6ac79b34f5fac4f3d456e8e14db220e4a.tar.gz
gcc-2b0df0a6ac79b34f5fac4f3d456e8e14db220e4a.tar.bz2
Fortran: Fixes for pointer function call as variable (PR96896)
gcc/fortran/ChangeLog: PR fortran/96896 * resolve.c (get_temp_from_expr): Also reset proc_pointer + use_assoc attribute. (resolve_ptr_fcn_assign): Use information from the LHS. gcc/testsuite/ChangeLog: PR fortran/96896 * gfortran.dg/ptr_func_assign_4.f08: Update dg-error. * gfortran.dg/ptr-func-3.f90: New test.
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index fc2431b..ebf89a9 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -11179,9 +11179,11 @@ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)
/* Add the attributes and the arrayspec to the temporary. */
tmp->n.sym->attr = gfc_expr_attr (e);
tmp->n.sym->attr.function = 0;
+ tmp->n.sym->attr.proc_pointer = 0;
tmp->n.sym->attr.result = 0;
tmp->n.sym->attr.flavor = FL_VARIABLE;
tmp->n.sym->attr.dummy = 0;
+ tmp->n.sym->attr.use_assoc = 0;
tmp->n.sym->attr.intent = INTENT_UNKNOWN;
if (as)
@@ -11601,7 +11603,7 @@ resolve_ptr_fcn_assign (gfc_code **code, gfc_namespace *ns)
return false;
}
- tmp_ptr_expr = get_temp_from_expr ((*code)->expr2, ns);
+ tmp_ptr_expr = get_temp_from_expr ((*code)->expr1, ns);
/* get_temp_from_expression is set up for ordinary assignments. To that
end, where array bounds are not known, arrays are made allocatable.