This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR51650


On Mon, 2 Jan 2012, Jason Merrill wrote:

> On 01/02/2012 10:49 AM, Richard Guenther wrote:
> > For the idea creating the DIE at the point we process the limbo DIE
> > yes.  But would you consider doing that unconditional or only for LTO?
> 
> Unconditional.  Anything that already passed the assert should be unaffected
> by the change.

There is a change in case the context is a FUNCTION_DECL or a
NAMESPACE_DECL and the DIE for it is not already present.  Previously
we'd add the DIE to comp_unit_die (), now we are going to create
a DIE for the function/namespace (which sounds better anyway,
or if that was not supposed to happen we should have asserted that).

> > I can certainly give it a shot.  Just to check, do you mean the
> > following?
> 
> Yes.

Ok, I committed the following.

[LTO] Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC 2k6
LTO build tested.

Richard.

2012-01-03  Richard Guenther  <rguenther@suse.de>

	PR debug/51650
	* dwarf2out.c (dwarf2out_finish): Always create a DIE for
	the context of a limbo DIE when it does not already exist.

	* g++.dg/lto/pr51650-3_0.C: New testcase.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 182784)
+++ gcc/dwarf2out.c	(working copy)
@@ -22501,15 +22501,8 @@ dwarf2out_finish (const char *filename)
 	      else if (TYPE_P (node->created_for))
 		context = TYPE_CONTEXT (node->created_for);
 
-	      gcc_assert (context
-			  && (TREE_CODE (context) == FUNCTION_DECL
-			      || TREE_CODE (context) == NAMESPACE_DECL));
-
-	      origin = lookup_decl_die (context);
-	      if (origin)
-	        add_child_die (origin, die);
-	      else
-	        add_child_die (comp_unit_die (), die);
+	      origin = get_context_die (context);
+	      add_child_die (origin, die);
 	    }
 	}
     }
Index: gcc/testsuite/g++.dg/lto/pr51650-3_0.C
===================================================================
--- gcc/testsuite/g++.dg/lto/pr51650-3_0.C	(revision 0)
+++ gcc/testsuite/g++.dg/lto/pr51650-3_0.C	(revision 0)
@@ -0,0 +1,20 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -g } } }
+
+struct T;
+struct C 
+{
+    typedef ::T T;
+    virtual void E();
+    static T *m ()
+      {
+	static T *d;
+	return d;
+      }
+};
+int
+fn ()
+{
+  C::m ();
+}
+int main() {}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]