On Mon, May 4, 2015 at 2:32 AM, David Edelsohn <dje....@gmail.com> wrote: > On Sat, May 2, 2015 at 6:04 AM, Eric Botcazou <ebotca...@adacore.com> wrote: >>> Why should GCC unnecessarily create stack frames to avoid >>> compare-debug testcase failures? >> >> I'm not sure I understand the question... compare-debug failures are failures >> (-g is not supposed to change the generated code and this XCOFF-specific bug >> was reported to us) so they need to be fixed. >> >> From there on, as Alan said, there are 2 cases: either AIX needs a frame for >> debugging or it doesn't. If the latter, then the lines can simply be >> deleted. >> If the former, we have to draw a line somewhere; Alan suggests always >> creating >> a frame while I suggest creating it only at -O0 and -Og. > > I believe that AIX does need a frame for debugging. I don't remember > the exact reason off hand. > > I'm sorry that XCOFF debugging changes the generated code (only in the > sense of allocating a frame), but that is a system dependency. It's > been this way for over 20 years. I see no reason to produce worse > code at -O0 when not debugging simply to make testcases happier.
The simple reason is because it is policy for GCC to generate the same code with -g0 and -g. You can't simply say you don't care. You never want to run into the situation that you miscompile a program with -g0 but not with -g because that's very much no fun to debug. Yes, I don't think we have this policy written down anywhere - something we should improve on. Richard. > By the way, I'm still waiting for the DWARF debugging patches from > Adacore compatible with AIX as and ld. DWARF debugging would not > require pushing a frame, and would resolve the failure when testing > with DWARF. The patch would be adjusted to only push a frame when > writing XCOFF debugging. > > - David