This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
20000329-1.c fix
- To: egcs-patches at egcs dot cygnus dot com, rth at cygnus dot com
- Subject: 20000329-1.c fix
- From: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Date: Wed, 26 Apr 2000 16:53:45 +0200
Hi
The failure is caused by the overflow in unroll_loop, because of exteme number
of iterations and oveflow in the multiplication, unroll decides to unroll
completely and the bug shows itself quite a bit later, since everything wents
correct up to main copying loop. Only problem is allocation of const_equiv
array, that gets allocated, even when the size is extreme, since exactly same
overflow happends in size calculation (so xcalloc passes) and we get failure
later in integrate.c
I've also re-named second allocator of the array in order to simplify
debugging. OK to install?
Wed Apr 26 16:51:12 MET DST 2000 Jan Hubicka <jh@suse.cz>
* unroll.c (unroll_loop): Avoid overflow in the n_iterations
calculation; rename const_equiv array in the preconditioning code
from loop_unroll to loop_unroll_precondition
Index: egcs/gcc/unroll.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/unroll.c,v
retrieving revision 1.95
diff -c -3 -p -r1.95 unroll.c
*** unroll.c 2000/03/25 18:34:05 1.95
--- unroll.c 2000/04/26 14:48:39
*************** unroll_loop (loop, insn_count, end_inser
*** 385,390 ****
--- 385,392 ----
return;
}
else if (loop_info->n_iterations > 0
+ /* Avoid overflow in the next expression. */
+ && loop_info->n_iterations < MAX_UNROLLED_INSNS
&& loop_info->n_iterations * insn_count < MAX_UNROLLED_INSNS)
{
unroll_number = loop_info->n_iterations;
*************** unroll_loop (loop, insn_count, end_inser
*** 906,912 ****
map->reg_map = (rtx *) xmalloc (maxregnum * sizeof (rtx));
VARRAY_CONST_EQUIV_INIT (map->const_equiv_varray, maxregnum,
! "unroll_loop");
global_const_equiv_varray = map->const_equiv_varray;
init_reg_map (map, maxregnum);
--- 908,914 ----
map->reg_map = (rtx *) xmalloc (maxregnum * sizeof (rtx));
VARRAY_CONST_EQUIV_INIT (map->const_equiv_varray, maxregnum,
! "unroll_loop_precondition");
global_const_equiv_varray = map->const_equiv_varray;
init_reg_map (map, maxregnum);