diff mbox

[fortran] PR69603 - ICE: segfault with -fimplicit-none and proc_ptr_comp_24.f90

Message ID 56F4FF2D.9020904@gmx.de
State New
Headers show

Commit Message

Harald Anlauf March 25, 2016, 9:04 a.m. UTC
Hi,

the above ICE is fixed by the following simple/trivial fix:



Regtested with no new failures on i686-pc-linux-gnu.
Whoever wants to take it...

Cheers,
Harald
diff mbox

Patch

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c	(revision 234170)
+++ gcc/fortran/interface.c	(working copy)
@@ -2006,7 +2006,7 @@  compare_parameter (gfc_symbol *formal, gfc_expr *a
     }

   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))


Suggested testcase:

Index: gcc/testsuite/gfortran.dg/pr69603.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr69603.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/pr69603.f90	(revision 0)
@@ -0,0 +1,15 @@ 
+! { dg-do compile }
+! PR fortran/69603 - segfault with -fimplicit-none and proc_ptr_comp_24.f90
+! Based on reduced testcase by Dominique d'Humieres
+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