using -ggdb3 and -O3 simultaneously

Ian Lance Taylor iant@google.com
Sun Mar 1 22:31:00 GMT 2009


lehe <timlee126@yahoo.com> writes:

> I was wondering what is the purpose of using -ggdb3 and -O3 simultaneously
> for gcc? One is for debug and the other is for optimization. Is this to
> debug the optimized code? Can anyone point me to some reference explaining
> this well? Thanks!

Yes, that is to permit using the debugger on optimized code.  The -g
options control the generation of information for the debugger; they do
not affect the generated code.  The -O options control the amount of
optimization applied when generating code; they do not affect the debug
information.

Ian



More information about the Gcc-help mailing list