From 056cf43428e87bff0703ab4a6ec3558a90328be4 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 21 Dec 2017 18:14:21 +0000 Subject: [PATCH] [-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. From-SVN: r255948 --- gcc/ChangeLog | 5 +++++ gcc/reorg.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2851eb67cc4..7200561a332 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-12-21 Alexandre Oliva + + * reorg.c (make_return_insns): Reemit each insn with its own + location. + 2017-12-21 Alexandre Oliva PR debug/83419 diff --git a/gcc/reorg.c b/gcc/reorg.c index 96778addce5..02d8adc6180 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 (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) -- 2.30.2