https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396
--- Comment #34 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ok, reduced testcase for the -fcompare-debug (length) issue is just: void fn1() {} with -O2 -gdwarf-4 -fcompare-debug The *.ira dump is still identical, but reload has: --- pr83396.ii.276r.reload 2017-12-13 16:31:30.077467285 +0100 +++ pr83396.ii.gk.276r.reload 2017-12-13 16:31:30.144466454 +0100 @@ -6,10 +6,10 @@ Spilling non-eliminable hard regs: 1 New elimination table: -Can eliminate 31 to 1 (offset=0, prev_offset=0) -Can eliminate 111 to 1 (offset=0, prev_offset=0) +Can eliminate 31 to 1 (offset=-32, prev_offset=0) +Can eliminate 111 to 1 (offset=-32, prev_offset=0) Can eliminate 111 to 31 (offset=0, prev_offset=0) -Can eliminate 67 to 1 (offset=32, prev_offset=0) +Can eliminate 67 to 1 (offset=0, prev_offset=0) Can eliminate 67 to 31 (offset=32, prev_offset=0) Can eliminate 30 to 30 (offset=0, prev_offset=0) Spilling non-eliminable hard regs: 1 @@ -36,10 +36,10 @@ EBB 2 Spilling non-eliminable hard regs: 1 Spilling non-eliminable hard regs: 1 New elimination table: -Can eliminate 31 to 1 (offset=0, prev_offset=0) -Can eliminate 111 to 1 (offset=0, prev_offset=0) +Can eliminate 31 to 1 (offset=-32, prev_offset=-32) +Can eliminate 111 to 1 (offset=-32, prev_offset=-32) Can eliminate 111 to 31 (offset=0, prev_offset=0) -Can eliminate 67 to 1 (offset=32, prev_offset=32) +Can eliminate 67 to 1 (offset=0, prev_offset=0) Can eliminate 67 to 31 (offset=32, prev_offset=0) Can eliminate 30 to 30 (offset=0, prev_offset=0) differences. The bug is obvious, rs6000_stack_info has: else if (TARGET_XCOFF && write_symbols != NO_DEBUG) info->push_p = 1; so it generates different code based on whether -g is enabled or not. Clearly that is a preexisting bug. If it is for whatever reason needed, can't it be done regardless of -g, i.e. else if (TARGET_XCOFF) info->push_p = 1; or, if you are ok with -fcompare-debug being broken for the default stabs or whatever AIX uses for debugging (which implies different code generation between -g and -g0), at least do it like: else if (TARGET_XCOFF && write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG) info->push_p = 1;