summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-04 00:17:07 +0000
committermikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-04 00:17:07 +0000
commit190c9d73cdfbf28d14152d2f9fe55db3e2f0b215 (patch)
tree23ecf060554c4053c9eebd6c35870c7d2ba7c4e7
parent9a1f41f03ac0f7c491aa48bde989a67a2af6359c (diff)
downloadgcc-190c9d73cdfbf28d14152d2f9fe55db3e2f0b215.tar.gz
* trans-intrinsic.c (gfc_conv_intrinsic_arith): Update conditions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180913 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog4
-rw-r--r--gcc/fortran/trans-intrinsic.c12
2 files changed, 10 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 6fca42978c2..be67d8d0032 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,9 @@
2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+ * trans-intrinsic.c (gfc_conv_intrinsic_arith): Update conditions.
+
+2011-11-04 Mikael Morin <mikael@gcc.gnu.org>
+
* frontend-passes.c (cfe_register_funcs): Return early in the case
of an inline intrinsic function.
(optimize_binop_array_assignment): Skip optimization in the case of
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 3cdc1e0970a..342d2cb4ec4 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -2624,7 +2624,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
maskexpr = actual->expr;
}
- if (maskexpr && maskexpr->rank != 0)
+ if (maskexpr && maskexpr->rank > 0)
{
maskss = gfc_walk_expr (maskexpr);
gcc_assert (maskss != gfc_ss_terminator);
@@ -2635,7 +2635,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
/* Initialize the scalarizer. */
gfc_init_loopinfo (&loop);
gfc_add_ss_to_loop (&loop, arrayss);
- if (maskss)
+ if (maskexpr && maskexpr->rank > 0)
gfc_add_ss_to_loop (&loop, maskss);
/* Initialize the loop. */
@@ -2643,13 +2643,13 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
gfc_conv_loop_setup (&loop, &expr->where);
gfc_mark_ss_chain_used (arrayss, 1);
- if (maskss)
+ if (maskexpr && maskexpr->rank > 0)
gfc_mark_ss_chain_used (maskss, 1);
/* Generate the loop body. */
gfc_start_scalarized_body (&loop, &body);
/* If we have a mask, only add this element if the mask is set. */
- if (maskss)
+ if (maskexpr && maskexpr->rank > 0)
{
gfc_init_se (&maskse, NULL);
gfc_copy_loopinfo_to_se (&maskse, &loop);
@@ -2740,7 +2740,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
gfc_add_block_to_block (&block, &arrayse.post);
- if (maskss)
+ if (maskexpr && maskexpr->rank > 0)
{
/* We enclose the above in if (mask) {...} . */
@@ -2755,7 +2755,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, enum tree_code op,
gfc_trans_scalarizing_loops (&loop, &body);
/* For a scalar mask, enclose the loop in an if statement. */
- if (maskexpr && maskss == NULL)
+ if (maskexpr && maskexpr->rank == 0)
{
gfc_init_se (&maskse, NULL);
gfc_conv_expr_val (&maskse, maskexpr);