[Bug regression/37824] New: funroll-loops miscompiles php

anton at samba dot org gcc-bugzilla@gcc.gnu.org
Tue Oct 14 11:34:00 GMT 2008


A gcc checkout from yesterday (4.4.0 20081013) is miscompiling php when built
with 64bit and funroll-loops. A cut down test case is below but at this stage
im not sure if its a violation of the aliasing rules.

good:
# gcc -m64 -O2 -o /tmp/foo /tmp/foo.c
# /tmp/foo
0xfffffabef50
0xfffffabef50
0xfffffabef50
0xfffffabef50
0xfffffabef50
0xfffffabef50

bad:
# gcc -m64 -funroll-loops -O2 -o /tmp/foo /tmp/foo.c
# /tmp/foo
0xfffffacef50
0xfffffacef50
(nil)
(nil)
(nil)
0xfffffacef50

code:

#include <stdio.h>
#include <stdlib.h>

void foo(int count, void **p)
{
        while (--count >= 0) {
                long *q = *(long **)(--p);
                *p = 0;
                printf("%p\n", q);
        }
}

int main()
{
        int i;
        long a;
        long *b = malloc(8 * sizeof(long));

        for (i = 0; i < 8; i++)
                *b++ = (unsigned long)&a;

        b--;
        foo(6, (void **)b);
        return 0;
}


-- 
           Summary: funroll-loops miscompiles php
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anton at samba dot org
GCC target triplet: powerpc-linux


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



More information about the Gcc-bugs mailing list