On Mon, Feb 25, 2013 at 4:51 AM, Richard Biener
<richard.guent...@gmail.com> wrote:
> On Mon, Feb 25, 2013 at 6:20 AM, Chung-Ju Wu <jasonw...@gmail.com> wrote:
>> 2013/2/25 Jeffrey Walton <noloa...@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.
>
>>
>> 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 and Jason.

Don't worry about possible confusion (-Og needs -gN). Document it at
http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#Debugging-Options,
and folks should be able to find it. (That's the first place I
looked).

Address Sanitizer looks very interesting also (-fsanitize=address).
It's listed at http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html,
but there's no topic when following the link to
http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#Debugging-Options.

Jeff

Reply via email to