[Bug fortran/56261] [OOP] seg fault call procedure pointer on polymorphic array

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 9 15:53:00 GMT 2013


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

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 #7 from janus at gcc dot gnu.org 2013-02-09 15:52:55 UTC ---
Here is a patch which rejects comment 0 and 1:

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c    (revision 195915)
+++ gcc/fortran/interface.c    (working copy)
@@ -3202,6 +3202,13 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arg
              "at %L", &a->expr->where);
           return FAILURE;
         }
+
+      if (a->expr && a->expr->ts.type == BT_CLASS)
+        {
+          gfc_error ("Polymorphic argument requires an explicit interface "
+             "at %L", &a->expr->where);
+          return FAILURE;
+        }
     }

       return SUCCESS;


I think it's ok to throw an error (and not just a warning), because a
polymorphic actual arg can only be passed to a polymorphic formal arg, which is
invalid in connection with an implicit interface.



More information about the Gcc-bugs mailing list