From aa2a43d2e803ed840117e86c7a3d1684498e19fc Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Thu, 21 Apr 2011 14:35:43 +0000 Subject: [PATCH] re PR debug/48703 (segfault in canonicalize_for_substitution) 2011-04-21 Richard Guenther 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 | 6 ++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/lto/pr48207-2_0.C | 10 ++++++++++ gcc/testsuite/g++.dg/lto/pr48207-3_0.C | 12 ++++++++++++ gcc/tree.c | 4 ---- 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/lto/pr48207-2_0.C create mode 100644 gcc/testsuite/g++.dg/lto/pr48207-3_0.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 34492bba7a8..3ed9e91cab1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-04-21 Richard Guenther + + PR lto/48703 + * tree.c (free_lang_data_in_decl): Do not zero TREE_TYPE of + DECL_NAME. + 2011-04-21 Eric Botcazou * gimple.c (walk_gimple_op) : Fix couple of oversights. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89541bad741..2b3d70f3ac7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-04-21 Richard Guenther + + 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 * 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 index 00000000000..6801b85a862 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr48207-2_0.C @@ -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 index 00000000000..ef02dda8400 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr48207-3_0.C @@ -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 () {} diff --git a/gcc/tree.c b/gcc/tree.c index d0c18b17ae2..b37b7f8a446 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -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) -- 2.30.2