We noticed that the simple loop here
extern int a[];
int foo(int w) {
  int n = w;
  while (n >= 512)
    {
    a[n] = 42;
    n -= 256;
    }
  }


was being treated as ineligible for the doloop modification. I think this is
a simple pasto; this code was evidently copied from the previous block:

Index: loop-iv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop-iv.c,v
retrieving revision 2.35
diff -u -b -c -p -r2.35 loop-iv.c
cvs diff: conflicting specifications of output style
*** loop-iv.c   21 Jul 2005 07:24:07 -0000      2.35
--- loop-iv.c   29 Aug 2005 23:34:12 -0000
*************** iv_number_of_iterations (struct loop *lo
*** 2417,2423 ****
          tmp0 = lowpart_subreg (mode, iv0.base, comp_mode);
          tmp1 = lowpart_subreg (mode, iv1.base, comp_mode);
  
!         bound = simplify_gen_binary (MINUS, mode, mode_mmin,
                                       lowpart_subreg (mode, step, comp_mode));
          if (step_is_pow2)
            {
--- 2417,2423 ----
          tmp0 = lowpart_subreg (mode, iv0.base, comp_mode);
          tmp1 = lowpart_subreg (mode, iv1.base, comp_mode);
  
!         bound = simplify_gen_binary (PLUS, mode, mode_mmin,
                                       lowpart_subreg (mode, step, comp_mode));
          if (step_is_pow2)
            {


The code as it was computed -2147483648-256 which overflows.
Still testing, but is there anything obvious wrong with this?

Reply via email to