c-decl.c (duplicate_decls): CLear DECL_STRUCT_FUNCTION before releasing symbol.

* c-decl.c (duplicate_decls): CLear DECL_STRUCT_FUNCTION before
	releasing symbol.

	* gcc.c-torture/compile/section.c: New testcase.

Co-Authored-By: Chen Gang <gang.chen.5i5j@gmail.com>

From-SVN: r212234
This commit is contained in:
Jan Hubicka 2014-07-02 17:23:56 +02:00 committed by Jan Hubicka
parent 9490fda67a
commit 22e1cf1ced
4 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2014-07-02 Jan Hubicka <hubicka@ucw.cz>
Chen Gang <gang.chen.5i5j@gmail.com>
* c-decl.c (duplicate_decls): CLear DECL_STRUCT_FUNCTION before
releasing symbol.
2014-07-01 Marek Polacek <polacek@redhat.com>
* c-typeck.c (convert_for_assignment): Pass OPT_Wint_conversion

View File

@ -2575,7 +2575,14 @@ duplicate_decls (tree newdecl, tree olddecl)
merge_decls (newdecl, olddecl, newtype, oldtype);
/* The NEWDECL will no longer be needed. */
/* The NEWDECL will no longer be needed.
Before releasing the node, be sure to remove function from symbol
table that might have been inserted there to record comdat group.
Be sure to however do not free DECL_STRUCT_FUNCTION because this
structure is shared in between NEWDECL and OLDECL. */
if (TREE_CODE (newdecl) == FUNCTION_DECL)
DECL_STRUCT_FUNCTION (newdecl) = NULL;
if (TREE_CODE (newdecl) == FUNCTION_DECL
|| TREE_CODE (newdecl) == VAR_DECL)
{

View File

@ -1,3 +1,8 @@
2014-07-02 Jan Hubicka <hubicka@ucw.cz>
Chen Gang <gang.chen.5i5j@gmail.com>
* gcc.c-torture/compile/section.c: New testcase.
2014-07-02 Christian Bruel <christian.bruel@st.com>
PR target/29349

View File

@ -0,0 +1,8 @@
/* { dg-do compile } */
/* { dg-require-effective-target named_sections } */
extern int __attribute__ ((__section__(".init.text"))) elv_register(void)
{
return 0;
}
extern typeof(elv_register) elv_register;