aboutsummaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2013-08-20 13:29:53 +0000
committerTeresa Johnson <tejohnson@gcc.gnu.org>2013-08-20 13:29:53 +0000
commit67598720afc44795500b02e86dfcdd982b9669d4 (patch)
treed7ed91c64916897863742efb289c1ae31a67af93 /gcc/final.c
parentc5918c2199ee193f86cfafb9ad9fb040d7a60a14 (diff)
downloadgcc-67598720afc44795500b02e86dfcdd982b9669d4.zip
gcc-67598720afc44795500b02e86dfcdd982b9669d4.tar.gz
gcc-67598720afc44795500b02e86dfcdd982b9669d4.tar.bz2
re PR rtl-optimization/57451 (Incorrect debug ranges emitted for -freorder-blocks-and-partition -g)
2013-08-20 Teresa Johnson <tejohnson@google.com> PR rtl-optimizations/57451 * final.c (reemit_insn_block_notes): Prevent lexical blocks from crossing split section boundaries. * testsuite/g++.dg/tree-prof/pr57451.C: New test. From-SVN: r201883
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/final.c b/gcc/final.c
index 31ced4f..4eaae0f 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1650,12 +1650,26 @@ reemit_insn_block_notes (void)
rtx insn, note;
insn = get_insns ();
- if (!active_insn_p (insn))
- insn = next_active_insn (insn);
- for (; insn; insn = next_active_insn (insn))
+ for (; insn; insn = next_insn (insn))
{
tree this_block;
+ /* Prevent lexical blocks from straddling section boundaries. */
+ if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_SWITCH_TEXT_SECTIONS)
+ {
+ for (tree s = cur_block; s != DECL_INITIAL (cfun->decl);
+ s = BLOCK_SUPERCONTEXT (s))
+ {
+ rtx note = emit_note_before (NOTE_INSN_BLOCK_END, insn);
+ NOTE_BLOCK (note) = s;
+ note = emit_note_after (NOTE_INSN_BLOCK_BEG, insn);
+ NOTE_BLOCK (note) = s;
+ }
+ }
+
+ if (!active_insn_p (insn))
+ continue;
+
/* Avoid putting scope notes between jump table and its label. */
if (JUMP_TABLE_DATA_P (insn))
continue;