diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-05-06 11:16:24 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2005-05-06 11:16:24 +0200 |
commit | 46fb43a7cf213582042c78ff14fc11e039012a72 (patch) | |
tree | 591f1429a9825ae3b516a969900030bb459944ad /gcc/varasm.c | |
parent | 8ac385d9ecf7417ad7e855a8d367513d6fd58876 (diff) | |
download | gcc-46fb43a7cf213582042c78ff14fc11e039012a72.zip gcc-46fb43a7cf213582042c78ff14fc11e039012a72.tar.gz gcc-46fb43a7cf213582042c78ff14fc11e039012a72.tar.bz2 |
re PR c++/20961 (ICE on pragma weak/__attribute__((weak)))
PR c++/20961
* varasm.c (merge_weak): Remove NEWDECL from WEAK_DECLS chain
if both NEWDECL and OLDDECL are already weak.
* g++.dg/ext/weak3.C: New test.
From-SVN: r99306
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index f0799e1..6f6a817 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4303,7 +4303,21 @@ void merge_weak (tree newdecl, tree olddecl) { if (DECL_WEAK (newdecl) == DECL_WEAK (olddecl)) - return; + { + if (DECL_WEAK (newdecl) && SUPPORTS_WEAK) + { + tree *pwd; + /* We put the NEWDECL on the weak_decls list at some point + and OLDDECL as well. Keep just OLDDECL on the list. */ + for (pwd = &weak_decls; *pwd; pwd = &TREE_CHAIN (*pwd)) + if (TREE_VALUE (*pwd) == newdecl) + { + *pwd = TREE_CHAIN (*pwd); + break; + } + } + return; + } if (DECL_WEAK (newdecl)) { |