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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |janus at gcc dot gnu.org
                   |gnu.org                     |

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


Something like:

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c    (revision 186596)
+++ gcc/fortran/interface.c    (working copy)
@@ -1663,6 +1667,13 @@ compare_parameter (gfc_symbol *formal, gfc_expr *a
        the module variables are generated.  */
     gfc_find_derived_vtab (actual->ts.u.derived);

+  if (formal->attr.flavor == FL_PROCEDURE && actual->ts.type != BT_PROCEDURE)
+    {
+      if (where)
+    gfc_error ("Procedure argument expected at %L", &actual->where);
+      return 0;
+    }
+  
   if (actual->ts.type == BT_PROCEDURE)
     {
       char err[200];


This correctly rejects the invalid code in comment #11 and makes the valid code
in comment #10 give the expected output (without segfaulting).

Reply via email to