* trans.h (gfc_trans_scalar_assign): Remove fourth argument.
* trans-expr.c (gfc_trans_scalar_assign): Merge fourth into sixth
argument.
(gfc_conv_subref_array_arg, gfc_trans_subarray_assign,
gfc_trans_subcomponent_assign, gfc_trans_assignment_1): Update callers.
* trans-array.c (gfc_conv_expr_descriptor): Ditto.
* trans-stmt.c (forall_make_variable_temp,
generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
gfc_trans_where_assign, gfc_trans_where_3): Ditto.
From-SVN: r226700
+2015-08-06 Mikael Morin <mikael@gcc.gnu.org>
+
+ * trans.h (gfc_trans_scalar_assign): Remove fourth argument.
+ * trans-expr.c (gfc_trans_scalar_assign): Merge fourth into sixth
+ argument.
+ (gfc_conv_subref_array_arg, gfc_trans_subarray_assign,
+ gfc_trans_subcomponent_assign, gfc_trans_assignment_1): Update callers.
+ * trans-array.c (gfc_conv_expr_descriptor): Ditto.
+ * trans-stmt.c (forall_make_variable_temp,
+ generate_loop_for_temp_to_lhs, generate_loop_for_rhs_to_temp,
+ gfc_trans_where_assign, gfc_trans_where_3): Ditto.
+
2015-08-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/52846
gfc_add_block_to_block (&block, &lse.pre);
lse.string_length = rse.string_length;
- tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, true,
+ tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts,
expr->expr_type == EXPR_VARIABLE
- || expr->expr_type == EXPR_ARRAY, true);
+ || expr->expr_type == EXPR_ARRAY, false);
gfc_add_expr_to_block (&block, tmp);
/* Finish the copying loops. */
if (intent != INTENT_OUT)
{
- tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, true, false, true);
+ tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, false, false);
gfc_add_expr_to_block (&body, tmp);
gcc_assert (rse.ss == gfc_ss_terminator);
gfc_trans_scalarizing_loops (&loop, &body);
gcc_assert (lse.ss == gfc_ss_terminator);
- tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, false, false, true);
+ tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, false, true);
gfc_add_expr_to_block (&body, tmp);
/* Generate the copying loops. */
gfc_conv_expr (&rse, expr);
- tmp = gfc_trans_scalar_assign (&lse, &rse, cm->ts, true, true, true);
+ tmp = gfc_trans_scalar_assign (&lse, &rse, cm->ts, true, false);
gfc_add_expr_to_block (&body, tmp);
gcc_assert (rse.ss == gfc_ss_terminator);
if (cm->ts.type == BT_CHARACTER)
lse.string_length = cm->ts.u.cl->backend_decl;
lse.expr = dest;
- tmp = gfc_trans_scalar_assign (&lse, &se, cm->ts, true, false, true);
+ tmp = gfc_trans_scalar_assign (&lse, &se, cm->ts, false, false);
gfc_add_expr_to_block (&block, tmp);
}
return gfc_finish_block (&block);
tree
gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
- bool l_is_temp, bool deep_copy, bool dealloc)
+ bool deep_copy, bool dealloc)
{
stmtblock_t block;
tree tmp;
the same as the rhs. This must be done following the assignment
to prevent deallocating data that could be used in the rhs
expression. */
- if (!l_is_temp && dealloc)
+ if (dealloc)
{
tmp_var = gfc_evaluate_now (lse->expr, &lse->pre);
tmp = gfc_deallocate_alloc_comp_no_caf (ts.u.derived, tmp_var, 0);
}
tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
- l_is_temp || init_flag,
expr_is_variable (expr2) || scalar_to_array
- || expr2->expr_type == EXPR_ARRAY, dealloc);
+ || expr2->expr_type == EXPR_ARRAY,
+ !(l_is_temp || init_flag) && dealloc);
gfc_add_expr_to_block (&body, tmp);
if (lss == gfc_ss_terminator)
rse.string_length = string_length;
tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
- false, false, dealloc);
+ false, dealloc);
gfc_add_expr_to_block (&body, tmp);
}
tse.expr = gfc_create_var (tmp, "temp");
}
- tmp = gfc_trans_scalar_assign (&tse, &rse, e->ts, true,
- e->expr_type == EXPR_VARIABLE, true);
+ tmp = gfc_trans_scalar_assign (&tse, &rse, e->ts,
+ e->expr_type == EXPR_VARIABLE, false);
gfc_add_expr_to_block (pre, tmp);
}
gfc_free_expr (e);
/* Use the scalar assignment. */
rse.string_length = lse.string_length;
- tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, false, true, true);
+ tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, true, true);
/* Form the mask expression according to the mask tree list. */
if (wheremask)
/* Use the scalar assignment. */
lse.string_length = rse.string_length;
- tmp = gfc_trans_scalar_assign (&lse, &rse, expr2->ts, true,
- expr2->expr_type == EXPR_VARIABLE, true);
+ tmp = gfc_trans_scalar_assign (&lse, &rse, expr2->ts,
+ expr2->expr_type == EXPR_VARIABLE, false);
/* Form the mask expression according to the mask tree list. */
if (wheremask)
/* Use the scalar assignment as is. */
tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
- loop.temp_ss != NULL, false, true);
+ false, loop.temp_ss == NULL);
tmp = build3_v (COND_EXPR, maskexpr, tmp, build_empty_stmt (input_location));
TREE_TYPE (maskexpr), maskexpr);
/* Use the scalar assignment as is. */
- tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts, false, false,
- true);
+ tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts, false, true);
tmp = build3_v (COND_EXPR, maskexpr, tmp,
build_empty_stmt (input_location));
gfc_add_expr_to_block (&body, tmp);
gfc_conv_expr (&edse, edst);
}
- tstmt = gfc_trans_scalar_assign (&tdse, &tsse, tdst->ts, false, false, true);
- estmt = eblock ? gfc_trans_scalar_assign (&edse, &esse, edst->ts, false,
+ tstmt = gfc_trans_scalar_assign (&tdse, &tsse, tdst->ts, false, true);
+ estmt = eblock ? gfc_trans_scalar_assign (&edse, &esse, edst->ts,
false, true)
: build_empty_stmt (input_location);
tmp = build3_v (COND_EXPR, cexpr, tstmt, estmt);
void gfc_conv_subref_array_arg (gfc_se *, gfc_expr *, int, sym_intent, bool);
/* Generate code for a scalar assignment. */
-tree gfc_trans_scalar_assign (gfc_se *, gfc_se *, gfc_typespec, bool, bool,
- bool);
+tree gfc_trans_scalar_assign (gfc_se *, gfc_se *, gfc_typespec, bool, bool);
/* Translate COMMON blocks. */
void gfc_trans_common (gfc_namespace *);