From 392a7e19fd9750110d1931732ac34105460206f6 Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Wed, 30 May 2018 08:58:40 +0000 Subject: [PATCH] [Ada] Unnesting: skip unanalyzed Component_Assocation 2018-05-30 Ed Schonberg gcc/ada/ * exp_unst.adb (Visit_Node): Do not traverse a Component_Association that has not been analyzed, as will be the case for a nested aggregate that is expanded into individual assignments. From-SVN: r260946 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/exp_unst.adb | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b839b7a7fab..1e810bbdf61 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-05-30 Ed Schonberg + + * exp_unst.adb (Visit_Node): Do not traverse a Component_Association + that has not been analyzed, as will be the case for a nested aggregate + that is expanded into individual assignments. + 2018-05-30 Justin Squirek * aspects.adb, aspects.ads: Register new aspect. diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index b394f21cee8..7935306996e 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -775,6 +775,16 @@ package body Exp_Unst is end case; end; + -- Component associations in aggregates are either static + -- or else the aggregate will be expanded into assignments, + -- in which case the expression is analyzed later and provides + -- no relevant code generation. + + when N_Component_Association => + if No (Etype (Expression (N))) then + return Skip; + end if; + -- Indexed references can be uplevel if the type isn't static -- and if the lower bound (or an inner bound for a multi- -- dimensional array) is uplevel. @@ -1865,8 +1875,7 @@ package body Exp_Unst is begin if Present (STT.ARECnF) - and then Nkind (CTJ.N) /= N_Attribute_Reference - and then Nkind (CTJ.N) /= N_Handled_Sequence_Of_Statements + and then Nkind (CTJ.N) in N_Subprogram_Call then -- CTJ.N is a call to a subprogram which may require a pointer -- to an activation record. The subprogram containing the call -- 2.30.2