diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-04-29 11:30:46 +0200 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:14:07 -0300 |
commit | 00194ed61f43d146d6162287ca24f3072b12aa31 (patch) | |
tree | ef2322eaf0e01f762c1cb5f8508be9c2fb047520 /gcc | |
parent | 9296df2961502b121b05323bd69eff60b0e422b5 (diff) | |
download | gcc-00194ed61f43d146d6162287ca24f3072b12aa31.zip gcc-00194ed61f43d146d6162287ca24f3072b12aa31.tar.gz gcc-00194ed61f43d146d6162287ca24f3072b12aa31.tar.bz2 |
[Ada] Reject junk expressions in attribute Update
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_attr.adb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 3bd87fd..5041a12 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -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 |