diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-27 20:36:32 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-27 20:36:32 +0000 |
commit | 06fbaa3cedd903676bc1f880d1c2a4fd6f81459d (patch) | |
tree | ebeb7fd560865467cdcbc8475c88d93d3693497a /gcc/predict.c | |
parent | 401429ceecfa2c09484d6cba63092605bebbd56e (diff) | |
download | gcc-06fbaa3cedd903676bc1f880d1c2a4fd6f81459d.tar.gz |
PR tree-optimization/37879
* predict.c (tree_estimate_probability): Check if last_stmt is
non-NULL before dereferencing it.
* gcc.dg/pr37879.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141390 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/predict.c')
-rw-r--r-- | gcc/predict.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/predict.c b/gcc/predict.c index 5ed6c431355..c6e933f5101 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1599,6 +1599,7 @@ tree_estimate_probability (void) { edge e; edge_iterator ei; + gimple last; FOR_EACH_EDGE (e, ei, bb->succs) { @@ -1621,7 +1622,8 @@ tree_estimate_probability (void) && e->dest != EXIT_BLOCK_PTR && single_succ_p (e->dest) && single_succ_edge (e->dest)->dest == EXIT_BLOCK_PTR - && gimple_code (last_stmt (e->dest)) == GIMPLE_RETURN) + && (last = last_stmt (e->dest)) != NULL + && gimple_code (last) == GIMPLE_RETURN) { edge e1; edge_iterator ei1; |