From 752098c83a84a75dc1fc565cfa12e1ede3ad149a Mon Sep 17 00:00:00 2001 From: hubicka Date: Wed, 2 Jul 2014 15:23:56 +0000 Subject: * c-decl.c (duplicate_decls): CLear DECL_STRUCT_FUNCTION before releasing symbol. * gcc.c-torture/compile/section.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212234 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/c-decl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gcc/c/c-decl.c') diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 7c37edfd372..3dec90b23ed 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -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) { -- cgit v1.2.1