diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-07-24 16:33:53 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2005-07-24 16:33:53 +0000 |
commit | 2b4029550fba3d7d2c413e285eab58c3a5e40f55 (patch) | |
tree | deaf73af7e1a9a3ca9c76ee1f63aa9466c04d81a | |
parent | 19791f70aa2c2153966b5c130e4b42ddf89c1f23 (diff) | |
download | gcc-2b4029550fba3d7d2c413e285eab58c3a5e40f55.zip gcc-2b4029550fba3d7d2c413e285eab58c3a5e40f55.tar.gz gcc-2b4029550fba3d7d2c413e285eab58c3a5e40f55.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ca336b3..77d0723 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b4be052..dd3bd5f 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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) |