[PATCH] Fix PR48703

Richard Guenther rguenther@suse.de
Thu Apr 21 15:14:00 GMT 2011


This fixes the fallout of not re-setting the set_decl_assembler_name
langhook with -flto.

Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC2k6 build tested,
installed.

Richard.

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.

Index: gcc/tree.c
===================================================================
*** gcc/tree.c	(revision 172820)
--- gcc/tree.c	(working copy)
*************** free_lang_data_in_decl (tree decl)
*** 4561,4570 ****
    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)
--- 4561,4566 ----
Index: gcc/testsuite/g++.dg/lto/pr48207-2_0.C
===================================================================
*** gcc/testsuite/g++.dg/lto/pr48207-2_0.C	(revision 0)
--- gcc/testsuite/g++.dg/lto/pr48207-2_0.C	(revision 0)
***************
*** 0 ****
--- 1,10 ----
+ // { dg-lto-do link }
+ // { dg-lto-options { { -flto -g } } }
+ 
+ namespace {
+     typedef struct {
+ 	int x;
+     } Foo;
+ }
+ 
+ int main () {}
Index: gcc/testsuite/g++.dg/lto/pr48207-3_0.C
===================================================================
*** gcc/testsuite/g++.dg/lto/pr48207-3_0.C	(revision 0)
--- gcc/testsuite/g++.dg/lto/pr48207-3_0.C	(revision 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 () {}



More information about the Gcc-patches mailing list