From 5548d9cd190fae2112e410b8ff91b09ec03f19e9 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 12 Jul 2016 16:54:52 +0200 Subject: [PATCH] re PR rtl-optimization/71634 (Invalid write with in mark_loops_for_removal (ira-build.c:2256) with --param ira-max-loops-num=0) Fix PR rtl-optimization/71634 * ira-build.c (mark_loops_for_removal): Properly iterate loops. From-SVN: r238247 --- gcc/ChangeLog | 5 +++++ gcc/ira-build.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8776f744ce5..509e855e95b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-07-12 Martin Liska + + * ira-build.c (mark_loops_for_removal): Properly iterate + loops. + 2016-07-12 Steven Bosscher Richard Biener diff --git a/gcc/ira-build.c b/gcc/ira-build.c index 37aa18548a6..caa770e849f 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -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) -- 2.30.2