diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-12-15 18:50:34 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-12-15 18:50:34 +0100 |
commit | 140806fa55ed4c8feaadd1628bb733af777b4faf (patch) | |
tree | b7d9f83c3aef0d92603e1259c312c7ef6f7cdf8e /gcc/cp/cp-gimplify.c | |
parent | db1792ee3338c4beabbf2ccaacb87c3d810b8309 (diff) | |
download | gcc-140806fa55ed4c8feaadd1628bb733af777b4faf.zip gcc-140806fa55ed4c8feaadd1628bb733af777b4faf.tar.gz gcc-140806fa55ed4c8feaadd1628bb733af777b4faf.tar.bz2 |
re PR debug/46815 (Invalid DW_AT_location for a retval instance of a class that has a virtual function)
PR debug/46815
* cp-gimplify.c (cp_genericize): When changing RESULT_DECL
into invisible reference, change also DECL_VALUE_EXPR of
NRV optimized variable.
* g++.dg/guality/pr46815.C: New test.
From-SVN: r167865
Diffstat (limited to 'gcc/cp/cp-gimplify.c')
-rw-r--r-- | gcc/cp/cp-gimplify.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 42d7d58..ca62df3 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -958,6 +958,23 @@ cp_genericize (tree fndecl) DECL_BY_REFERENCE (t) = 1; TREE_ADDRESSABLE (t) = 0; relayout_decl (t); + if (DECL_NAME (t)) + { + /* Adjust DECL_VALUE_EXPR of the original var. */ + tree outer = outer_curly_brace_block (current_function_decl); + tree var; + + if (outer) + for (var = BLOCK_VARS (outer); var; var = DECL_CHAIN (var)) + if (DECL_NAME (t) == DECL_NAME (var) + && DECL_HAS_VALUE_EXPR_P (var) + && DECL_VALUE_EXPR (var) == t) + { + tree val = convert_from_reference (t); + SET_DECL_VALUE_EXPR (var, val); + break; + } + } } /* If we're a clone, the body is already GIMPLE. */ |