This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/26587] [4.1 Regression] strict aliasing incorrectly pre-loads an array element with loops
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Mar 2006 10:02:02 -0000
- Subject: [Bug rtl-optimization/26587] [4.1 Regression] strict aliasing incorrectly pre-loads an array element with loops
- References: <bug-26587-12319@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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