Commit add86e09 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 53e030f1
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
(decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert): Adjust. (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert): Adjust.
(init_shadowed_var_for_decl): Adjust initialization. (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> 2010-06-02 Jason Merrill <jason@redhat.com>
* error.c (dump_type): Improve typedef handling. * error.c (dump_type): Improve typedef handling.
......
...@@ -3504,14 +3504,15 @@ finalize_nrv (tree *tp, tree var, tree result) ...@@ -3504,14 +3504,15 @@ finalize_nrv (tree *tp, tree var, tree result)
{ {
struct nrv_data data; struct nrv_data data;
/* Copy debugging information from VAR to RESULT. */ /* Copy name from VAR to RESULT. */
DECL_NAME (result) = DECL_NAME (var); 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. */ /* Don't forget that we take its address. */
TREE_ADDRESSABLE (result) = TREE_ADDRESSABLE (var); 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.var = var;
data.result = result; data.result = result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment