re PR fortran/92764 (ICE in gfc_procedure_use)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 8 Dec 2019 13:02:54 +0000 (13:02 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 8 Dec 2019 13:02:54 +0000 (13:02 +0000)
2018-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/92764
    * interface.c (gfc_procedure_use): Check for existence of derived
    component before using (twice).

2018-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/92764
    * gfortran.dg/interface_44.f90: New test.

From-SVN: r279087

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

index 60114dba76343f500dab69cee5be20c414aeb958..5265c2c3794b1ab28bfc45092d5483972a22a0b1 100644 (file)
@@ -1,3 +1,9 @@
+2018-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/92764
+       * interface.c (gfc_procedure_use): Check for existence of derived
+       component before using (twice).
+
 2019-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/92755
index 919c95a87c80d42e4601bf71789d97fcbb2a4f2d..263785639d3170b9606d8995c82127e29fe768ac 100644 (file)
@@ -3888,6 +3888,7 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
          /* F2008, C1303 and C1304.  */
          if (a->expr
              && (a->expr->ts.type == BT_DERIVED || a->expr->ts.type == BT_CLASS)
+             && a->expr->ts.u.derived
              && ((a->expr->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
                   && a->expr->ts.u.derived->intmod_sym_id == ISOFORTRAN_LOCK_TYPE)
                  || gfc_expr_attr (a->expr).lock_comp))
@@ -3901,6 +3902,7 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
 
          if (a->expr
              && (a->expr->ts.type == BT_DERIVED || a->expr->ts.type == BT_CLASS)
+             && a->expr->ts.u.derived
              && ((a->expr->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
                   && a->expr->ts.u.derived->intmod_sym_id
                      == ISOFORTRAN_EVENT_TYPE)
index 6c28808cee26b287dda74e59a2d7e2e83c07bc60..d2f9b47a3b6ccbf90eb1e8e33b32e7037280fd24 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/92764
+       * gfortran.dg/interface_44.f90: New test.
+
 2019-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/92755
diff --git a/gcc/testsuite/gfortran.dg/interface_44.f90 b/gcc/testsuite/gfortran.dg/interface_44.f90
new file mode 100644 (file)
index 0000000..eaafc67
--- /dev/null
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! PR 92964 - this used to ICE.
+! Original test case by Arseny Solokha
+type(e6) function dn() ! { dg-error "The type for function" }
+  call sub(dn)
+end function dn