From 0cc063af32311944d66b6537aeade08038cabba9 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Tue, 10 Dec 2019 21:59:09 +0000 Subject: [PATCH] re PR fortran/91643 (ICE in gfc_trans_create_temp_array, at fortran/trans-array.c:1265) 2019-12-10 Thomas Koenig PR fortran/91643 * trans-array.c (gfc_conv_array_parameter): Do not repack an assumed rank dummy argument. 2019-12-10 Thomas Koenig PR fortran/91643 * gfortran.dg/assumed_rank_18.f90: New test. From-SVN: r279203 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-array.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/assumed_rank_18.f90 | 16 ++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/assumed_rank_18.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index bcc8218..77675ab 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-12-10 Thomas Koenig + + PR fortran/91643 + * trans-array.c (gfc_conv_array_parameter): Do not repack + an assumed rank dummy argument. + 2019-12-10 Martin Liska PR fortran/92874 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 1b77998..e879ea1 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -8141,6 +8141,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77, if (g77 && optimize && !optimize_size && expr->expr_type == EXPR_VARIABLE && !is_pointer (expr) && ! gfc_has_dimen_vector_ref (expr) + && !(expr->symtree->n.sym->as + && expr->symtree->n.sym->as->type == AS_ASSUMED_RANK) && (fsym == NULL || fsym->ts.type != BT_ASSUMED)) { gfc_conv_subref_array_arg (se, expr, g77, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2c7d90a..b47cb9a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-12-10 Thomas Koenig + + PR fortran/91643 + * gfortran.dg/assumed_rank_18.f90: New test. + 2019-12-10 Jakub Jelinek PR rtl-optimization/92882 diff --git a/gcc/testsuite/gfortran.dg/assumed_rank_18.f90 b/gcc/testsuite/gfortran.dg/assumed_rank_18.f90 new file mode 100644 index 0000000..a8fa3ff --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assumed_rank_18.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! PR 91643 - this used to cause an ICE. +! Original test case by Gerhard Steinmetz. +program p + real :: z(3) = [1.0, 2.0, 3.0] + call g(z) +contains + subroutine g(x) + real :: x(..) + call h(x) + end + subroutine h(x) + real :: x(*) + if (x(1) /= 1.0) stop 1 + end +end -- 2.7.4