OSDN Git Service

2011-12-01 Andrew Pinski <apinski@cavium.com>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Dec 2011 17:13:05 +0000 (17:13 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Dec 2011 17:13:05 +0000 (17:13 +0000)
PR lto/51198
* tree.c (free_lang_data_in_decl): Clear FIELD_DECL's
DECL_INITIAL also.

2011-12-01  Andrew Pinski  <apinski@cavium.com>

PR lto/51198
* g++.dg/torture/pr51198.C: New testcase.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr51198.C [new file with mode: 0644]
gcc/tree.c

index f82b8bc..6930368 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-01  Andrew Pinski  <apinski@cavium.com>
+
+       PR lto/51198
+       * tree.c (free_lang_data_in_decl): Clear FIELD_DECL's
+       DECL_INITIAL also.
+
 2011-12-01  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/51246
index 7d74e8b..b7e73f1 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-01  Andrew Pinski  <apinski@cavium.com>
+
+       PR lto/51198
+       * g++.dg/torture/pr51198.C: New testcase.
+
 2011-12-01  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/51246
diff --git a/gcc/testsuite/g++.dg/torture/pr51198.C b/gcc/testsuite/g++.dg/torture/pr51198.C
new file mode 100644 (file)
index 0000000..65009ff
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-options "-std=gnu++0x" } */
+
+struct A
+{
+  int i = 0 ? 0 : throw 1;
+};
+
+
+struct B
+{
+  int f();
+  int i = f();
+};
+
+struct C
+{
+  C(int);
+};
+
+struct D
+{
+  C a = 0;
+};
+
+A a;
+B b;
+D d;
+
+
index 72603b5..4cadc7e 100644 (file)
@@ -4651,7 +4651,8 @@ free_lang_data_in_decl (tree decl)
          || (decl_function_context (decl) && !TREE_STATIC (decl)))
        DECL_INITIAL (decl) = NULL_TREE;
     }
-  else if (TREE_CODE (decl) == TYPE_DECL)
+  else if (TREE_CODE (decl) == TYPE_DECL
+          || TREE_CODE (decl) == FIELD_DECL)
     DECL_INITIAL (decl) = NULL_TREE;
   else if (TREE_CODE (decl) == TRANSLATION_UNIT_DECL
            && DECL_INITIAL (decl)