re PR fortran/78593 (ICE in gfc_match_varspec, at fortran/primary.c:2053)
authorJanus Weil <janus@gcc.gnu.org>
Wed, 30 Nov 2016 13:23:17 +0000 (14:23 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Wed, 30 Nov 2016 13:23:17 +0000 (14:23 +0100)
2016-11-30  Janus Weil  <janus@gcc.gnu.org>

PR fortran/78593
* primary.c (gfc_match_varspec): Check if sym is non-null to avoid ICE.

2016-11-30  Janus Weil  <janus@gcc.gnu.org>

PR fortran/78593
* gfortran.dg/derived_result.f90: New test case.

From-SVN: r243020

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

index 3b4799abdaa1908a66e88c9c44ad3625aaa93a26..104368663b6ecf5fb4190ed908066bd2ab6bd031 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-30  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/78593
+       * primary.c (gfc_match_varspec): Check if sym is non-null to avoid ICE.
+
 2016-11-30  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/78592
index 50d7072b67097d295d616f73e2cae7f81ba8e9e9..2b20f8c0d9d5087e83e5ab8f49c86a6e1bdc1221 100644 (file)
@@ -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;
index 502d525e77e451b92c9d036452002b5f7be52687..2c8b3a0f410d4bd0bd0f9382d832ca194b5b521b 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-30  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/78593
+       * gfortran.dg/derived_result.f90: New test case.
+
 2016-11-30  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * 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 (file)
index 0000000..76d4a49
--- /dev/null
@@ -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