diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-06-02 21:52:07 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-06-02 21:52:07 +0200 |
commit | add86e09a5c4c09fbcf3088409a1eb60c47155db (patch) | |
tree | d7e122cc15138da7bd882493a8ba542065bf36b3 /gcc/cp | |
parent | 53e030f1439a414a0247a86fa76534f353558be4 (diff) | |
download | gcc-add86e09a5c4c09fbcf3088409a1eb60c47155db.zip gcc-add86e09a5c4c09fbcf3088409a1eb60c47155db.tar.gz gcc-add86e09a5c4c09fbcf3088409a1eb60c47155db.tar.bz2 |
re PR debug/44367 (-O0 -g wrong DW_AT_location on c++ class retval)
PR debug/44367
* semantics.c (finalize_nrv): Don't copy DECL_ARTIFICIAL, DECL_IGNORED_P,
DECL_SOURCE_LOCATION and DECL_ABSTRACT_ORIGIN from var to result.
Set DECL_VALUE_EXPR on var.
From-SVN: r160186
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1dabc4c..9a031f9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -5,6 +5,11 @@ (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert): Adjust. (init_shadowed_var_for_decl): Adjust initialization. + PR debug/44367 + * semantics.c (finalize_nrv): Don't copy DECL_ARTIFICIAL, DECL_IGNORED_P, + DECL_SOURCE_LOCATION and DECL_ABSTRACT_ORIGIN from var to result. + Set DECL_VALUE_EXPR on var. + 2010-06-02 Jason Merrill <jason@redhat.com> * error.c (dump_type): Improve typedef handling. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index bf016f1..05d1cad 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3504,14 +3504,15 @@ finalize_nrv (tree *tp, tree var, tree result) { struct nrv_data data; - /* Copy debugging information from VAR to RESULT. */ + /* Copy name from VAR to RESULT. */ DECL_NAME (result) = DECL_NAME (var); - DECL_ARTIFICIAL (result) = DECL_ARTIFICIAL (var); - DECL_IGNORED_P (result) = DECL_IGNORED_P (var); - DECL_SOURCE_LOCATION (result) = DECL_SOURCE_LOCATION (var); - DECL_ABSTRACT_ORIGIN (result) = DECL_ABSTRACT_ORIGIN (var); /* Don't forget that we take its address. */ TREE_ADDRESSABLE (result) = TREE_ADDRESSABLE (var); + /* Finally set DECL_VALUE_EXPR to avoid assigning + a stack slot at -O0 for the original var and debug info + uses RESULT location for VAR. */ + SET_DECL_VALUE_EXPR (var, result); + DECL_HAS_VALUE_EXPR_P (var) = 1; data.var = var; data.result = result; |