Actually, I am interested in looking in to that. I end up fielding a lot of questions about what to do for adequate debugging, and I wasn’t aware of that flag. Thank you for pointing it out to me. David From: Jeffrey Walton via Gcc-help <gcc-help@xxxxxxxxxxx<mailto:gcc-help@xxxxxxxxxxx>> Date: Monday, Mar 16, 2020, 7:35 PM To: gcc-help <gcc-help@xxxxxxxxxxx<mailto:gcc-help@xxxxxxxxxxx>> Subject: Re: [EXTERNAL] Re: question about knowing when optimization options are used On Mon, Mar 16, 2020 at 7:55 PM Shrader, David Lee via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: > > Thank you for the reply. So, what you're saying is that the output of `gcc -Q --help=optimizers` doesn't necessarily reflect what optimization gcc is going to do when -O0 is being used, correct? This is because no (or very little) optimization is actually allowed to be done when -O0 is use. If you are interested in debugging+optimizations, then you might also take a look at -Og. It is a relatively new option that is intended to apply some optimizations while preserving the debugging experience. I think it showed up around GCC 7, but the first mention in the change log is GCC 8. Also see https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html . $ gcc -Og -Q --help=optimizers | grep "\-fmove-loop-invariants" -fmove-loop-invariants [disabled] $ gcc -O3 -Q --help=optimizers | grep "\-fmove-loop-invariants" -fmove-loop-invariants [enabled] Jeff