From f11600c98517d58c0f62df8e78f7090524f2d61b Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Wed, 21 Mar 2018 01:07:43 +0000 Subject: [PATCH] re PR fortran/85001 (ICE in gfc_build_array_type, at fortran/trans-types.c:1420) 2018-03-20 Steven G. Kargl PR fortran/85001 * interface.c (symbol_rank): Remove bogus null pointer check that crept in when translating a ternary operator into an if-else constructor. 2018-03-20 Steven G. Kargl PR fortran/85001 * gfortran.dg/interface_41.f90: New test. From-SVN: r258698 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/interface.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/interface_41.f90 | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/interface_41.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8db0754f4af..8bcaabbf625 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2018-03-20 Steven G. Kargl + + PR fortran/85001 + * interface.c (symbol_rank): Remove bogus null pointer check that + crept in when translating a ternary operator into an if-else + constructor. + 2018-03-19 Thomas Koenig PR fortran/84931 diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index cb326e55c75..7f7b2c631cb 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1268,7 +1268,7 @@ symbol_rank (gfc_symbol *sym) { gfc_array_spec *as = NULL; - if (sym->ts.type == BT_CLASS && CLASS_DATA (sym) && CLASS_DATA (sym)->as) + if (sym->ts.type == BT_CLASS && CLASS_DATA (sym)) as = CLASS_DATA (sym)->as; else as = sym->as; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 79cc52cb3e7..c4c0815dea6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-20 Steven G. Kargl + + PR fortran/85001 + * gfortran.dg/interface_41.f90: New test. + 2018-03-20 Jakub Jelinek PR debug/84875 diff --git a/gcc/testsuite/gfortran.dg/interface_41.f90 b/gcc/testsuite/gfortran.dg/interface_41.f90 new file mode 100644 index 00000000000..b5ea8af189d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_41.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! PR fortran/85001 +! Contributed by Gerhard Steinmetz. +program p + type t + end type + call s +contains + real function f(x) + class(t) :: x + dimension :: x(:) + f = 1.0 + end + subroutine s + type(t) :: x(2) + real :: z + z = f(x) ! { dg-error "Rank mismatch in argument" } + end +end -- 2.30.2