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: GCC 4.8 and -Og


On Mon, Feb 25, 2013 at 6:20 AM, Chung-Ju Wu <jasonwucj@gmail.com> wrote:
> 2013/2/25 Jeffrey Walton <noloader@gmail.com>:
>> Hi All,
>>
>> I read the relase notes on GCC 4.8
>> (http://gcc.gnu.org/gcc-4.8/changes.html) and -Og caught my eye  (the
>> bulleted item is below).
> [deleted]
>>
>> What "n" does -Og correspond to for -O and -g (i.e., -O1, -O2; -g2, -g3)?

-Og does not correspond to any other -O plus -g level.  -Og does not enable
debug info creation either (eh, I _knew_ that was going to be confusing ...).
To enable debug information generation you need to use -Og -g.

-Og optimizes way less than -O1 but more than -O0 (it for example does
inlining of C++ abstraction, constant propagation, full redundancy elimination
and dead code elimination).

> [deleted]
>> Is -Og -g3 a valid combination to get the benefits of -Og with maximum
>> symbol support? Is it even needed?

Yes, it's valid and it's even needed.

>> Jeff
>>
>
> To my understanding, '-Og' selects optimization level 1
> so that you can have fast compilation and a superior debugging experience.

As said above this is not exactly true.  The __OPTIMIZE__ preprocessor
macro will be 1 though.

> You still need to use -g (or -g3, which is the option you normally use.)
> to guide GCC output debug information.
>
> Refer to following link for some -Og implementation detail:
> http://gcc.gnu.org/ml/gcc-patches/2012-08/msg00616.html

Also note that evaluation whether 1), 2) or 3) hold true has not been
done, bugreports are welcome.

Thanks,
Richard.

>
> Best regards,
> jasonwu


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