https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69603

Harald Anlauf <anlauf at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gmx dot de

--- Comment #2 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Dominique d'Humieres from comment #1)
> The ICE occurred between revisions r219318 (2015-01-07, compiles) and
> r219477 (2015-01-12, ICE), possibly r219439. Reduced test

Reduced somewhat more:

PROGRAM prog
  implicit none
  TYPE object
     PROCEDURE(), POINTER, NOPASS :: f
  END TYPE object
  TYPE (object) :: o1
  CALL set_func(o1%f)
CONTAINS
  SUBROUTINE set_func(f)
    PROCEDURE(), POINTER :: f
  END SUBROUTINE set_func
END PROGRAM prog


Running under gdb, I find that in interface.c, function compare_parameter,
line 2008ff, the call to gfc_compare_interfaces has ppc->ts.interface==NULL:

  ppc = gfc_get_proc_ptr_comp (actual);
  if (ppc)
    {
      if (!gfc_compare_interfaces (formal, ppc->ts.interface, ppc->name, 0, 1,
                                   err, sizeof(err), NULL, NULL))
        {
          if (where)
            gfc_error ("Interface mismatch in dummy procedure %qs at %L: %s",
                       formal->name, &actual->where, err);
          return 0;
        }
    }


Possible fix (for the crash), untested:

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c     (revision 234170)
+++ gcc/fortran/interface.c     (working copy)
@@ -2006,7 +2006,7 @@
     }

   ppc = gfc_get_proc_ptr_comp (actual);
-  if (ppc)
+  if (ppc && ppc->ts.interface)
     {
       if (!gfc_compare_interfaces (formal, ppc->ts.interface, ppc->name, 0, 1,
                                   err, sizeof(err), NULL, NULL))

Reply via email to