This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
bug in loop optimization with -Os (-O2)
- To: egcs at egcs dot cygnus dot com
- Subject: bug in loop optimization with -Os (-O2)
- From: Denis Chertykov <denis at medo dot fov dot uni-mb dot si>
- Date: Mon, 1 Mar 1999 09:48:45 +0300 (MSK)
I have founded gcc/egcs bug while compile and run test file
testsuit/gcc.c-torture/execute/loop-2c.c:
------------------------------------------------
int a[2];
__inline__ f (b, o)
{
unsigned int i;
int *p;
for (p = &a[b], i = b; --i < ~0; ) /* this is a problem place */
*--p = i * 3 + o; /* this is a problem place */
}
g(int b)
{
f (b, (int)a);
}
main ()
{
a[0] = a[1] = 0;
g (2);
if (a[0] != (int)a || a[1] != (int)a + 3)
abort ();
exit (0);
}
--------------------------------------------------------
I have compiled this test with -O2 (gcc 2.7.2.3) or
-Os (egcs 1.1.1 and egcs 1.1.2pre1). In both case this test aborts
after start. I'm look to debugging output (-da). Bug was borne in loop
optimization pass.
This test normally runs with -O,-O3,-O9 options.
Denis.
PS: originally I have founded this bug in my ATMEL AVR port with
egcs-1.1.2pre.