http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56968
--- Comment #7 from janus at gcc dot gnu.org 2013-04-16 08:50:35 UTC ---
(In reply to comment #6)
> > I think you should directly use
> >
> > if (rvalue->value.function.esym)
> > s2 = rvalue->value.function.esym->result;
>
> yes, I also thought about this variant. Might indeed be the better choice.
Ok, I have verified that this also regtests cleanly and fixes the test case (as
expected). Will commit the following patch later today (unless further
suggestions come up):
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c (revision 197988)
+++ gcc/fortran/expr.c (working copy)
@@ -3540,7 +3540,11 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_ex
}
else if (rvalue->expr_type == EXPR_FUNCTION)
{
- s2 = rvalue->symtree->n.sym->result;
+ if (rvalue->value.function.esym)
+ s2 = rvalue->value.function.esym->result;
+ else
+ s2 = rvalue->symtree->n.sym->result;
+
name = s2->name;
}
else