Patchwork [google/gcc-4_7] Fix ICE in output_pubnames where union contains a ctor

login
register
mail settings
Submitter Cary Coutant
Date Aug. 17, 2012, 10:09 p.m.
Message ID <20120817220951.622DEE0426@ccoutant.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/178402/
State New
Headers show

Comments

Cary Coutant - Aug. 17, 2012, 10:09 p.m.
This patch is for the google/gcc-4_7 branch.  I'll submit it for trunk
after the Fission patches have gone in.

When adding names to the pubnames table (-gsplit-dwarf or -gpubnames),
a method within a union may not get handled properly, sometimes resulting
in an internal compiler error in output_pubnames().

This patch fixes the problem by using the existing predicate,
class_scope_p, instead of is_class_die, which failed to test for
a union type.


2012-08-17   Cary Coutant  <ccoutant@google.com>

gcc/
	* dwarf2out.c (is_class_die): Remove function.
	(add_pubname): Call class_scope_p instead.
Sterling Augustine - Aug. 17, 2012, 10:19 p.m.
On Fri, Aug 17, 2012 at 3:09 PM, Cary Coutant <ccoutant@google.com> wrote:
> This patch is for the google/gcc-4_7 branch.  I'll submit it for trunk
> after the Fission patches have gone in.
>
> When adding names to the pubnames table (-gsplit-dwarf or -gpubnames),
> a method within a union may not get handled properly, sometimes resulting
> in an internal compiler error in output_pubnames().
>
> This patch fixes the problem by using the existing predicate,
> class_scope_p, instead of is_class_die, which failed to test for
> a union type.

OK for Google 4.7

Sterling
Cary Coutant - Aug. 17, 2012, 10:57 p.m.
> OK for Google 4.7

Thanks, committed at r190494.

-cary

Patch

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 190490)
+++ gcc/dwarf2out.c	(working copy)
@@ -7035,15 +7035,6 @@  is_namespace_die (dw_die_ref c)
   return c && c->die_tag == DW_TAG_namespace;
 }
 
-/* Returns true iff C is a class or structure DIE.  */
-
-static inline bool
-is_class_die (dw_die_ref c)
-{
-  return c && (c->die_tag == DW_TAG_class_type
-               || c->die_tag == DW_TAG_structure_type);
-}
-
 static char *
 gen_internal_sym (const char *prefix)
 {
@@ -9314,7 +9305,7 @@  add_pubname (tree decl, dw_die_ref die)
      class_member, it will either be inside the class already, or will have just
      looked up the class to find the member.  Either way, searching the class is
      faster than searching the index.  */
-  if ((TREE_PUBLIC (decl) && !is_class_die (die->die_parent))
+  if ((TREE_PUBLIC (decl) && !class_scope_p (die->die_parent))
       || is_cu_die (die->die_parent) || is_namespace_die (die->die_parent))
     {
       const char *name = dwarf2_name (decl, 1);