From aa090e20d4bb02e829aa7e4d9e49ba06b94e0d5f Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Tue, 20 Aug 2019 09:50:34 +0000 Subject: [PATCH] [Ada] Inconsistent scope chain due to quantified expression Routine Build_DIC_Procedure_Declaration appears to be heavily inspired by Build_Invariant_Procedure_Declaration; they both wrap an expression attached to a type inside an internal procedure. Initially none of them were calling Set_Last_Entity. For Build_Invariant_Procedure_Declaration this was fixed previously. For Build_DIC_Procedure_Declaration this is fixed here. The issue affects the GNATprove tool and is not visible to end users of the GNAT compiler. No simple test is available because this would require a debug session. 2019-08-20 Piotr Trojanek gcc/ada/ * exp_util.adb (Build_DIC_Procedure_Declaration): Set the last entity of the generated Default_Initial_Condition procedure in order to construct a proper entity chain. From-SVN: r274741 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/exp_util.adb | 1 + 2 files changed, 7 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a27d1d9fb0d..f914d0676d3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-08-20 Piotr Trojanek + + * exp_util.adb (Build_DIC_Procedure_Declaration): Set the last + entity of the generated Default_Initial_Condition procedure in + order to construct a proper entity chain. + 2019-08-20 Yannick Moy * exp_spark.adb (Expand_SPARK_N_Slice_Or_Indexed_Component): diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 41708c3097f..78019ab3c32 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -1977,6 +1977,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 DIC (_object : ); -- 2.30.2