public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Inconsistent scope chain due to quantified expression
@ 2019-08-20 10:13 Pierre-Marie de Rodat
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre-Marie de Rodat @ 2019-08-20 10:13 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

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.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-08-20  Piotr Trojanek  <trojanek@adacore.com>

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.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 306 bytes --]

--- gcc/ada/exp_util.adb
+++ 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 <Work_Typ>DIC (_object : <Work_Typ>);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Ada] Inconsistent scope chain due to quantified expression
@ 2018-01-11  9:03 Pierre-Marie de Rodat
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre-Marie de Rodat @ 2018-01-11  9:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Hristian Kirtchev

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

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.

Tested on x86_64-pc-linux-gnu, committed on trunk

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.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 319 bytes --]

--- gcc/ada/exp_util.adb
+++ 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>);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-20  9:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 10:13 [Ada] Inconsistent scope chain due to quantified expression Pierre-Marie de Rodat
  -- strict thread matches above, loose matches on Subject: below --
2018-01-11  9:03 Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).