aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2020-12-22 19:46:37 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-05-03 05:28:21 -0400
commit6537318f79694a218b1d4816fbe86dc59694abe5 (patch)
tree52944f43ae240a2fa97cc1e33d0a894f2b46b3cc /gcc
parentd56fbda96a7c34ad897b9cc871242047fe19393c (diff)
downloadgcc-6537318f79694a218b1d4816fbe86dc59694abe5.zip
gcc-6537318f79694a218b1d4816fbe86dc59694abe5.tar.gz
gcc-6537318f79694a218b1d4816fbe86dc59694abe5.tar.bz2
[Ada] Crash on aggregate in function call in object declaration
gcc/ada/ * exp_aggr.adb (Expand_Array_Aggregate): If the parent node of the aggregate is a subprogram call there is no target in which to build the aggregate, and it has to be expanded into component assignments.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_aggr.adb8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index c719b02..fb5b302 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -5700,7 +5700,7 @@ package body Exp_Aggr is
function Safe_Left_Hand_Side (N : Node_Id) return Boolean;
-- In addition to Maybe_In_Place_OK, in order for an aggregate to be
-- built directly into the target of the assignment it must be free
- -- of side effects.
+ -- of side effects. N is the LHS of an assignment.
----------------------------
-- Build_Constrained_Type --
@@ -6661,9 +6661,13 @@ package body Exp_Aggr is
Set_Expansion_Delayed (N);
return;
- -- In the remaining cases the aggregate is the RHS of an assignment
+ -- In the remaining cases the aggregate appears in the RHS of an
+ -- assignment, which may be part of the expansion of an object
+ -- delaration. If the aggregate is an actual in a call, itself
+ -- possibly in a RHS, building it in the target is not possible.
elsif Maybe_In_Place_OK
+ and then Nkind (Parent_Node) not in N_Subprogram_Call
and then Safe_Left_Hand_Side (Name (Parent_Node))
then
Tmp := Name (Parent_Node);