diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2009-06-29 20:38:59 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2009-06-29 20:38:59 +0000 |
commit | a61a36ab30b7711b5d5cf002d52e6e9514499739 (patch) | |
tree | aca49e7453dd7b8e481ea5b320d8145f0bddc97c /gcc/fortran/trans-expr.c | |
parent | 96da806615b899b591da751f4bdd3b7507bfdc89 (diff) | |
download | gcc-a61a36ab30b7711b5d5cf002d52e6e9514499739.zip gcc-a61a36ab30b7711b5d5cf002d52e6e9514499739.tar.gz gcc-a61a36ab30b7711b5d5cf002d52e6e9514499739.tar.bz2 |
re PR fortran/40551 (Optimizations possible using gfc_full_array_ref_p)
2009-06-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40551
* dependency.h : Add second bool* argument to prototype of
gfc_full_array_ref_p.
* dependency.c (gfc_full_array_ref_p): If second argument is
present, return true if last dimension of reference is an
element or has unity stride.
* trans-array.c : Add NULL second argument to references to
gfc_full_array_ref_p.
* trans-expr.c : The same, except for;
(gfc_trans_arrayfunc_assign): Return fail if lhs reference
is not a full array or a contiguous section.
2009-06-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40551
* gfortran.dg/func_assign_2.f90 : New test.
From-SVN: r149062
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index f79ad4b..6a38f10 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -4300,6 +4300,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2) gfc_ss *ss; gfc_ref * ref; bool seen_array_ref; + bool c = false; gfc_component *comp = NULL; /* The caller has already checked rank>0 and expr_type == EXPR_FUNCTION. */ @@ -4311,6 +4312,10 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2) && expr2->value.function.esym->attr.elemental) return NULL; + /* Fail if rhs is not FULL or a contiguous section. */ + if (expr1->ref && !(gfc_full_array_ref_p (expr1->ref, &c) || c)) + return NULL; + /* Fail if EXPR1 can't be expressed as a descriptor. */ if (gfc_ref_needs_temporary_p (expr1->ref)) return NULL; @@ -4785,7 +4790,7 @@ copyable_array_p (gfc_expr * expr) if (expr->rank < 1 || !expr->ref || expr->ref->next) return false; - if (!gfc_full_array_ref_p (expr->ref)) + if (!gfc_full_array_ref_p (expr->ref, NULL)) return false; /* Next check that it's of a simple enough type. */ |