http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45521

--- Comment #13 from janus at gcc dot gnu.org 2012-04-25 12:29:55 UTC ---
(In reply to comment #12)
> > For for former, we clearly need to add a check in 'compare_parameter' to
> > reject it

Actually, we do have a check for this already, which is just not working in
some cases. Therefore the patch in comment #12 is not the right thing to do.
Here is a better one (which is actually free of testsuite regressions):

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c    (revision 186596)
+++ gcc/fortran/interface.c    (working copy)
@@ -2393,9 +2397,8 @@ compare_actual_formal (gfc_actual_arglist **ap, gf

       /* Satisfy 12.4.1.2 by ensuring that a procedure actual argument is
      provided for a procedure formal argument.  */
-      if (a->expr->ts.type != BT_PROCEDURE && !gfc_is_proc_ptr_comp (a->expr,
NULL)
-      && a->expr->expr_type == EXPR_VARIABLE
-      && f->sym->attr.flavor == FL_PROCEDURE)
+      if (f->sym->attr.flavor == FL_PROCEDURE
+      && gfc_expr_attr (a->expr).flavor != FL_PROCEDURE)
     {
       if (where)
         gfc_error ("Expected a procedure for argument '%s' at %L",



Cleanup side note: A lot of the stuff in 'compare_actual_formal' could probably
be moved into 'compare_parameter'. It does not really make a difference, but
the distinction of what goes where seems completely arbitrary right now.

Reply via email to