From 228eb42aabc806d874a330a02f225311a09bb998 Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Sun, 15 May 2016 18:34:57 +0000 Subject: [PATCH] re PR fortran/69603 (ICE: segfault with -fimplicit-none and proc_ptr_comp_24.f90) 2016-05-15 Harald Anlauf PR fortran/69603 * interface.c (compare_parameter): Check for non-NULL pointer. 2016-05-15 Harald Anlauf PR fortran/69603 * gfortran.dg/pr69603.f90: New testcase. From-SVN: r236253 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/interface.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr69603.f90 | 16 ++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr69603.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fff7bde14a8..704c1f169f2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-05-15 Harald Anlauf + + PR fortran/69603 + * interface.c (compare_parameter): Check for non-NULL pointer. + 2016-05-14 Fritz Reese * gfortran.texi: Update example of DEC UNION extension. diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index b981e7c0991..5bd1279291e 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 78789c28335..8ac56b5113b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-15 Harald Anlauf + + PR fortran/69603 + * gfortran.dg/pr69603.f90: New testcase. + 2016-05-14 Fritz Reese * 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 index 00000000000..dca4eb15fc6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr69603.f90 @@ -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 -- 2.30.2