diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-22 04:40:55 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-22 04:40:55 +0000 |
commit | b622b5f5872f072c0625b5223713ea8a20e1864a (patch) | |
tree | e22fe7615ee1389c780a25cb850770d52956f4b2 | |
parent | 8447804f44ed11ba77054620daed0e48c1724420 (diff) | |
download | gcc-b622b5f5872f072c0625b5223713ea8a20e1864a.tar.gz |
PR c++/49092
* dwarf2out.c (tree_add_const_value_attribute_for_decl): Check for
static storage duration.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174024 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/const5.C | 13 |
4 files changed, 26 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 80233d7eff9..789f258da39 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-05-21 Jason Merrill <jason@redhat.com> + + PR c++/49092 + * dwarf2out.c (tree_add_const_value_attribute_for_decl): Check for + static storage duration. + 2011-05-21 Eric Botcazou <ebotcazou@adacore.com> * config/sparc/sparc.md (setjmp): Handle PIC mode and use the hard diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b85a55ec67c..55453a3622c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -17719,7 +17719,9 @@ tree_add_const_value_attribute_for_decl (dw_die_ref var_die, tree decl) if (!decl || (TREE_CODE (decl) != VAR_DECL - && TREE_CODE (decl) != CONST_DECL)) + && TREE_CODE (decl) != CONST_DECL) + || (TREE_CODE (decl) == VAR_DECL + && !TREE_STATIC (decl))) return false; if (TREE_READONLY (decl) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 61afdb00e2e..ccc34a7bae3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-05-21 Jason Merrill <jason@redhat.com> + + * g++.dg/debug/const5.C: New. + 2011-05-20 Jason Merrill <jason@redhat.com> * g++.dg/cpp0x/constexpr-static7.C: Extend. diff --git a/gcc/testsuite/g++.dg/debug/const5.C b/gcc/testsuite/g++.dg/debug/const5.C new file mode 100644 index 00000000000..e5387ea20ef --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/const5.C @@ -0,0 +1,13 @@ +// PR c++/49092 + +struct A +{ + A(); +}; + +int i; + +A::A() +{ + const int j = i; +} |