This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in optimization?
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Alexander Stante <mrpac at gmx dot de>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Sat, 10 Jul 2004 17:00:43 -0400
- Subject: Re: Bug in optimization?
- Organization: Red Hat Canada
- References: <40F056B3.9030009@gmx.de>
On Sat, 2004-07-10 at 16:50, Alexander Stante wrote:
> int main()
> {
> int x=10;
> const int y[1] = {(x + x)};
> x = y[0];
> printf("%d\n",y[0]);
> return 0;
> }
>
> If you compile it without optimization you get as result from printf
> "20". If you compile it with the -O1 optimization switch on the result
> is surpisingly 40.
>
Works fine with current CVS mainline. In fact, it's optimized to
printf(20).
I'm not sure if we're accepting bugs for the 3.3.x series. If we are,
open a bugzilla case.
Diego.