dwarf2out.c (gen_variable_die): Treat un-emitted COMDAT variables as declarations, rather than definitions.

* dwarf2out.c (gen_variable_die): Treat un-emitted COMDAT
	variables as declarations, rather than definitions.

From-SVN: r102335
This commit is contained in:
Mark Mitchell 2005-07-24 16:33:53 +00:00 committed by Mark Mitchell
parent 19791f70aa
commit 2b4029550f
2 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2005-07-23 Mark Mitchell <mark@codesourcery.com>
* dwarf2out.c (gen_variable_die): Treat un-emitted COMDAT
variables as declarations, rather than definitions.
2005-07-24 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/22526

View File

@ -11626,6 +11626,25 @@ gen_variable_die (tree decl, dw_die_ref context_die)
dw_die_ref old_die = lookup_decl_die (decl);
int declaration = (DECL_EXTERNAL (decl)
/* If DECL is COMDAT and has not actually been
emitted, we cannot take its address; there
might end up being no definition anywhere in
the program. For example, consider the C++
test case:
template <class T>
struct S { static const int i = 7; };
template <class T>
const int S<T>::i;
int f() { return S<int>::i; }
Here, S<int>::i is not DECL_EXTERNAL, but no
definition is required, so the compiler will
not emit a definition. */
|| (TREE_CODE (decl) == VAR_DECL
&& DECL_COMDAT (decl) && !TREE_ASM_WRITTEN (decl))
|| class_or_namespace_scope_p (context_die));
if (origin != NULL)