re PR debug/48703 (segfault in canonicalize_for_substitution)
authorRichard Guenther <rguenther@suse.de>
Thu, 21 Apr 2011 14:35:43 +0000 (14:35 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 21 Apr 2011 14:35:43 +0000 (14:35 +0000)
2011-04-21  Richard Guenther  <rguenther@suse.de>

PR lto/48703
* tree.c (free_lang_data_in_decl): Do not zero TREE_TYPE of
DECL_NAME.

* g++.dg/lto/pr48207-2_0.C: New testcase.
* g++.dg/lto/pr48207-3_0.C: Likewise.

From-SVN: r172830

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/pr48207-2_0.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lto/pr48207-3_0.C [new file with mode: 0644]
gcc/tree.c

index 34492bba7a871cd1096feced5e0a550f99607a00..3ed9e91cab198cd26573d4c99063ad4a7b4f7709 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-21  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/48703
+       * tree.c (free_lang_data_in_decl): Do not zero TREE_TYPE of
+       DECL_NAME.
+
 2011-04-21  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gimple.c (walk_gimple_op) <GIMPLE_CALL>: Fix couple of oversights.
index 89541bad74185473eed0adb28db3abc6b328407b..2b3d70f3ac7a4b67c2574df37529deadb5a89f7e 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-21  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/48703
+       * g++.dg/lto/pr48207-2_0.C: New testcase.
+       * g++.dg/lto/pr48207-3_0.C: Likewise.
+
 2011-04-21  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/volatile5.adb: New test.
diff --git a/gcc/testsuite/g++.dg/lto/pr48207-2_0.C b/gcc/testsuite/g++.dg/lto/pr48207-2_0.C
new file mode 100644 (file)
index 0000000..6801b85
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -g } } }
+
+namespace {
+    typedef struct {
+       int x;
+    } Foo;
+}
+
+int main () {}
diff --git a/gcc/testsuite/g++.dg/lto/pr48207-3_0.C b/gcc/testsuite/g++.dg/lto/pr48207-3_0.C
new file mode 100644 (file)
index 0000000..ef02dda
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -g } } }
+
+void bar(void) {}
+
+void foo(void)
+{
+  typedef enum { ABC } DEF;
+  bar();
+}
+
+int main () {}
index d0c18b17ae2ff9671158865a5ceda18697967f45..b37b7f8a446df9f8bb1a7fe06a91249fc3345adb 100644 (file)
@@ -4561,10 +4561,6 @@ free_lang_data_in_decl (tree decl)
   TREE_LANG_FLAG_5 (decl) = 0;
   TREE_LANG_FLAG_6 (decl) = 0;
 
-  /* Identifiers need not have a type.  */
-  if (DECL_NAME (decl))
-    TREE_TYPE (DECL_NAME (decl)) = NULL_TREE;
-
   free_lang_data_in_one_sizepos (&DECL_SIZE (decl));
   free_lang_data_in_one_sizepos (&DECL_SIZE_UNIT (decl));
   if (TREE_CODE (decl) == FIELD_DECL)