aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2023-03-23 18:46:08 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-05-26 09:29:18 +0200
commit70f609b01fde630141e683f9563545b8dff87ad6 (patch)
tree9c9149d5a1d759c788dcbe7637c1c69562f66315
parent2688795b716b1ec75826e150c2d1dd04c88f3ad6 (diff)
downloadgcc-70f609b01fde630141e683f9563545b8dff87ad6.zip
gcc-70f609b01fde630141e683f9563545b8dff87ad6.tar.gz
gcc-70f609b01fde630141e683f9563545b8dff87ad6.tar.bz2
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.
-rw-r--r--gcc/ada/sem_cat.adb11
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb
index 09560e6..13dff3d 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))