diff mbox series

[1/3] dwarf: Delete dead code.

Message ID f507bd98cab07850abb6c4e8353d1606626f2ce0.1730900527.git.mjires@suse.cz
State New
Headers show
Series dwarf: incremental lto: Stabilize external references. | expand

Commit Message

Michal Jires Nov. 6, 2024, 2:34 p.m. UTC
This if branch checks for comdat_type_p (GTY union tag) and then uses
incorrect union variant die_id.die_symbol. There is no way to create
this combination of valid values even if we ignore the GTY.

Running testsuite with abort() in branch confirms that it is never taken.

gcc/ChangeLog:

	* dwarf2out.cc (output_comp_unit): Delete dead code.
---
 gcc/dwarf2out.cc | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)
diff mbox series

Patch

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 38aedb64470..e10a5c78fe9 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -11234,8 +11234,7 @@  static void
 output_comp_unit (dw_die_ref die, int output_if_empty,
 		  const unsigned char *dwo_id)
 {
-  const char *secname, *oldsym;
-  char *tmp;
+  const char *oldsym;
 
   /* Unless we are outputting main CU, we may throw away empty ones.  */
   if (!output_if_empty && die->die_child == NULL)
@@ -11269,21 +11268,10 @@  output_comp_unit (dw_die_ref die, int output_if_empty,
   calc_die_sizes (die);
 
   oldsym = die->die_id.die_symbol;
-  if (oldsym && die->comdat_type_p)
-    {
-      tmp = XALLOCAVEC (char, strlen (oldsym) + 24);
 
-      sprintf (tmp, ".gnu.linkonce.wi.%s", oldsym);
-      secname = tmp;
-      die->die_id.die_symbol = NULL;
-      switch_to_section (get_section (secname, SECTION_DEBUG, NULL));
-    }
-  else
-    {
-      switch_to_section (debug_info_section);
-      ASM_OUTPUT_LABEL (asm_out_file, debug_info_section_label);
-      info_section_emitted = true;
-    }
+  switch_to_section (debug_info_section);
+  ASM_OUTPUT_LABEL (asm_out_file, debug_info_section_label);
+  info_section_emitted = true;
 
   /* For LTO cross unit DIE refs we want a symbol on the start of the
      debuginfo section, not on the CU DIE.  */
@@ -11322,10 +11310,7 @@  output_comp_unit (dw_die_ref die, int output_if_empty,
   /* Leave the marks on the main CU, so we can check them in
      output_pubnames.  */
   if (oldsym)
-    {
-      unmark_dies (die);
-      die->die_id.die_symbol = oldsym;
-    }
+    unmark_dies (die);
 }
 
 /* Whether to generate the DWARF accelerator tables in .debug_pubnames