re PR rtl-optimization/71634 (Invalid write with in mark_loops_for_removal (ira-build...
authorMartin Liska <mliska@suse.cz>
Tue, 12 Jul 2016 14:54:52 +0000 (16:54 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 12 Jul 2016 14:54:52 +0000 (14:54 +0000)
Fix PR rtl-optimization/71634

* ira-build.c (mark_loops_for_removal): Properly iterate
loops.

From-SVN: r238247

gcc/ChangeLog
gcc/ira-build.c

index 8776f744ce5a5e79c2b12350efd8a129b2195af4..509e855e95b28ae09d996a12e0f6736f78effcc4 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-12  Martin Liska  <mliska@suse.cz>
+
+       * ira-build.c (mark_loops_for_removal): Properly iterate
+       loops.
+
 2016-07-12  Steven Bosscher  <steven@gcc.gnu.org>
        Richard Biener  <rguenther@suse.de>
 
index 37aa18548a6e7bee014679e2b18955490628ac52..caa770e849f04324e36ba25cb7da63c110220113 100644 (file)
@@ -2251,7 +2251,7 @@ mark_loops_for_removal (void)
             );
       }
   qsort (sorted_loops, n, sizeof (ira_loop_tree_node_t), loop_compare_func);
-  for (i = 0; n - i + 1 > IRA_MAX_LOOPS_NUM; i++)
+  for (i = 0; i < n - IRA_MAX_LOOPS_NUM; i++)
     {
       sorted_loops[i]->to_remove_p = true;
       if (internal_flag_ira_verbose > 1 && ira_dump_file != NULL)