summaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-08 21:30:23 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-08 21:30:23 +0000
commitad4341e885f0a4228c916b28fddf403c0cc1fa83 (patch)
treec73044cbbaa13e7957e4b102844ffd851a3c9f04 /gcc/predict.c
parentf55b350cc912a39333e6d0e2a5d018424a05b5c2 (diff)
downloadgcc-ad4341e885f0a4228c916b28fddf403c0cc1fa83.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140122 138bc75d-0d04-0410-961f-82ee72b054a4
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 b69934f4778..5ed6c431355 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. */