OSDN Git Service

2011-12-12 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Dec 2011 08:37:22 +0000 (08:37 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Dec 2011 08:37:22 +0000 (08:37 +0000)
PR lto/51262
* tree.c (cp_free_lang_data): No longer clear anonymous names.

* g++.dg/opt/pr51262.C: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182221 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr51262.C [new file with mode: 0644]

index 8090030..1ba9f34 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-12  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/51262
+       * tree.c (cp_free_lang_data): No longer clear anonymous names.
+
 2011-12-09  Jason Merrill  <jason@redhat.com>
 
        PR c++/51151
index 8d179d8..7899397 100644 (file)
@@ -3479,17 +3479,6 @@ cp_free_lang_data (tree t)
       DECL_EXTERNAL (t) = 1;
       TREE_STATIC (t) = 0;
     }
-  if (CP_AGGREGATE_TYPE_P (t)
-      && TYPE_NAME (t))
-    {
-      tree name = TYPE_NAME (t);
-      if (TREE_CODE (name) == TYPE_DECL)
-       name = DECL_NAME (name);
-      /* Drop anonymous names.  */
-      if (name != NULL_TREE
-         && ANON_AGGRNAME_P (name))
-       TYPE_NAME (t) = NULL_TREE;
-    }
   if (TREE_CODE (t) == NAMESPACE_DECL)
     {
       /* The list of users of a namespace isn't useful for the middle-end
index ba6d3c4..1d78adf 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-12  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/51262
+       * g++.dg/opt/pr51262.C: New testcase.
+
 2011-12-12  Revital Eres  <revital.eres@linaro.org>
 
        PR rtl-optimization/47013
diff --git a/gcc/testsuite/g++.dg/opt/pr51262.C b/gcc/testsuite/g++.dg/opt/pr51262.C
new file mode 100644 (file)
index 0000000..d0e8d78
--- /dev/null
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-require-effective-target lto }
+// { dg-options "-flto -g" }
+
+template < typename > void *
+bar (int *p)
+{
+  union
+    {
+      int *p;
+    }
+  u;
+  u.p = p;
+  return u.p;
+}
+
+void
+foo (int *p)
+{
+  bar < void >(p);
+}