aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2018-01-11 08:50:18 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-01-11 08:50:18 +0000
commit51f3e4e157dae1cded8f340f12859b237151fe74 (patch)
treeefb29bdc3b0afa2977c2556a47bcce6876ef4859
parent593e3172343967753c81fb85013b3f769679c9e2 (diff)
downloadgcc-51f3e4e157dae1cded8f340f12859b237151fe74.zip
gcc-51f3e4e157dae1cded8f340f12859b237151fe74.tar.gz
gcc-51f3e4e157dae1cded8f340f12859b237151fe74.tar.bz2
[Ada] Inconsistent scope chain due to quantified expression
This patch corrects the minor decoration performed on invariant procedures in case the procedure is not inserted into the tree and analyzed. The decoration now constructs a proper first/next/last entity chain containing the single formal parameter which represents the object of the related type. The chain then ensures that any other entities generated by the [pre]analysis of the invariant expression will be properly added to the chain. The issue was discovered during the development of the GNATprove tool and is not visible to end users. No simple test is available because this would require a debug session. 2018-01-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * exp_util.adb (Build_Invariant_Procedure_Declaration): Set the last entity of the generated invariant procedure in order to construct a proper entity chain. From-SVN: r256483
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/exp_util.adb1
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 88e6ed5..88e2ee2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-11 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_util.adb (Build_Invariant_Procedure_Declaration): Set the last
+ entity of the generated invariant procedure in order to construct a
+ proper entity chain.
+
2018-01-11 Piotr Trojanek <trojanek@adacore.com>
* sem_ch13.adb (Build_Predicate_Functions): Fix minor issues in
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index f768e20..9ccaa78 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -3466,6 +3466,7 @@ package body Exp_Util is
Set_Scope (Obj_Id, Proc_Id);
Set_First_Entity (Proc_Id, Obj_Id);
+ Set_Last_Entity (Proc_Id, Obj_Id);
-- Generate:
-- procedure <Work_Typ>[Partial_]Invariant (_object : <Obj_Typ>);