diff mbox

[google] fix error caught by TREE_CHECKING (issue5401045)

Message ID 20111117003716.56BECC22D0@rong.mtv.corp.google.com
State New
Headers show

Commit Message

Rong Xu Nov. 17, 2011, 12:37 a.m. UTC
Fix a regression introduced in r180971. Only applicable to LIPO.

For google branch only.
Tested with internal benchmark suite.

Thanks,

-Rong

2011-11-16   Rong Xu  <xur@google.com>

	* gcc/dwarf2out.c: use TYPE_CONTEXT to get the context for types.


--
This patch is available for review at http://codereview.appspot.com/5401045
diff mbox

Patch

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 181431)
+++ gcc/dwarf2out.c	(working copy)
@@ -19764,10 +19764,6 @@ 
       {
         struct cgraph_node *node;
 
-        orig_decl = DECL_ORIGIN (decl_context);
-        while (orig_decl != DECL_ORIGIN (orig_decl))
-          orig_decl = DECL_ORIGIN (orig_decl);
-
         /* Refer to cgraph_mark_functions_to_output() in cgraphunit.c,
            if cgraph_is_aux_decl_external() is true,
            this function will not be output in LIPO mode.  */
@@ -19777,6 +19773,16 @@ 
             cgraph_is_aux_decl_external (node))
           return;
 
+        if (TREE_CODE_CLASS (TREE_CODE (decl_context)) == tcc_type)
+          {
+            decl_context = TYPE_CONTEXT (decl_context);
+            continue;
+          }
+
+        orig_decl = DECL_ORIGIN (decl_context);
+        while (orig_decl != DECL_ORIGIN (orig_decl))
+          orig_decl = DECL_ORIGIN (orig_decl);
+
         decl_context = DECL_CONTEXT (orig_decl);
       }
     }