This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 01/14] C++: preserve locations within build_address
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Nathan Sidwell <nathan at acm dot org>, Jakub Jelinek <jakub at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>, David Malcolm <dmalcolm at redhat dot com>
- Date: Fri, 10 Nov 2017 16:45:16 -0500
- Subject: [PATCH 01/14] C++: preserve locations within build_address
- Authentication-results: sourceware.org; auth=none
- References: <CADzB+2kfB26fTGXk2AVWuN1mv641OrcEBze+Lq-KexXHeS=Y9A@mail.gmail.com> <1510350329-48956-1-git-send-email-dmalcolm@redhat.com>
This is needed for the locations of string literals to be usable,
otherwise the ADDR_EXPR has UNKNOWN_LOCATION, despite wrapping
a node with a correct location_t.
gcc/cp/ChangeLog:
* typeck.c (build_address): Use location of operand when building
address expression.
---
gcc/cp/typeck.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9130c10..dd3e19d 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5621,7 +5621,7 @@ build_address (tree t)
if (error_operand_p (t) || !cxx_mark_addressable (t))
return error_mark_node;
gcc_checking_assert (TREE_CODE (t) != CONSTRUCTOR);
- t = build_fold_addr_expr (t);
+ t = build_fold_addr_expr_loc (EXPR_LOCATION (t), t);
if (TREE_CODE (t) != ADDR_EXPR)
t = rvalue (t);
return t;
--
1.8.5.3