diff options
author | Richard Guenther <rguenther@suse.de> | 2012-04-11 08:13:37 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-04-11 08:13:37 +0000 |
commit | 13a7578b180de6d8bb91a2f340817e71c61a9988 (patch) | |
tree | 9889ff32a80ab00280cbd8d5df9c0803fe1cbbfa /gcc/ifcvt.c | |
parent | 12df9a2f926759175599d20c5c2b0c7f50b7ad6d (diff) | |
download | gcc-13a7578b180de6d8bb91a2f340817e71c61a9988.tar.gz |
re PR middle-end/52881 (ICE due to null pointer deref in cfgloop.c)
2012-04-11 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/52881
* ifcvt.c (find_if_case_2): Avoid speculating loop latches.
* gcc.dg/torture/pr52881.c: New testcase.
* gcc.dg/torture/pr52913.c: Likewise.
From-SVN: r186304
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r-- | gcc/ifcvt.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index e4e13abe0aa..79e27380283 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -3927,6 +3927,11 @@ find_if_case_2 (basic_block test_bb, edge then_edge, edge else_edge) edge else_succ; int then_prob, else_prob; + /* We do not want to speculate (empty) loop latches. */ + if (current_loops + && else_bb->loop_father->latch == else_bb) + return FALSE; + /* If we are partitioning hot/cold basic blocks, we don't want to mess up unconditional or indirect jumps that cross between hot and cold sections. |