aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-10-04 17:06:04 -0400
committerJason Merrill <jason@redhat.com>2022-10-04 18:53:52 -0400
commitce3a1b5976079b1467473b4628f05797fd2eae08 (patch)
tree910e324c10dea40e5593b26c07473e29733e85c0 /gcc/cp
parent0764dc8537a4f87089ecd32391cb5f8803b43c96 (diff)
downloadgcc-ce3a1b5976079b1467473b4628f05797fd2eae08.zip
gcc-ce3a1b5976079b1467473b4628f05797fd2eae08.tar.gz
gcc-ce3a1b5976079b1467473b4628f05797fd2eae08.tar.bz2
c++: fix debug info for array temporary [PR107154]
In the testcase the elaboration of the array init that happens at genericize time was getting the location info for the end of the function; fixed by doing the expansion at the location of the original expression. PR c++/107154 gcc/cp/ChangeLog: * cp-gimplify.cc (cp_genericize_init_expr): Use iloc_sentinel. (cp_genericize_target_expr): Likewise. gcc/testsuite/ChangeLog: * g++.dg/debug/dwarf2/lineno-array1.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/cp-gimplify.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index cca3b9f..404a769 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -920,6 +920,7 @@ cp_genericize_init (tree *replace, tree from, tree to)
static void
cp_genericize_init_expr (tree *stmt_p)
{
+ iloc_sentinel ils = EXPR_LOCATION (*stmt_p);
tree to = TREE_OPERAND (*stmt_p, 0);
tree from = TREE_OPERAND (*stmt_p, 1);
if (SIMPLE_TARGET_EXPR_P (from)
@@ -935,6 +936,7 @@ cp_genericize_init_expr (tree *stmt_p)
static void
cp_genericize_target_expr (tree *stmt_p)
{
+ iloc_sentinel ils = EXPR_LOCATION (*stmt_p);
tree slot = TARGET_EXPR_SLOT (*stmt_p);
cp_genericize_init (&TARGET_EXPR_INITIAL (*stmt_p),
TARGET_EXPR_INITIAL (*stmt_p), slot);