http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54387
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2012-09-12 AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org | Summary|Proc-pointer: Wronlgy |[F03] Wrongly accepts |accepts non-proc result |non-proc result variable on |variable on the RHS of a |the RHS of a proc-pointer |pointer assignment |assignment Ever Confirmed|0 |1 --- Comment #2 from janus at gcc dot gnu.org 2012-09-12 09:17:36 UTC --- Here is a draft patch which rejects the test case and is free of testsuite regressions: Index: gcc/fortran/expr.c =================================================================== --- gcc/fortran/expr.c (revision 190908) +++ gcc/fortran/expr.c (working copy) @@ -3430,6 +3430,14 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_ex gfc_resolve_intrinsic (sym, &rvalue->where); attr = gfc_expr_attr (rvalue); } + /* Check for result of embracing function. */ + if (sym == gfc_current_ns->proc_name + && sym->attr.function && sym->result == sym) + { + gfc_error ("Invalid proc-target in procedure pointer assignment " + "at %L", &rvalue->where); + return FAILURE; + } } if (attr.abstract) {