From: Janus Weil Date: Wed, 30 Nov 2016 13:23:17 +0000 (+0100) Subject: re PR fortran/78593 (ICE in gfc_match_varspec, at fortran/primary.c:2053) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5c50b024fbfe4255270fa4c7845b222466d2e79;p=gcc.git re PR fortran/78593 (ICE in gfc_match_varspec, at fortran/primary.c:2053) 2016-11-30 Janus Weil PR fortran/78593 * primary.c (gfc_match_varspec): Check if sym is non-null to avoid ICE. 2016-11-30 Janus Weil PR fortran/78593 * gfortran.dg/derived_result.f90: New test case. From-SVN: r243020 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3b4799abdaa..104368663b6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-11-30 Janus Weil + + PR fortran/78593 + * primary.c (gfc_match_varspec): Check if sym is non-null to avoid ICE. + 2016-11-30 Janus Weil PR fortran/78592 diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 50d7072b670..2b20f8c0d9d 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2050,7 +2050,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, if (m != MATCH_YES) return MATCH_ERROR; - if (sym->f2k_derived) + if (sym && sym->f2k_derived) tbp = gfc_find_typebound_proc (sym, &t, name, false, &gfc_current_locus); else tbp = NULL; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 502d525e77e..2c8b3a0f410 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-30 Janus Weil + + PR fortran/78593 + * gfortran.dg/derived_result.f90: New test case. + 2016-11-30 Thomas Preud'homme * lib/target-supports.exp (add_options_for_arm_arch_v6m): Add diff --git a/gcc/testsuite/gfortran.dg/derived_result.f90 b/gcc/testsuite/gfortran.dg/derived_result.f90 new file mode 100644 index 00000000000..76d4a4941e0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/derived_result.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! +! PR 78593: [6/7 Regression] ICE in gfc_match_varspec, at fortran/primary.c:2053 +! +! Contributed by Gerhard Steinmetz + +type(t) function add (x, y) ! { dg-error "is not accessible" } + integer, intent(in) :: x, y + add%a = x + y ! { dg-error "Unclassifiable statement" } +end