Use -O1 optimization but avoid <optimized out>?

Jeffrey Walton noloader@gmail.com
Sun Apr 5 01:53:00 GMT 2015


I'm currently building with -O1 and -g3, and I'm seeing values as
<optimized out> under the debugger. This is expected (but not
desired).

I'm interested in building my program with -O1 to invoke analysis for
the warnings I have enabled. But I don't want the resulting binary to
have values optimized out when viewing them under the debugger.

Is there a way to use -O1 (for warnings and analysis) but avoid
<optimized out> (for debugging)? If so, then how would I go about it?



More information about the Gcc-help mailing list