diff options
author | Javier Miranda <miranda@adacore.com> | 2023-03-12 12:32:34 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-25 09:44:19 +0200 |
commit | f7f8e290a11a2d1ab0eefa5a87d4d56f0146f9d4 (patch) | |
tree | c17991601bc9bf843a00aef1a9d5ca36d93c728d | |
parent | f81245b46472746e03b1b86191969b822ed03943 (diff) | |
download | gcc-f7f8e290a11a2d1ab0eefa5a87d4d56f0146f9d4.zip gcc-f7f8e290a11a2d1ab0eefa5a87d4d56f0146f9d4.tar.gz gcc-f7f8e290a11a2d1ab0eefa5a87d4d56f0146f9d4.tar.bz2 |
ada: Crash on empty aggregate using the Ada 2022 notation
The compiler crashes processing an empty aggregate initializing
a component of a discriminated record type using the Ada 2022
notation (that is, []).
gcc/ada/
* exp_aggr.adb (Build_Record_Aggr_Code): Protect access to
aggregate components when the aggregate is empty.
-rw-r--r-- | gcc/ada/exp_aggr.adb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index f3ad8a9..de4d5a7 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -4061,7 +4061,9 @@ package body Exp_Aggr is Decl : Node_Id; begin - if Nkind (First (Choices (Assoc))) = N_Others_Choice + if Present (Assoc) + and then + Nkind (First (Choices (Assoc))) = N_Others_Choice then Decl := Build_Actual_Subtype_Of_Component |