From dca9e8be87dafdc558e3554c1c21f599918509a5 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Tue, 30 Jan 2018 20:49:49 +0000 Subject: [PATCH] re PR fortran/84133 (ICE in gimplify_var_or_parm_decl, at gimplify.c:2706) 2018-01-30 Thomas Koenig PR fortran/84133 * frontend-passes (matmul_to_var_expr): Return early if in association list. (inline_matmul_assign): Likewise. 2018-01-30 Thomas Koenig PR fortran/84133 * gfortran.dg/inline_matmul_21.f90: New test case. From-SVN: r257206 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/frontend-passes.c | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/inline_matmul_21.f90 | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/inline_matmul_21.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 96e6fb21402..292abc15953 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2018-01-30 Thomas Koenig + + PR fortran/84133 + * frontend-passes (matmul_to_var_expr): Return early if + in association list. + (inline_matmul_assign): Likewise. + 2017-01-29 Thomas Koenig PR fortran/84073 diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index bfa50bea766..11a5b9b779c 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -2763,7 +2763,7 @@ matmul_to_var_expr (gfc_expr **ep, int *walk_subtrees ATTRIBUTE_UNUSED, return 0; if (forall_level > 0 || iterator_level > 0 || in_omp_workshare - || in_where) + || in_where || in_assoc_list) return 0; /* Check if this is already in the form c = matmul(a,b). */ @@ -3728,7 +3728,7 @@ inline_matmul_assign (gfc_code **c, int *walk_subtrees, if (co->op != EXEC_ASSIGN) return 0; - if (in_where) + if (in_where || in_assoc_list) return 0; /* The BLOCKS generated for the temporary variables and FORALL don't diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9254cca638f..b1a7ba85996 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-30 Thomas Koenig + + PR fortran/84133 + * gfortran.dg/inline_matmul_21.f90: New test case. + 2018-01-30 Rainer Orth * g++.dg/torture/pr81360.C: Add -fdump-ipa-icf to dg-options. diff --git a/gcc/testsuite/gfortran.dg/inline_matmul_21.f90 b/gcc/testsuite/gfortran.dg/inline_matmul_21.f90 new file mode 100644 index 00000000000..5bfda8b6f8d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/inline_matmul_21.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-additional-options "-ffrontend-optimize" } +! PR 84133 - this used to ICE. Original test case by +! Gerhard Steinmetz. + +program p + real :: x(2,2) = 1.0 + real :: z(2,2) + associate (y => matmul(x,x)) + z = y + end associate + print *, z +end + + -- 2.30.2