public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITED] ada: Delay expansion of iterated component association
@ 2022-09-26  9:14 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-09-26  9:14 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

From: Piotr Trojanek <trojanek@adacore.com>

When preanalysing spec expression (e.g. expression of an expression
function), the name of iterator specification within an iterated
component association should not be expanded, especially in GNATprove
mode.

gcc/ada/

	* sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion of
	for iterated component association just like it is done within
	quantified expression.
---
 gcc/ada/sem_ch5.adb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 17bf6d91b44..6d07f3d09e5 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -2429,11 +2429,12 @@ package body Sem_Ch5 is
 
       if not Is_Entity_Name (Iter_Name)
 
-        --  When the context is a quantified expression, the renaming
-        --  declaration is delayed until the expansion phase if we are
-        --  doing expansion.
+        --  When the context is a quantified expression or iterated component
+        --  association, the renaming declaration is delayed until the
+        --  expansion phase if we are doing expansion.
 
-        and then (Nkind (Parent (N)) /= N_Quantified_Expression
+        and then (Nkind (Parent (N)) not in N_Quantified_Expression
+                                          | N_Iterated_Component_Association
                    or else (Operating_Mode = Check_Semantics
                             and then not GNATprove_Mode))
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-26  9:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26  9:14 [COMMITED] ada: Delay expansion of iterated component association Marc Poulhiès

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).