aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2019-08-14 09:51:29 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-14 09:51:29 +0000
commit4cac730ccc741a9bf780390c2703163edc6da470 (patch)
treeb0ae20422ad6877d2f1dd199a628f6955a2b79b0
parent1384d88fa9d7bb81b3e37568622f6839cd28be26 (diff)
downloadgcc-4cac730ccc741a9bf780390c2703163edc6da470.zip
gcc-4cac730ccc741a9bf780390c2703163edc6da470.tar.gz
gcc-4cac730ccc741a9bf780390c2703163edc6da470.tar.bz2
[Ada] Sem_Util: fix a bug in New_Copy_Tree
No impact on GCC-based compilation. 2019-08-14 Javier Miranda <miranda@adacore.com> gcc/ada/ * sem_util.adb (New_Copy_Tree.Copy_Node_With_Replacement): Update the Chars attribute of identifiers. From-SVN: r274455
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/sem_util.adb15
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 1d13947..c661a38 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2019-08-14 Javier Miranda <miranda@adacore.com>
+
+ * sem_util.adb (New_Copy_Tree.Copy_Node_With_Replacement):
+ Update the Chars attribute of identifiers.
+
2019-08-14 Yannick Moy <moy@adacore.com>
* sem_spark.adb, sem_spark.ads (Is_Legal): New function exposed
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index db9233a..10f8ffb 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -20427,6 +20427,21 @@ package body Sem_Util is
Update_First_Real_Statement
(Old_HSS => N,
New_HSS => Result);
+
+ -- Update the Chars attribute of identifiers
+
+ elsif Nkind (N) = N_Identifier then
+
+ -- The Entity field of identifiers that denote aspects is used
+ -- to store arbitrary expressions (and hence we must check that
+ -- they reference an actual entity before copying their Chars
+ -- value).
+
+ if Present (Entity (Result))
+ and then Nkind (Entity (Result)) in N_Entity
+ then
+ Set_Chars (Result, Chars (Entity (Result)));
+ end if;
end if;
end if;