On Dec 20, 2017, Alexandre Oliva <aol...@redhat.com> wrote: > things work reasonably flawlessly now is not suggestive that it was > easy, or not too intrusive, but rather that the work to make it seamless > despite the intrusiveness was done, at first, and then over time. > That's the reason for -fcompare-debug and the various bootstrap options > that stress it further.
> sparc64-linux-gnu ran into -fcompare-debug failures early in stage3, > the same I ran into before, and that I'll investigate next. The problems I observed on sparc64 were all similar, caused by the delayed branch infrastructure. Here's a patch that fixes it. Testing on sparc64-linux-gnu underway, but I'm posting it right away because it's so obvious. And yet, I ask: ok to install? This fixes stage3 -fcompare-debug builds of at least the builds of libbacktrace/dwarf.o, zlib/deflate.o, and libiberty/cplus-dem.o. [-fcompare-debug] retain insn locations when turning dbr seq into return A number of -fcompare-debug errors on sparc arise as we split a dbr SEQUENCE back into separate insns to turn the branch into a return. If we just take the location from the PREV_INSN, it might be a debug insn without INSN_LOCATION, or an insn with an unrelated location. But that's silly: each of the SEQUENCEd insns is still an insn with its own INSN_LOCATION, so use that instead, even though some may have been adjusted while constructing the SEQUENCE. for gcc/ChangeLog * reorg.c (make_return_insns): Reemit each insn with its own location. --- gcc/reorg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/reorg.c b/gcc/reorg.c index 96778addce52..02d8adc61808 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -3612,9 +3612,14 @@ make_return_insns (rtx_insn *first) delete_related_insns (insn); for (i = 1; i < XVECLEN (pat, 0); i++) - prev = emit_insn_after (PATTERN (XVECEXP (pat, 0, i)), prev); + { + rtx_insn *in_seq_insn = as_a<rtx_insn *> (XVECEXP (pat, 0, i)); + prev = emit_insn_after_setloc (PATTERN (in_seq_insn), prev, + INSN_LOCATION (in_seq_insn)); + } - insn = emit_jump_insn_after (PATTERN (jump_insn), prev); + insn = emit_jump_insn_after_setloc (PATTERN (jump_insn), prev, + INSN_LOCATION (jump_insn)); emit_barrier_after (insn); if (slots) -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer