public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1279] ada: Fix detection of non-static expressions in records with pragmas
@ 2023-05-26  7:37 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-05-26  7:37 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:70f609b01fde630141e683f9563545b8dff87ad6

commit r14-1279-g70f609b01fde630141e683f9563545b8dff87ad6
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Mar 23 18:46:08 2023 +0100

    ada: Fix detection of non-static expressions in records with pragmas
    
    When iterating over record components we must ignore pragmas.
    Minor bug, as pragmas within record components do not appear often.
    
    gcc/ada/
    
            * sem_cat.adb (Check_Non_Static_Default_Expr): Detect components inside
            loop, not in the loop condition itself.

Diff:
---
 gcc/ada/sem_cat.adb | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb
index 09560e6179a..13dff3dbdd9 100644
--- a/gcc/ada/sem_cat.adb
+++ b/gcc/ada/sem_cat.adb
@@ -346,14 +346,13 @@ package body Sem_Cat is
 
       if Null_Present (Recdef) then
          return;
-      else
-         Component_Decl := First (Component_Items (Component_List (Recdef)));
       end if;
 
-      while Present (Component_Decl)
-        and then Nkind (Component_Decl) = N_Component_Declaration
-      loop
-         if Present (Expression (Component_Decl))
+      Component_Decl := First (Component_Items (Component_List (Recdef)));
+
+      while Present (Component_Decl) loop
+         if Nkind (Component_Decl) = N_Component_Declaration
+           and then Present (Expression (Component_Decl))
            and then Nkind (Expression (Component_Decl)) /= N_Null
            and then not Is_OK_Static_Expression (Expression (Component_Decl))

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

only message in thread, other threads:[~2023-05-26  7:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26  7:37 [gcc r14-1279] ada: Fix detection of non-static expressions in records with pragmas 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).