aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-03-10 00:31:11 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-16 08:42:04 +0000
commite4acb82e97f8043dcd5e6b91b7d3c05d7b478b45 (patch)
tree14b481d7bbdc031858d7ac0460cb83c21b3118ed
parente6bdaa0299d459e4f0486793bcbeff1bbe75f8a1 (diff)
downloadgcc-e4acb82e97f8043dcd5e6b91b7d3c05d7b478b45.zip
gcc-e4acb82e97f8043dcd5e6b91b7d3c05d7b478b45.tar.gz
gcc-e4acb82e97f8043dcd5e6b91b7d3c05d7b478b45.tar.bz2
[Ada] Fix internal error on iterated array aggregate
The front-end drops the declaration of a temporary on the floor because Insert_Actions fails to climb up out of an N_Iterated_Component_Association when the temporary is created during the analysis of its Discrete_Choices. gcc/ada/ * exp_util.adb (Insert_Actions) <N_Iterated_Component_Association>: Climb up out of the node if the actions come from Discrete_Choices.
-rw-r--r--gcc/ada/exp_util.adb17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 4198cea..d3fbc4b 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -7751,12 +7751,17 @@ package body Exp_Util is
-- We must not climb up out of an N_Iterated_xxx_Association
-- because the actions might contain references to the loop
- -- parameter. But it turns out that setting the Loop_Actions
- -- attribute in the case of an N_Component_Association
- -- when the attribute was not already set can lead to
- -- (as yet not understood) bugboxes (gcc failures that are
- -- presumably due to malformed trees). So we don't do that.
-
+ -- parameter, except if we come from the Discrete_Choices of
+ -- N_Iterated_Component_Association which cannot contain any.
+ -- But it turns out that setting the Loop_Actions field in
+ -- the case of an N_Component_Association when the field was
+ -- not already set can lead to gigi assertion failures that
+ -- are presumably due to malformed trees, so don't do that.
+
+ and then (Nkind (P) /= N_Iterated_Component_Association
+ or else not Is_List_Member (N)
+ or else
+ List_Containing (N) /= Discrete_Choices (P))
and then (Nkind (P) /= N_Component_Association
or else Present (Loop_Actions (P)))
then