[Bug tree-optimization/22348] [4.0/4.1 Regression] IV canonicalization causes execution of loops past their end condition

rakdver at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Jul 15 09:58:00 GMT 2005


------- Additional Comments From rakdver at gcc dot gnu dot org  2005-07-15 09:47 -------
This seems to be some curious bug in fold; the following patch fixes the problem
mysteriously :-)

Index: tree-ssa-loop-niter.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-niter.c,v
retrieving revision 2.32
diff -c -3 -p -r2.32 tree-ssa-loop-niter.c
*** tree-ssa-loop-niter.c       28 Jun 2005 00:52:25 -0000      2.32
--- tree-ssa-loop-niter.c       15 Jul 2005 09:45:01 -0000
*************** number_of_iterations_cond (tree type, tr
*** 273,279 ****
        step = fold_unary_to_constant (NEGATE_EXPR, type, step1);
        else
        step = step0;
!       delta = build2 (MINUS_EXPR, type, base1, base0);
        delta = fold_build2 (FLOOR_MOD_EXPR, type, delta, step);
        may_xform = boolean_false_node;

--- 273,279 ----
        step = fold_unary_to_constant (NEGATE_EXPR, type, step1);
        else
        step = step0;
!       delta = fold_build2 (MINUS_EXPR, type, base1, base0);
        delta = fold_build2 (FLOOR_MOD_EXPR, type, delta, step);
        may_xform = boolean_false_node;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22348



More information about the Gcc-bugs mailing list