(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.
{
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;