This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in optimization?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]