]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR lto/51198 ([c++0x] [4.7 Regression] ICE with -flto and non-static data member...
authorAndrew Pinski <apinski@cavium.com>
Thu, 1 Dec 2011 17:13:05 +0000 (17:13 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Thu, 1 Dec 2011 17:13:05 +0000 (09:13 -0800)
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  Andrew Pinski  <apinski@cavium.com>

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

From-SVN: r181886

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

index f82b8bce40d299f7622d6cfbdad431ae51ac6ed3..693036823b1c4167e994257fc0e05e2d9f02dc77 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 7d74e8b99aa6003f107cdc4434060f886c602828..b7e73f13e52a3685bf13688a25fddcfadf9f7873 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 72603b59945ad299bf9fd2556c04a0be90b19604..4cadc7ef8c4961316f8ec35e76df46d10fc9524b 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)