aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2019-12-20 11:35:20 +0000
committerTobias Burnus <burnus@gcc.gnu.org>2019-12-20 12:35:20 +0100
commitde89b5748d68b76b06e3beca4a956060afb79a3d (patch)
treeff72f1c042fa19182d5953447d3c03b1c2408fdb /gcc/fortran/expr.c
parente565e49fb22cb466dc8af0dc09a061b30806cc04 (diff)
downloadgcc-de89b5748d68b76b06e3beca4a956060afb79a3d.zip
gcc-de89b5748d68b76b06e3beca4a956060afb79a3d.tar.gz
gcc-de89b5748d68b76b06e3beca4a956060afb79a3d.tar.bz2
Fortran] PR 92996 – fix rank resolution EXPR_ARRAY
PR fortran/92996 gcc/fortran/ * expr.c (simplify_parameter_variable): Call gfc_resolve_ref and gfc_expression_rank; fix location info. * gfortran.h (gfc_resolve_ref, gfc_expression_rank): Declare. * match.c (gfc_match_stopcode): Remove redundant setting of gfc_init_expr_flag; early return if gfc_simplify_expr has an error. * resolve.c (gfc_expression_rank): Renamed from expression_rank; minor cleanup. (gfc_resolve_ref): Removed static and renamed from resolve_ref. (resolve_variable, resolve_typebound_function, resolve_typebound_subroutine, resolve_ppc_call, resolve_expr_ppc, gfc_resolve_expr, resolve_procedure): Update calls. PR fortran/92996 gcc/testsuite/ * gfortran.dg/array_simplify_4.f90: New. * gfortran.dg/pr91565.f90: Update dg-error. * gfortran.dg/pr91801.f90: Likewise. From-SVN: r279638
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 9e3c8c4..fc67a9d 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2044,6 +2044,15 @@ simplify_parameter_variable (gfc_expr *p, int type)
gfc_expr *e;
bool t;
+ /* Set rank and check array ref; as resolve_variable calls
+ gfc_simplify_expr, call gfc_resolve_ref + gfc_expression_rank instead. */
+ if (!gfc_resolve_ref (p))
+ {
+ gfc_error_check ();
+ return false;
+ }
+ gfc_expression_rank (p);
+
if (gfc_is_size_zero_array (p))
{
if (p->expr_type == EXPR_ARRAY)
@@ -2073,6 +2082,7 @@ simplify_parameter_variable (gfc_expr *p, int type)
if (e->expr_type != EXPR_CONSTANT && p->ref != NULL)
e->ref = gfc_copy_ref (p->ref);
t = gfc_simplify_expr (e, type);
+ e->where = p->where;
/* Only use the simplification if it eliminated all subobject references. */
if (t && !e->ref)