This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix gen_label_die for removed labels.
- From: Richard Henderson <rth at twiddle dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 10 Nov 2003 15:52:32 -0800
- Subject: Fix gen_label_die for removed labels.
This came up on tree-ssa branch, where a user label was removed
along with an entire branch of an provably false if conditional.
I forget the exact testcase to which this applies.
I am of the opinion that it is not worth preserving these labels
at all costs, especially if they're not referenced by the code
itself. I think it's better to have gdb say "label optimized out"
rather than give it a random address, as we do with rtl.
Applied to mainline as well, for robustness.
r~
* dwarf2out.c (gen_label_die): Cope with DECL_RTL not set.
Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.379.2.29
diff -u -p -r1.379.2.29 dwarf2out.c
--- gcc/dwarf2out.c 28 Oct 2003 14:56:15 -0000 1.379.2.29
+++ gcc/dwarf2out.c 10 Nov 2003 23:36:47 -0000
@@ -10918,14 +10918,15 @@ gen_label_die (tree decl, dw_die_ref con
equate_decl_number_to_die (decl, lbl_die);
else
{
- insn = DECL_RTL (decl);
+ insn = DECL_RTL_IF_SET (decl);
/* Deleted labels are programmer specified labels which have been
eliminated because of various optimizations. We still emit them
here so that it is possible to put breakpoints on them. */
- if (GET_CODE (insn) == CODE_LABEL
- || ((GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL)))
+ if (insn
+ && (GET_CODE (insn) == CODE_LABEL
+ || ((GET_CODE (insn) == NOTE
+ && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL))))
{
/* When optimization is enabled (via -O) some parts of the compiler
(e.g. jump.c and cse.c) may try to delete CODE_LABEL insns which