aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-08-30 15:15:40 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-08-30 15:15:40 +0000
commit5e017b1e25655f256a130419b427811bb1016b43 (patch)
tree203ea3028b131425718668468e1d778aaf5c5647 /gcc
parent0c2837b5c408f8fd2b023a7bf00be9abd1e28a28 (diff)
downloadgcc-5e017b1e25655f256a130419b427811bb1016b43.zip
gcc-5e017b1e25655f256a130419b427811bb1016b43.tar.gz
gcc-5e017b1e25655f256a130419b427811bb1016b43.tar.bz2
trans.c (gnat_to_gnu): Do not set the location on an expression used for a tag.
* gcc-interface/trans.c (gnat_to_gnu): Do not set the location on an expression used for a tag. From-SVN: r275197
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/trans.c10
2 files changed, 13 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 636eb7c..f4c510d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2019-08-30 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/trans.c (gnat_to_gnu): Do not set the location on an
+ expression used for a tag.
+
+2019-08-30 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/gigi.h (aggregate_type_contains_array_p): Declare.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: For an
extension, test Has_Record_Rep_Clause instead of Has_Specified_Layout.
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 5579986..e7064c6 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -8727,10 +8727,16 @@ gnat_to_gnu (Node_Id gnat_node)
set_gnu_expr_location_from_node (gnu_result, gnat_node);
}
- /* Set the location information on the result if it's not a simple name.
+ /* Set the location information on the result if it's not a simple name
+ or something that contains a simple name, for example a tag, because
+ we don"t want all the references to get the location of the first use.
Note that we may have no result if we tried to build a CALL_EXPR node
to a procedure with no side-effects and optimization is enabled. */
- else if (kind != N_Identifier && gnu_result && EXPR_P (gnu_result))
+ else if (kind != N_Identifier
+ && !(kind == N_Selected_Component
+ && Chars (Selector_Name (gnat_node)) == Name_uTag)
+ && gnu_result
+ && EXPR_P (gnu_result))
set_gnu_expr_location_from_node (gnu_result, gnat_node);
/* If we're supposed to return something of void_type, it means we have