[Bug tree-optimization/70986] [7 Regression] ICE on valid code at -O3 on x86_64-linux-gnu in combine_blocks, at tree-if-conv.c:2219

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 10 12:56:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70986

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following fixes it for me, making sure the loop is rejected early by
if-conversion.

Index: gcc/cfganal.c
===================================================================
--- gcc/cfganal.c       (revision 236066)
+++ gcc/cfganal.c       (working copy)
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3.
 #include "cfghooks.h"
 #include "timevar.h"
 #include "cfganal.h"
+#include "cfgloop.h"

 /* Store the data structures necessary for depth-first search.  */
 struct depth_first_search_ds {
@@ -602,7 +603,10 @@ connect_infinite_loops_to_exit (void)
        break;

       deadend_block = dfs_find_deadend (unvisited_block);
-      make_edge (deadend_block, EXIT_BLOCK_PTR_FOR_FN (cfun), EDGE_FAKE);
+      edge e = make_edge (deadend_block, EXIT_BLOCK_PTR_FOR_FN (cfun),
+                         EDGE_FAKE);
+      if (current_loops != NULL)
+       rescan_loop_exit (e, true, false);
       flow_dfs_compute_reverse_add_bb (&dfs_ds, deadend_block);
     }


More information about the Gcc-bugs mailing list