This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] for PR 17016
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 23 Aug 2004 09:36:17 +0200
- Subject: [patch] for PR 17016
Hello,
the function to determine # of iterations of a loop assumes that
the arguments it works with have either INTEGER_TYPE or POINTER_TYPE.
However it happened to be called also for REFERENCE_TYPEs, which
caused this ice. The patch fixes it by making it work also with
REFERENCE_TYPEs.
Bootstrapped & regtested on i686, commited to lno-branch, needed
also in mainline.
Zdenek
PR tree-optimization/17016
* tree-ssa-loop-niter.c (number_of_iterations_cond,
number_of_iterations_exit): Use POINTER_TYPE_P instead
of testing for POINTER_TYPE.
Index: tree-ssa-loop-niter.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-niter.c,v
retrieving revision 1.1.2.11
diff -c -3 -p -r1.1.2.11 tree-ssa-loop-niter.c
*** tree-ssa-loop-niter.c 14 Jul 2004 02:05:03 -0000 1.1.2.11
--- tree-ssa-loop-niter.c 22 Aug 2004 18:18:02 -0000
*************** number_of_iterations_cond (tree type, tr
*** 151,157 ****
return;
}
! if (TREE_CODE (type) == POINTER_TYPE)
{
/* We assume pointer arithmetics never overflows. */
mmin = mmax = NULL_TREE;
--- 151,157 ----
return;
}
! if (POINTER_TYPE_P (type))
{
/* We assume pointer arithmetics never overflows. */
mmin = mmax = NULL_TREE;
*************** number_of_iterations_exit (struct loop *
*** 619,625 ****
type = TREE_TYPE (op0);
if (TREE_CODE (type) != INTEGER_TYPE
! && TREE_CODE (type) != POINTER_TYPE)
return false;
if (!simple_iv (loop, stmt, op0, &base0, &step0))
--- 619,625 ----
type = TREE_TYPE (op0);
if (TREE_CODE (type) != INTEGER_TYPE
! && POINTER_TYPE_P (type))
return false;
if (!simple_iv (loop, stmt, op0, &base0, &step0))