On Thu, Sep 13, 2012 at 09:33:20AM -0400, Robert Dewar wrote: > On 9/13/2012 8:00 AM, Richard Guenther wrote: > > >Because doing so would create code generation differences -g vs. -g0. > > Sometimes I wonder whether the insistence on -g not changing code > generation is warranted. In practice, gdb for me is so weak in handling
It is. IMHO the most important reason is not that somebody would build first with just -O2 and then later on to debug the code would build it again with -g -O2 and hope the code is the same, but by making sure -g vs. -g0 doesn't change generate code we ensure -g doesn't pessimize the generated code, and really many people compile even production code with -g -O2 or similar. The debug info is then either stripped, or stripped into separate files/not shipped or only optionally shipped with the product. Jakub