Re: g++ optimization question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I want to dissemble the code and understand it. But it seems to hard
to understand. Are there any compiler options which generate more
information and help me to read the assembly code and compare it with
the source code?

Thanks,
Peng

On 9/28/07, Richard Li <richardpku@xxxxxxxxx> wrote:
> I tested this code with "g++ -S -O1", and checked the generated
> assembly code. I found G++ dropped the statement "e = d * 1"
> completely, since "e" is a local variable and is assigned a value, but
> never used later.
>
> If "e" is used later, G++ would optimize "e = d * 1 " as "e = d".
>
> On 9/29/07, Peng Yu <pengyu.ut@xxxxxxxxx> wrote:
> > Hi,
> >
> > Can anybody let me know whether g++ will optimize for the following case?
> >
> > void f(double d)
> >   double e;
> >   ..... do something
> >
> >   e = d * 1.;// will this be optimized as e = d;
> > }
> >
> > Thanks,
> > Peng
> >
>

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux