aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-08-05 16:31:19 +0200
committerMarc Poulhiès <poulhies@adacore.com>2022-09-06 09:14:20 +0200
commit8b9bbdc362efe420633e43850092d01f467aa6d8 (patch)
tree1f66eea81dcb093b509dd15270d2da67373caaef /gcc/ada/sem_util.adb
parentd6b15134378bfba88effc523f4eb2c20a9486a63 (diff)
downloadgcc-8b9bbdc362efe420633e43850092d01f467aa6d8.zip
gcc-8b9bbdc362efe420633e43850092d01f467aa6d8.tar.gz
gcc-8b9bbdc362efe420633e43850092d01f467aa6d8.tar.bz2
[Ada] Improve detection of illegal Iterable aspects
Handling of aspect Iterable was lacking guards against illegal code, so the compiler either crashed or emitted cryptic errors while expanding loops that rely on this aspect. gcc/ada/ * doc/gnat_rm/implementation_defined_aspects.rst (Aspect Iterable): Include Last and Previous primitives in syntactic and semantic description. * exp_attr.adb (Expand_N_Attribute_Reference): Don't expect attributes like Iterable that can only appear in attribute definition clauses. * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Prevent crash on non-aggregate Iterable attribute; improve basic diagnosis of attribute values. (Resolve_Iterable_Operation): Improve checks for illegal primitives in aspect Iterable, e.g. with wrong number of formal parameters. (Validate_Iterable_Aspect): Prevent crashes on syntactically illegal aspect expression. * sem_util.adb (Get_Cursor_Type): Fix style. * gnat_ugn.texi, gnat_rm.texi: Regenerate.
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index ecfb49a..d0a4a07 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -10894,7 +10894,7 @@ package body Sem_Util is
-- First.
Assoc := First (Component_Associations (Expression (Aspect)));
- First_Op := Any_Id;
+ First_Op := Any_Id;
while Present (Assoc) loop
if Chars (First (Choices (Assoc))) = Name_First then
First_Op := Expression (Assoc);