For:
int *f(int *a, int b, int c)
{
  int i;
  a --;
  *a = 1;
  for (i = 0;i<b;i+=c)
    (a[i]) = 0;
  return a;
}
----------------CUT----------------
I get in the final_cleanup:
  MEM[index: ivtmp.35, offset: 4294967292] = 0;


And I noticed that ivtmp.29 is of type "long unsigned int" which seems wrong as
it is actually the pointer.  I think this in the end could also cause PR 28690
too.

Anyways the assembly in the ends up to be:
L4:
        add r9,r9,r5
        li r2,0
        subf r0,r5,r9
        stw r2,-4(r3)
        cmpw cr7,r4,r0
        add r3,r3,r11
        bgt+ cr7,L4


Which is bad, I will file a bug about not pulling out the "li r2, 0" in another
bug (that is a regression too).  But we have an add and a sub -4 which is just
wrong.  we should be able to use stwx instead which we did in 4.0.2.


-- 
           Summary: IV-OPTs produces a weird MEM_REF
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc-darwin


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

Reply via email to