This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: A gcc-cris bug?
- From: "Dave Korn" <dk at artimi dot com>
- To: "'Andrew Pinski'" <pinskia at physics dot uc dot edu>
- Cc: "'Richard Guenther'" <richard dot guenther at gmail dot com>,<gcc at gcc dot gnu dot org>,"'Diego Novillo'" <dnovillo at redhat dot com>,"'Tal Agmon'" <tal dot agmon at nsc dot com>
- Date: Wed, 6 Oct 2004 16:32:58 +0100
- Subject: RE: A gcc-cris bug?
> -----Original Message-----
> From: Andrew Pinski
> Sent: 06 October 2004 15:57
> Another example which has the same bug in 3.4 and before:
> void main ()
> {
> int i;
>
> for (i = 0; i < foo; i++)
> {
> foo = 0;
> }
> printf("foo is: %d, i is: %d\n",foo,i);
> }
>
> so I just provided it has nothing to do with the inliner at all.
>
Yep, and it even works (or rather, doesn't work) if you make foo a local
variable. And it goes wrong at -O2 as well as -O3. But -fno-loop-optimize
stops it.
I guess it just goes to show that a dynamically-varying loop bound is a
pretty rare programming idiom, or people would have run up against this more
often before.......
cheers,
DaveK
--
Can't think of a witty .sigline today....