From 9e5b5e40eae7a5e6a344e332b6e13d5e270a2627 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 6 Nov 2017 14:38:10 -0500 Subject: [PATCH 09/25] {[01/14], approved} C++: preserve locations within build_address 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 7210f99..a503ebe 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5678,7 +5678,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