summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
diff options
context:
space:
mode:
authormikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-05 21:41:15 +0000
committermikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-05 21:41:15 +0000
commit3a2545a18b36242908d5498ef7bd9e7a8aa96a10 (patch)
tree6b50b567f3e7b484d1a22fbe37c2dcf74d0ad824 /gcc/fortran/trans-expr.c
parent66feb54cdf22a430c0b228314b1a13899c225ce7 (diff)
downloadgcc-3a2545a18b36242908d5498ef7bd9e7a8aa96a10.tar.gz
Fix fortran scalar elemental dependency mishandling
PR fortran/66089 gcc/fortran/ * trans-expr.c (expr_is_variable, gfc_expr_is_variable): Rename the former to the latter and make it non-static. Update callers. * gfortran.h (gfc_expr_is_variable): New declaration. (struct gfc_ss_info): Add field needs_temporary. * trans-array.c (gfc_scalar_elemental_arg_saved_as_argument): Tighten the condition on aggregate expressions with a check that the expression is a variable and doesn't need a temporary. (gfc_conv_resolve_dependency): Add intermediary reference variable. Set the needs_temporary field. gcc/testsuite/ * gfortran.dg/elemental_dependency_6.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233188 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r--gcc/fortran/trans-expr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 87af7acb8f2..4baadc84ef0 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -8834,8 +8834,8 @@ gfc_trans_array_constructor_copy (gfc_expr * expr1, gfc_expr * expr2)
/* Tells whether the expression is to be treated as a variable reference. */
-static bool
-expr_is_variable (gfc_expr *expr)
+bool
+gfc_expr_is_variable (gfc_expr *expr)
{
gfc_expr *arg;
gfc_component *comp;
@@ -8848,7 +8848,7 @@ expr_is_variable (gfc_expr *expr)
if (arg)
{
gcc_assert (expr->value.function.isym->id == GFC_ISYM_TRANSPOSE);
- return expr_is_variable (arg);
+ return gfc_expr_is_variable (arg);
}
/* A data-pointer-returning function should be considered as a variable
@@ -9329,7 +9329,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
must have its components deallocated afterwards. */
scalar_to_array = (expr2->ts.type == BT_DERIVED
&& expr2->ts.u.derived->attr.alloc_comp
- && !expr_is_variable (expr2)
+ && !gfc_expr_is_variable (expr2)
&& expr1->rank && !expr2->rank);
scalar_to_array |= (expr1->ts.type == BT_DERIVED
&& expr1->rank
@@ -9373,7 +9373,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
}
tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
- expr_is_variable (expr2) || scalar_to_array
+ gfc_expr_is_variable (expr2) || scalar_to_array
|| expr2->expr_type == EXPR_ARRAY,
!(l_is_temp || init_flag) && dealloc);
gfc_add_expr_to_block (&body, tmp);