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 #5 from rguenth at gcc dot gnu dot org  2006-03-07 10:12 -------
Umm, that has uninitialized vars.  The following is ok wrt -Wall -Werror:

extern int printf(const char *, ...);
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;
    BF_word tmp4, *ptr;
    BF_word i;
    for (i = 0; i < 16 + 2; i++)
        BF_current.P[i] = i * 0x98765432;
    L = 0;
    ptr = BF_current.P;
    do {
        ptr += 2;
        L ^= BF_current.P[0];
        tmp4 = L >> 24;
        L = tmp4 ^ BF_current.P[16 + 1];
        *(ptr - 2) = L;
    } while (ptr < &BF_current.P[16 + 2]);
    printf("%08x\n", L);
    return 0;
}

and prints 1fdb9752 vs. 1fdb974d.


-- 


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]