[Patch, Fortran, committed] PR 78593: [6/7 Regression] ICE in gfc_match_varspec, at fortran/primary.c:2053

Janus Weil janus@gcc.gnu.org
Wed Nov 30 13:29:00 GMT 2016


Hi all,

I have just committed to trunk another obvious one-line fix for an
ICE-on-invalid regression:

https://gcc.gnu.org/viewcvs?rev=243020&root=gcc&view=rev

I plan to backport this to the gcc-6 branch within a week or so.

Cheers,
Janus
-------------- next part --------------
Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c	(revision 243019)
+++ gcc/fortran/primary.c	(working copy)
@@ -2050,7 +2050,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_fl
       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;
Index: gcc/testsuite/gfortran.dg/derived_result.f90
===================================================================
--- gcc/testsuite/gfortran.dg/derived_result.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/derived_result.f90	(working copy)
@@ -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 <gerhard.steinmetz.fortran@t-online.de>
+
+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


More information about the Gcc-patches mailing list