------- Comment #9 from rguenth at gcc dot gnu dot org  2010-03-26 15:44 -------
I think it is SCEV leading to false D.2100_10: [4294967293, +INF] as it
assumes

  D.2100_10 = i.2_9 + 4294967293;
  if (D.2100_10 <= 1)

doesn't wrap.  Probably fixed on the trunk by the patch that restricts
asking SCEV to loop PHI nodes.  Ah, no.  trunk unrolls the loop.
Testcase that doesn't unroll the loop on trunk (but still doesn't fail):

extern "C" {
    void *memset(void *s, int c, __SIZE_TYPE__ n);
    void *malloc(__SIZE_TYPE__ size);
    int printf(const char *format, ...);
    void abort(void);
}

void __attribute__((noinline))
print(int v)
{
    volatile int x = v;
    (void) x;
}

struct QVector {
    int p[1];
};

int main() {
    int i;
    QVector* vect = (QVector*) malloc(1024);
    memset(vect->p, 0, 1024);
    for (i = 0; i < 32; i++) {
        int v = vect->p[i];
        if (i >= 31 && i <= 32)
          return 0;
        print(v);
    }
    abort();
}


-- 


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

Reply via email to