aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-09-08 23:30:23 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-09-08 23:30:23 +0200
commit7f4b6d207c7b950f54cf32b06b2835e960ba8c77 (patch)
treec73044cbbaa13e7957e4b102844ffd851a3c9f04 /gcc/fold-const.c
parent99b96649c17e6a2f9b5e1427603d164ad752c15b (diff)
downloadgcc-7f4b6d207c7b950f54cf32b06b2835e960ba8c77.zip
gcc-7f4b6d207c7b950f54cf32b06b2835e960ba8c77.tar.gz
gcc-7f4b6d207c7b950f54cf32b06b2835e960ba8c77.tar.bz2
re PR middle-end/37414 (ICE with -ffast-math)
PR middle-end/37414 * predict.c (optimize_function_for_size_p): Don't segfault if FUN is NULL. * fold-const.c (LOGICAL_OP_NON_SHORT_CIRCUIT, fold_truthop, tree_swap_operands_p): Don't test cfun != NULL before calling optimize_function_for_s*_p. * g++.dg/opt/init2.C: New test. From-SVN: r140122
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 7c4c522..aea7a65 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5110,7 +5110,7 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2)
#ifndef LOGICAL_OP_NON_SHORT_CIRCUIT
#define LOGICAL_OP_NON_SHORT_CIRCUIT \
- (BRANCH_COST (!cfun || optimize_function_for_speed_p (cfun), \
+ (BRANCH_COST (optimize_function_for_speed_p (cfun), \
false) >= 2)
#endif
@@ -5359,7 +5359,7 @@ fold_truthop (enum tree_code code, tree truth_type, tree lhs, tree rhs)
that can be merged. Avoid doing this if the RHS is a floating-point
comparison since those can trap. */
- if (BRANCH_COST (!cfun || optimize_function_for_speed_p (cfun),
+ if (BRANCH_COST (optimize_function_for_speed_p (cfun),
false) >= 2
&& ! FLOAT_TYPE_P (TREE_TYPE (rl_arg))
&& simple_operand_p (rl_arg)
@@ -6682,7 +6682,7 @@ tree_swap_operands_p (const_tree arg0, const_tree arg1, bool reorder)
if (TREE_CONSTANT (arg0))
return 1;
- if (cfun && optimize_function_for_size_p (cfun))
+ if (optimize_function_for_size_p (cfun))
return 0;
if (reorder && flag_evaluation_order