Patchwork [google/gcc-4_6] Fix -gfission ICEs with pubnames and .debug_addr table (issue6254054)

login
register
mail settings
Submitter Cary Coutant
Date May 25, 2012, 10:29 p.m.
Message ID <20120525222927.CD5AEE0A2C@ccoutant.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/161433/
State New
Headers show

Comments

Cary Coutant - May 25, 2012, 10:29 p.m.
This patch is for the google/gcc-4_6 branch.

It fixes a problem where we were still trying to output entries
in the .debug_addr table for location lists that were removed,
and fixes a problem where we were getting an ICE while trying
to output a pubname for a member function of a struct.

Tested with the GCC testsuite and validate-failures.py, and
also with an internal Google build with -gfission enabled.


2012-05-25   Sterling Augustine  <saugustine@google.com>
	     Cary Coutant  <ccoutant@google.com>

	* gcc/dwarf2out.c (remove_loc_list_addr_table_entries): New function.
	(is_class_die): Return TRUE for DW_TAG_structure_type.
	(resolve_addr): Remove address table entries when replacing a
	location list.



--
This patch is available for review at http://codereview.appspot.com/6254054
Diego Novillo - May 29, 2012, 1:10 p.m.
On 12-05-25 18:29 , Cary Coutant wrote:

> 2012-05-25   Sterling Augustine<saugustine@google.com>
> 	Cary Coutant<ccoutant@google.com>
>
> 	* gcc/dwarf2out.c (remove_loc_list_addr_table_entries): New function.
> 	(is_class_die): Return TRUE for DW_TAG_structure_type.
> 	(resolve_addr): Remove address table entries when replacing a
> 	location list.

OK.


Diego.

Patch

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 187887)
+++ gcc/dwarf2out.c	(working copy)
@@ -7864,6 +7864,19 @@  remove_addr_table_entry (unsigned int i)
   attr->dw_attr = (enum dwarf_attribute) 0;
 }
 
+/* Given a location list, remove all addresses it refers to from the
+   address_table.  */
+
+static void
+remove_loc_list_addr_table_entries (dw_loc_list_ref loc)
+{
+  dw_loc_descr_ref descr;
+
+  for (descr = loc->expr; descr; descr = descr->dw_loc_next)
+    if (descr->dw_loc_oprnd1.val_index != -1U)
+      remove_addr_table_entry (descr->dw_loc_oprnd1.val_index);
+}
+
 /* Add an address constant attribute value to a DIE.  */
 
 static inline void
@@ -10033,7 +10046,8 @@  is_namespace_die (dw_die_ref c)
 static inline bool
 is_class_die (dw_die_ref c)
 {
-  return c && c->die_tag == DW_TAG_class_type;
+  return c && (c->die_tag == DW_TAG_class_type
+	       || c->die_tag == DW_TAG_structure_type);
 }
 
 static char *
@@ -23788,15 +23802,13 @@  resolve_addr (dw_die_ref die)
 		if (!resolve_addr_in_expr ((*curr)->expr))
 		  {
 		    dw_loc_list_ref next = (*curr)->dw_loc_next;
-		    dw_loc_descr_ref l = (*curr)->expr;
 
 		    if (next && (*curr)->ll_symbol)
 		      {
 			gcc_assert (!next->ll_symbol);
 			next->ll_symbol = (*curr)->ll_symbol;
 		      }
-		    if (l->dw_loc_oprnd1.val_index != -1U)
-		      remove_addr_table_entry (l->dw_loc_oprnd1.val_index);
+		    remove_loc_list_addr_table_entries (*curr);
 		    *curr = next;
 		  }
 		else