aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-10-27 21:36:32 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2008-10-27 21:36:32 +0100
commit6a16e934557199b55b389fd86241297099a0a7ec (patch)
treeebeb7fd560865467cdcbc8475c88d93d3693497a /gcc/predict.c
parent8f0f2a1dfd96bc496c50a264d2482daa254490aa (diff)
downloadgcc-6a16e934557199b55b389fd86241297099a0a7ec.zip
gcc-6a16e934557199b55b389fd86241297099a0a7ec.tar.gz
gcc-6a16e934557199b55b389fd86241297099a0a7ec.tar.bz2
re PR tree-optimization/37879 (ICE with "wrong" use of noreturn attribute and optimization)
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. From-SVN: r141390
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index 5ed6c43..c6e933f 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;