diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-07-02 17:23:56 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-07-02 15:23:56 +0000 |
commit | 22e1cf1ced6f9e72cf7d4dad64747b8303221fda (patch) | |
tree | aa99241265ddf88291e648e9f877d111090e5833 /gcc/c | |
parent | 9490fda67a801ad2618849b2d3a60b920d3713ca (diff) | |
download | gcc-22e1cf1ced6f9e72cf7d4dad64747b8303221fda.zip gcc-22e1cf1ced6f9e72cf7d4dad64747b8303221fda.tar.gz gcc-22e1cf1ced6f9e72cf7d4dad64747b8303221fda.tar.bz2 |
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
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 1c19362..68abca4 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -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 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 7c37edf..3dec90b 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) { |