https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104237
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dmalcolm at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- *.optimized looks the same, code generation diverges in *.expand. The difference is that unique_locus_on_edge_between_p returns false vs. true in between bb 2 and bb 4. goto_locus is 0x80000002 in both cases, that expand_location to: "pr104237.c":6:10 in both cases. But the: (insn 10005 10004 10007 2 (set (reg:QI 84 [ D.4728 ]) (subreg:QI (reg:SI 86) 0)) "pr104237.c":6:10 -1 (nil)) insn at the end of bb 2 has INSN_LOCATION 0x80000002 in the -g0 case and INSN_LOCATION 0x80000004 in the -g case. This means 799 if (insn != end && INSN_LOCATION (insn) == goto_locus) 800 return false; in unique_locus_on_edge_between_p returns false in the -g0 case and true in -g case and a nop is emitted only in the latter case. The really strange thing is that (in the -g build): (gdb) p expand_location (0x80000002) $24 = {file = 0x3b6ba60 "pr104237.c", line = 6, column = 10, data = 0x7fffea06f180, sysp = false} (gdb) p expand_location (0x80000004) $25 = {file = 0x3b6ba60 "pr104237.c", line = 6, column = 10, data = 0x7fffea06f180, sysp = false} i.e. everything is the same. Even the adhoc table for 2 and 4: (gdb) p line_table->location_adhoc_data_map.data[2] $26 = {locus = 54368, src_range = {m_start = 54368, m_finish = 54368}, data = 0x7fffea06f180} (gdb) p line_table->location_adhoc_data_map.data[4] $27 = {locus = 58720, src_range = {m_start = 58720, m_finish = 58720}, data = 0x7fffea06f180} contains different data, so even comparing LOCATION_LOCUS (INSN_LOCATION (insn)) == LOCATION_LOCUS (goto_locus) wouldn't work here. David, any idea on what the difference between 54368 and 58720 above could be and why (gdb) p expand_location (54368) $28 = {file = 0x3b6ba60 "pr104237.c", line = 6, column = 10, data = 0x0, sysp = false} (gdb) p expand_location (58720) $29 = {file = 0x3b6ba60 "pr104237.c", line = 6, column = 10, data = 0x0, sysp = false} ? Do we compare locations anywhere else (twice in cfgrtl.cc)? Is the only reliable comparison expand_location and comparing the members of that?