diff mbox

Fwd: [Bug debug/53754] [4.8 Regression][lto] ICE in lhd_decl_printable_name, at langhooks.c:222 (with -g)

Message ID CAHACq4oGhsgaXZWGE-GCAYS0LGLxjZWBxfxVZy+Edbcy5hLZFg@mail.gmail.com
State New
Headers show

Commit Message

Cary Coutant June 29, 2012, 8:54 p.m. UTC
>> That's sensible anyways - you avoid useless work.  So the patch is ok.
>
> OK, I'll submit this patch, but leave the PR open and follow up with
> something to fix the underlying problem as you suggest.

Here's the patch I'm committing (as soon as bootstrap and testing completes)...

-cary


2012-06-29   Cary Coutant  <ccoutant@google.com>

gcc/
	* dwarf2out.c (add_pubname_string): Don't check for want_pubnames.
	(gen_subprogram_die): Don't add pubname if want_pubnames is false.
	(gen_variable_die): Likewise.
	(gen_namespace_die): Likewise.
diff mbox

Patch

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 189082)
+++ gcc/dwarf2out.c	(working copy)
@@ -8152,14 +8152,11 @@  dwarf2_name (tree decl, int scope)
 static void
 add_pubname_string (const char *str, dw_die_ref die)
 {
-  if (want_pubnames ())
-    {
-      pubname_entry e;
+  pubname_entry e;

-      e.die = die;
-      e.name = xstrdup (str);
-      VEC_safe_push (pubname_entry, gc, pubname_table, &e);
-    }
+  e.die = die;
+  e.name = xstrdup (str);
+  VEC_safe_push (pubname_entry, gc, pubname_table, &e);
 }

 static void
@@ -17141,7 +17138,8 @@  gen_subprogram_die (tree decl, dw_die_re
 		  add_AT_lbl_id (seg_die, DW_AT_high_pc,
 				 fde->dw_fde_second_end);
 		  add_name_attribute (seg_die, name);
-		  add_pubname_string (name, seg_die);
+		  if (want_pubnames ())
+		    add_pubname_string (name, seg_die);
 		}
 	    }
 	  else
@@ -17566,7 +17564,8 @@  gen_variable_die (tree decl, tree origin
 	    }
           else if (DECL_EXTERNAL (decl))
 	    add_AT_flag (com_die, DW_AT_declaration, 1);
-	  add_pubname_string (cnam, com_die); /* ??? needed? */
+	  if (want_pubnames ())
+	    add_pubname_string (cnam, com_die); /* ??? needed? */
 	  com_die->decl_id = DECL_UID (com_decl);
 	  slot = htab_find_slot (common_block_die_table, com_die, INSERT);
 	  *slot = (void *) com_die;
@@ -19192,7 +19191,8 @@  gen_namespace_die (tree decl, dw_die_ref
       equate_decl_number_to_die (decl, namespace_die);
     }
   /* Bypass dwarf2_name's check for DECL_NAMELESS.  */
-  add_pubname_string (lang_hooks.dwarf_name (decl, 1), namespace_die);
+  if (want_pubnames ())
+    add_pubname_string (lang_hooks.dwarf_name (decl, 1), namespace_die);
 }

 /* Generate Dwarf debug information for a decl described by DECL.