This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/26587] [4.1 Regression] strict aliasing incorrectly pre-loads an array element with loops



------- Comment #4 from rguenth at gcc dot gnu dot org  2006-03-07 10:02 -------
Reduced testcase:

extern int printf(const char *format, ...);
typedef unsigned int BF_word;
typedef BF_word BF_key[16 + 2];
static struct {
    BF_key P;
} BF_current;
int main(void)
{
    BF_word L, R;
    BF_word tmp1, tmp2, tmp3, tmp4, *ptr;
    L = R = 0;
    ptr = BF_current.P;
    do {
        int i;
        ptr += 2;
        L ^= BF_current.P[0];
        for (i = 0; i < 16; i += 2) {
            tmp1 = L & 0xFF;
            tmp3 += tmp1;
            L ^= tmp3;;
        }
        *(ptr - 2) = L;
    } while (ptr < &BF_current.P[16 + 2]);
    printf("%08x %08x\n", L, R);
    return 0;
}

-O2 -fno-strict-aliasing:
0001e6d4 00000000

-O2:
0001c100 00000000

-fno-ivopts does not fix it.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]