This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A gcc-cris bug?
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: "Dave Korn" <dk at artimi dot com>
- Cc: "'Tal Agmon'" <Tal dot Agmon at nsc dot com>, "'Richard Guenther'" <richard dot guenther at gmail dot com>, <gcc at gcc dot gnu dot org>
- Date: Wed, 6 Oct 2004 07:54:19 -0400
- Subject: Re: A gcc-cris bug?
- References: <NUTMEGT1r4kDD5TklcZ000002ae@NUTMEG.CAM.ARTIMI.COM>
On Oct 6, 2004, at 7:45 AM, Dave Korn wrote:
#include <stdio.h>
int foo=100;
int f ()
{
foo = 0;
}
void main ()
{
int i;
for (i = 0; i < foo; i++)
{
f ();
}
printf("foo is: %d, i is: %d\n",foo,i);
}
But the mainline at -O3 produces great code aka no loops at all:
;; Function main (main)
main ()
{
int i;
int foo.0;
<bb 0>:
foo.0 = foo;
if (foo.0 > 0) goto <L0>; else goto <L7>;
<L7>:;
i = 0;
goto <bb 2> (<L2>);
<L0>:;
foo = 0;
i = 1;
foo.0 = 0;
<L2>:;
printf (&"foo is: %d, i is: %d\n"[0], foo.0, i) [tail call];
return;
}
Thanks,
Andrew Pinski