This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


        * 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);
-      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
+      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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]