re PR middle-end/41611 (guard variable is emitted even when the guarded symbol isn't)

PR c++/41611
	* decl2.c (get_guard): Copy DECL_COMDAT.
	(comdat_linkage): Set DECL_COMDAT unconditionally.

From-SVN: r154885
This commit is contained in:
Jason Merrill 2009-12-01 16:58:04 -05:00 committed by Jason Merrill
parent e4ad8df086
commit 0735734176
4 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2009-12-01 Jason Merrill <jason@redhat.com>
PR c++/41611
* decl2.c (get_guard): Copy DECL_COMDAT.
(comdat_linkage): Set DECL_COMDAT unconditionally.
2009-12-01 Jakub Jelinek <jakub@redhat.com>
PR c++/3187

View File

@ -1574,8 +1574,7 @@ comdat_linkage (tree decl)
}
}
if (DECL_LANG_SPECIFIC (decl))
DECL_COMDAT (decl) = 1;
DECL_COMDAT (decl) = 1;
}
/* For win32 we also want to put explicit instantiations in
@ -2555,6 +2554,7 @@ get_guard (tree decl)
TREE_PUBLIC (guard) = TREE_PUBLIC (decl);
TREE_STATIC (guard) = TREE_STATIC (decl);
DECL_COMMON (guard) = DECL_COMMON (decl);
DECL_COMDAT (guard) = DECL_COMDAT (decl);
DECL_COMDAT_GROUP (guard) = DECL_COMDAT_GROUP (decl);
if (TREE_PUBLIC (decl))
DECL_WEAK (guard) = DECL_WEAK (decl);

View File

@ -1,3 +1,8 @@
2009-12-01 Jason Merrill <jason@redhat.com>
PR c++/41611
* g++.dg/abi/guard1.C: New.
2009-12-91 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/vperm-v4sf-1.c (dg-options): Use -msse.

View File

@ -0,0 +1,10 @@
// PR c++/41611
// { dg-final { scan-assembler-not "_ZGVZN1A1fEvE1i" } }
struct A {
static int f()
{
static int &i = *new int();
return i;
}
};