On Mon, 17 May 2021, 08:31 Ezhil P via Gcc-help, <gcc-help@xxxxxxxxxxx> wrote: > Hi, > can you kindly clarify the unique feature of -Og flag?. It is described as > "optimize the debugging experience". How does it do? It performs some simple optimizations that improve performance similarly to -O1. But it avoids transformations that make debugging harder, such as drastically rearranging the code, or GDB telling you a variable had been "optimized out". It's not magic, it's just a selection of optimizations that don't hurt the debugging experience. The usual -O1, -O2, -O3 options aim for better performance, not debugging experience, and -Os aims for smaller code size, not debugging experience. So it's just a different set of trade offs.