Re: Disable all optimization options in GCC

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

 



On 10/22/2015 09:30 PM, Jonathan Wakely wrote:
>> Options that reduce compilation time
>> and make debugging better will be turned on.
> 
> Wrong. At -O0 options that would _increase_ compilation time are _not_
> turned on.
> 
> 
>> In other words, O0 is optimizing in the level of compilation. Produced
>> binaries are not optimized in order to ease debugging process.
> 
> I don't know what this means.

I think OP meant that -O0 reduces compile time at the cost of increasing
run time. In general that is not always true. -O0 indeed turns off
optimizations, but in some cases this leads to increased compile time.

A simple (and thus not very precise) explanation: compilation is
organized into passes. If some optimization removes lots of code at some
early stage, all later passes will no longer need to process this code.
Because the compiler not only optimizes the code, but also does other
work (selects instructions, allocates registers, generates debugging
information, etc.), at -O0 this work will be done on more code. That's
why, say '-Og -ggdb3' can result in faster compilation than '-O0 -ggdb3'.

-- 
Regards,
    Mikhail Maltsev



[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