Commit 7f4b6d20 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 99b96649
2008-09-08 Jakub Jelinek <jakub@redhat.com>
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.
2008-09-08 Eric Botcazou <ebotcazou@adacore.com>
* ira-color.c (ira_reuse_stack_slot): Set slot_num on success at the
......
......@@ -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
......
......@@ -203,7 +203,8 @@ bool
optimize_function_for_size_p (struct function *fun)
{
return (optimize_size
|| fun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED);
|| (fun && (fun->function_frequency
== FUNCTION_FREQUENCY_UNLIKELY_EXECUTED)));
}
/* Return true when current function should always be optimized for speed. */
......
2008-09-08 Jakub Jelinek <jakub@redhat.com>
PR middle-end/37414
* g++.dg/opt/init2.C: New test.
PR middle-end/37337
* g++.dg/tree-ssa/pr37337.C: New test.
......
// PR middle-end/37414
// { dg-do compile }
// { dg-options "-O2 -ffast-math" }
double x = 6.0;
double y = x * x;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment