Mail Archives: pgcc/1999/10/04/20:42:40
I've isolated the bug I told you about last time, that is the one that
caused a small loop to be miscompiled. I recall the problem: the file is
void func(void)
{
int i, tab[512];
for (i = 0; i < 511; i++)
tab[i+1] = tab[i];
}
is miscompiled with -O4 -mpentium and correctly with -fno-compare-elim. By
changing the file loop.c according to the following patch, the problem is
corrected for the given example. I think the patch cover all cases, but I'm
not a compiler specialist, so it would be better to have a good look at
it. (there could be some lines of offset since I also corrected a
misallocation in this file, already submitted to the list)
Loïc
--- loop.c.orig Mon Oct 4 22:30:22 1999
+++ loop.c Tue Oct 5 00:16:17 1999
@@ -10546,7 +10546,7 @@
obfree(storage);
return 0;
}
- else if (!rtx_equal_p (SET_DEST (PATTERN (insn)), SET_DEST (bl->init_set)))
+ else
{
new_rtx_element = (struct new_rtx *) alloca (sizeof (struct new_rtx));
new_rtx_element->insn = insn;
@@ -10576,6 +10576,19 @@
obfree (storage);
return 0;
}
+ }
+
+ if (rtx_equal_p (SET_DEST (PATTERN (insn)), SET_DEST (bl->init_set)))
+ {
+ emit_insn_after(gen_rtx (SET,
+ GET_MODE(SET_DEST(PATTERN(insn))),
+ SET_DEST(PATTERN(insn)),
+ gen_rtx(PLUS,
+ GET_MODE(SET_DEST(PATTERN(insn))),
+ SET_DEST(PATTERN(insn)),
+ gen_rtx(CONST_INT, 0,
+ -adjust_val))),
+ insn);
}
}
}
- Raw text -