From f477062c2ee3410545d9ff4c68bb080ae5c4f8ae Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 8 Dec 2019 13:02:54 +0000 Subject: [PATCH] re PR fortran/92764 (ICE in gfc_procedure_use) 2018-12-08 Thomas Koenig PR fortran/92764 * interface.c (gfc_procedure_use): Check for existence of derived component before using (twice). 2018-12-08 Thomas Koenig PR fortran/92764 * gfortran.dg/interface_44.f90: New test. From-SVN: r279087 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/interface.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/interface_44.f90 | 6 ++++++ 4 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/interface_44.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 60114dba763..5265c2c3794 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-12-08 Thomas Koenig + + PR fortran/92764 + * interface.c (gfc_procedure_use): Check for existence of derived + component before using (twice). + 2019-12-08 Thomas Koenig PR fortran/92755 diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 919c95a87c8..263785639d3 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6c28808cee2..d2f9b47a3b6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-08 Thomas Koenig + + PR fortran/92764 + * gfortran.dg/interface_44.f90: New test. + 2019-12-08 Thomas Koenig 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 index 00000000000..eaafc678c47 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_44.f90 @@ -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 -- 2.30.2