aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-11-07 22:26:02 +0000
committerEric Botcazou <ebotcazou@adacore.com>2012-11-07 22:26:02 +0000
commitb60e5d16bc7c7c72604568ad2201714cbef5ebf3 (patch)
tree74bd2163ff68dcf5d867b4f057ef2ecff1bc162a /gcc/fold-const.c
parent7bb901a5ca3db4a7bb23d25acc1f32cd856301f0 (diff)
PR middle-end/55219
* fold-const.c (fold_binary_op_with_conditional_arg): Do not fold if the argument is itself a conditional expression. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@193312 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 62a4e218968..4fa1fd670aa 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5987,10 +5987,11 @@ fold_binary_op_with_conditional_arg (location_t loc,
cond_code = VEC_COND_EXPR;
/* This transformation is only worthwhile if we don't have to wrap ARG
- in a SAVE_EXPR and the operation can be simplified on at least one
- of the branches once its pushed inside the COND_EXPR. */
+ in a SAVE_EXPR and the operation can be simplified without recursing
+ on at least one of the branches once its pushed inside the COND_EXPR. */
if (!TREE_CONSTANT (arg)
&& (TREE_SIDE_EFFECTS (arg)
+ || TREE_CODE (arg) == COND_EXPR || TREE_CODE (arg) == VEC_COND_EXPR
|| TREE_CONSTANT (true_value) || TREE_CONSTANT (false_value)))
return NULL_TREE;