From 69688f1ed7606189b16bbdbd506dfc6e863e8309 Mon Sep 17 00:00:00 2001 From: "J\"orn Rennecke" Date: Wed, 24 Feb 1999 11:18:59 +0000 Subject: [PATCH] * unroll.c (unroll_loop): Avoid out-of-bounds index for local_regno. From-SVN: r25399 --- gcc/ChangeLog | 4 ++++ gcc/unroll.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff5706ec155..08591cca4b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +Wed Feb 24 19:17:11 1999 J"orn Rennecke + + * unroll.c (unroll_loop): Avoid out-of-bounds index for local_regno. + Wed Feb 24 11:26:41 1999 Vladimir N. Makarov * config/sparc/sparc.h (CONDITIONAL_REGISTER_USAGE): Don't use diff --git a/gcc/unroll.c b/gcc/unroll.c index 8737544ae68..bf0375761a7 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -238,6 +238,7 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, struct inline_remap *map; char *local_label; char *local_regno; + int max_local_regnum; int maxregnum; rtx exit_label = 0; rtx start_label; @@ -755,6 +756,9 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, /* The preconditioning code may allocate two new pseudo registers. */ maxregnum = max_reg_num (); + /* local_regno is only valid for regnos < max_local_regnum. */ + max_local_regnum = maxregnum; + /* Allocate and zero out the splittable_regs and addr_combined_regs arrays. These must be zeroed here because they will be used if loop preconditioning is performed, and must be zero for that case. @@ -1051,7 +1055,7 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, if (local_label[j]) set_label_in_map (map, j, gen_label_rtx ()); - for (j = FIRST_PSEUDO_REGISTER; j < maxregnum; j++) + for (j = FIRST_PSEUDO_REGISTER; j < max_local_regnum; j++) if (local_regno[j]) { map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j])); @@ -1199,7 +1203,7 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, if (local_label[j]) set_label_in_map (map, j, gen_label_rtx ()); - for (j = FIRST_PSEUDO_REGISTER; j < maxregnum; j++) + for (j = FIRST_PSEUDO_REGISTER; j < max_local_regnum; j++) if (local_regno[j]) { map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j])); -- 2.30.2