aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.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/predict.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/predict.c')
-rw-r--r--gcc/predict.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index b69934f..5ed6c43 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -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. */