Silent gcc 4.2.0 loop optimization bug with -O2
Andrey Chernov
ache at nagual.pp.ru
Mon Jun 25 14:56:32 UTC 2007
On Mon, Jun 25, 2007 at 09:59:21AM -0400, Alexander Kabaev wrote:
> It is trivial to extract a sample for miscompiltations. Just use
> -save-temps and cut down the code until you have a simple case. If you
> cannot be bothered to do that, nobody else would either,
Well... Is this small enough?
cc -O2 a.c
./a.out
cc -O a.c
./a.out
------------------------------------------------------------------
#include <stdio.h>
const char *szElem[4];
void main()
{
float power1[80], total2;
int i, j;
char sz[80];
for (i = 1; i <= 12; i++) {
if (i <= 4) {
sprintf(sz, " -%9.7s:", szElem[i-1]);
for (j = 1; j < 12; j += 4)
total2 += power1[i-1+j];
} else if (i == 6) {
} else if (i >= 7 && i <= 9) {
printf("MUST BE HERE!!! %d\n", i);
}
}
}
-------------------------------------------------------------------
--
http://ache.pp.ru/
More information about the freebsd-current
mailing list