[Ada] Unnesting: skip unanalyzed Component_Assocation

2018-05-30  Ed Schonberg  <schonberg@adacore.com>

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
This commit is contained in:
Ed Schonberg 2018-05-30 08:58:40 +00:00 committed by Pierre-Marie de Rodat
parent 656d1fba78
commit 392a7e19fd
2 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2018-05-30 Ed Schonberg <schonberg@adacore.com>
* 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 <squirek@adacore.com>
* aspects.adb, aspects.ads: Register new aspect.

View File

@ -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