aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2023-03-29 15:02:32 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-05-26 09:29:19 +0200
commit54783e61dd9bfd0f0289890ba9240deeef1af81a (patch)
tree950877ba99193167359b46c98b3fa50d7ae45285
parentb8a3e2ed647cf5cfec72e9b7801a82a1d9e574a3 (diff)
downloadgcc-54783e61dd9bfd0f0289890ba9240deeef1af81a.zip
gcc-54783e61dd9bfd0f0289890ba9240deeef1af81a.tar.gz
gcc-54783e61dd9bfd0f0289890ba9240deeef1af81a.tar.bz2
ada: Default initialize entity to avoid CodePeer message
CodePeer issues a false alarm when reading local entity Component later if not initialized by default. Fix this. gcc/ada/ * sem_aggr.adb (Resolve_Record_Aggregate): Add dummy initialization and assertion that clarifies when we reassigned to a useful value.
-rw-r--r--gcc/ada/sem_aggr.adb6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 858ae63..fd0779e 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -6004,6 +6004,7 @@ package body Sem_Aggr is
end if;
while Present (Selectr) loop
+ Component := Empty;
New_Assoc := First (New_Assoc_List);
while Present (New_Assoc) loop
Component := First (Choices (New_Assoc));
@@ -6019,6 +6020,11 @@ package body Sem_Aggr is
Next (New_Assoc);
end loop;
+ -- If we found an association, then this is a legal component
+ -- of the type in question.
+
+ pragma Assert (if Present (New_Assoc) then Present (Component));
+
-- If no association, this is not a legal component of the type
-- in question, unless its association is provided with a box.