aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2015-08-06 20:47:36 +0000
committerMikael Morin <mikael@gcc.gnu.org>2015-08-06 20:47:36 +0000
commited673c00bfec3dafcd8d37114282c5c0f4c207d8 (patch)
tree962fd58d54e846aff50066f35696155719afac5c
parent0eb6f71c48a4ee9d0c1dc85e31d8c135eb306d98 (diff)
downloadgcc-ed673c00bfec3dafcd8d37114282c5c0f4c207d8.zip
gcc-ed673c00bfec3dafcd8d37114282c5c0f4c207d8.tar.gz
gcc-ed673c00bfec3dafcd8d37114282c5c0f4c207d8.tar.bz2
Move one condition out of gfc_trans_scalar_assign
* 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
-rw-r--r--gcc/fortran/ChangeLog12
-rw-r--r--gcc/fortran/trans-array.c4
-rw-r--r--gcc/fortran/trans-expr.c18
-rw-r--r--gcc/fortran/trans-stmt.c19
-rw-r--r--gcc/fortran/trans.h3
5 files changed, 33 insertions, 23 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 008d3bd..86afcf0 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,15 @@
+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
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index c4cdbae..1657739 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -6882,9 +6882,9 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
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. */
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index af30b55..16ebd20 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -4321,7 +4321,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
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);
@@ -4428,7 +4428,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
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. */
@@ -6741,7 +6741,7 @@ gfc_trans_subarray_assign (tree dest, gfc_component * cm, gfc_expr * expr)
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);
@@ -7250,7 +7250,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr,
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);
@@ -8139,7 +8139,7 @@ gfc_conv_string_parameter (gfc_se * se)
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;
@@ -8188,7 +8188,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
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);
@@ -9270,9 +9270,9 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
}
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)
@@ -9313,7 +9313,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
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);
}
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 6409f7f..a8536fd 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -2852,8 +2852,8 @@ forall_make_variable_temp (gfc_code *c, stmtblock_t *pre, stmtblock_t *post)
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);
@@ -3224,7 +3224,7 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3,
/* 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)
@@ -3322,8 +3322,8 @@ generate_loop_for_rhs_to_temp (gfc_expr *expr2, tree tmp1, tree count3,
/* 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)
@@ -4497,7 +4497,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
/* 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));
@@ -4550,8 +4550,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2,
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);
@@ -4951,8 +4950,8 @@ gfc_trans_where_3 (gfc_code * cblock, gfc_code * eblock)
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);
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index f7cf5f0..6a9ba60 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -478,8 +478,7 @@ int gfc_conv_procedure_call (gfc_se *, gfc_symbol *, gfc_actual_arglist *,
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 *);