Commit 46fb43a7 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 8ac385d9
2005-05-06 Jakub Jelinek <jakub@redhat.com>
PR c++/20961
* varasm.c (merge_weak): Remove NEWDECL from WEAK_DECLS chain
if both NEWDECL and OLDDECL are already weak.
2005-05-06 Richard Sandiford <rsandifo@redhat.com>
* config/rs6000/sysv4.h (EXTRA_SUBTARGET_SWITCHES): Delete.
......
2005-05-06 Jakub Jelinek <jakub@redhat.com>
PR c++/20961
* g++.dg/ext/weak3.C: New test.
2005-05-05 Mark Mitchell <mark@codesourcery.com>
PR c++/21352
......
// PR c++/20961
// Test for #pragma weak and __attribute__((weak)) being used together.
// { dg-do compile }
// { dg-require-weak "" }
// { dg-options "" }
// { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?_Z3foov" } }
int foo ();
#pragma weak foo
int
__attribute__((weak))
foo ()
{
return 0;
}
......@@ -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))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment