re PR fortran/69603 (ICE: segfault with -fimplicit-none and proc_ptr_comp_24.f90)
authorHarald Anlauf <anlauf@gmx.de>
Sun, 15 May 2016 18:34:57 +0000 (18:34 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 15 May 2016 18:34:57 +0000 (18:34 +0000)
2016-05-15  Harald Anlauf  <anlauf@gmx.de>

PR fortran/69603
* interface.c (compare_parameter): Check for non-NULL pointer.

2016-05-15  Harald Anlauf  <anlauf@gmx.de>

PR fortran/69603
* gfortran.dg/pr69603.f90: New testcase.

From-SVN: r236253

gcc/fortran/ChangeLog
gcc/fortran/interface.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr69603.f90 [new file with mode: 0644]

index fff7bde14a8b32c3ad996284040199ce4a0c12f9..704c1f169f2b2d0da7ef1e51a8a695fd4a3862bb 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-15  Harald Anlauf  <anlauf@gmx.de>
+
+       PR fortran/69603
+       * interface.c (compare_parameter): Check for non-NULL pointer.
+
 2016-05-14  Fritz Reese  <fritzoreese@gmail.com>
 
        * gfortran.texi: Update example of DEC UNION extension.
index b981e7c09913fcb8422c806476d748231c1c8ccd..5bd1279291e9572bf4cd4fd508b04fc050e1a446 100644 (file)
@@ -2113,7 +2113,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
     }
 
   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))
index 78789c28335b38125d7efc3481528cfcee0b1af5..8ac56b5113bad74f1e8819e69c68edf9fbfea475 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-15  Harald Anlauf  <anlauf@gmx.de>
+
+       PR fortran/69603
+       * gfortran.dg/pr69603.f90: New testcase.
+
 2016-05-14  Fritz Reese  <fritzoreese@gmail.com>
 
        * gfortran.dg/dec_union_4.f90: Fix endian issue.
diff --git a/gcc/testsuite/gfortran.dg/pr69603.f90 b/gcc/testsuite/gfortran.dg/pr69603.f90
new file mode 100644 (file)
index 0000000..dca4eb1
--- /dev/null
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-fimplicit-none" }
+! 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