]> gcc.gnu.org Git - gcc.git/commitdiff
[Ada] Reject junk expressions in attribute Update
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 29 Apr 2020 09:30:46 +0000 (11:30 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 19 Jun 2020 08:17:15 +0000 (04:17 -0400)
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_attr.adb (Analyze_Attribute): Reject illegal positional
component associations; fix syntax in comment about named
component associations.

gcc/ada/sem_attr.adb

index 3bd87fdf3db22e5ec5dad8f56d21243b0c741421..5041a1224144979b1a41437fb1c211b1a12a8bcf 100644 (file)
@@ -6836,7 +6836,7 @@ package body Sem_Attr is
             --  Verify the consistency of types when the current component is
             --  part of a miltiple component update.
 
-            --    Comp_1, ..., Comp_N => <value>
+            --    Comp_1 | ... | Comp_N => <value>
 
             if Present (Etype (Comp)) then
                Base_Typ := Base_Type (Etype (Comp));
@@ -6877,6 +6877,11 @@ package body Sem_Attr is
 
          elsif Nkind (E1) /= N_Aggregate then
             Error_Attr ("attribute % requires component association list", N);
+
+         elsif Present (Expressions (E1)) then
+            Error_Attr ("attribute % requires named component associations",
+                        First (Expressions (E1)));
+
          end if;
 
          --  Inspect the update aggregate, looking at all the associations and
This page took 0.077062 seconds and 5 git commands to generate.