From patchwork Sat Jan 1 13:27:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Avoid freed memory use in loop distribution Date: Sat, 01 Jan 2011 03:27:33 -0000 From: Jan Hubicka X-Patchwork-Id: 77140 Message-Id: <20110101132733.GB6040@kam.mff.cuni.cz> To: gcc-patches@gcc.gnu.org Hi, tree_loop_distribution displays loop number after the loop was removed resulting in uninitialized memory use. Fixed as obvoius. Honza Index: ChangeLog =================================================================== --- ChangeLog (revision 168390) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-01-01 Jan Hubicka + + * tree-loop-distribution.c (tree_loop_distribution): Do not + use freed memory. + 2011-01-01 Kai Tietz PR target/38662 Index: tree-loop-distribution.c =================================================================== --- tree-loop-distribution.c (revision 168390) +++ tree-loop-distribution.c (working copy) @@ -1214,6 +1214,7 @@ tree_loop_distribution (void) FOR_EACH_LOOP (li, loop, 0) { VEC (gimple, heap) *work_list = NULL; + int num = loop->num; /* If the loop doesn't have a single exit we will fail anyway, so do that early. */ @@ -1255,9 +1256,9 @@ tree_loop_distribution (void) { if (nb_generated_loops > 1) fprintf (dump_file, "Loop %d distributed: split to %d loops.\n", - loop->num, nb_generated_loops); + num, nb_generated_loops); else - fprintf (dump_file, "Loop %d is the same.\n", loop->num); + fprintf (dump_file, "Loop %d is the same.\n", num); } verify_loop_structure ();