aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-05-25 09:04:59 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-25 09:04:59 +0000
commit1f6237e3ddfba881d87d9c62d0b806717a71fbe5 (patch)
treeb2c9d056b3c4c603f2a8144c66b1691350cb08ce /gcc
parent25eadeeaa2a0da50bd591c38de899140a413323e (diff)
downloadgcc-1f6237e3ddfba881d87d9c62d0b806717a71fbe5.zip
gcc-1f6237e3ddfba881d87d9c62d0b806717a71fbe5.tar.gz
gcc-1f6237e3ddfba881d87d9c62d0b806717a71fbe5.tar.bz2
[Ada] Fix expansion of quantified expressions as part of "others" associations
2018-05-25 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_aggr.adb (Flatten): A quantified expression cannot be duplicated in an others clause to prevent visibility issues with the generated loop variable. (Component_OK_For_Backend): Return false for a quantified expression. (Check_Static_Component): Ditto. From-SVN: r260737
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/exp_aggr.adb15
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 73dec9d..dfe117a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2018-05-25 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_aggr.adb (Flatten): A quantified expression cannot be duplicated
+ in an others clause to prevent visibility issues with the generated
+ loop variable.
+ (Component_OK_For_Backend): Return false for a quantified expression.
+ (Check_Static_Component): Ditto.
+
2018-05-25 Hristian Kirtchev <kirtchev@adacore.com>
* libgnat/s-secsta.adb (SS_Allocate): Reimplemented.
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 81d3553..f4619a8 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -4373,6 +4373,7 @@ package body Exp_Aggr is
or else not Compile_Time_Known_Aggregate (Expression (Expr))
or else Expansion_Delayed (Expression (Expr))
or else Nkind (Expr) = N_Iterated_Component_Association
+ or else Nkind (Expr) = N_Quantified_Expression
then
Static_Components := False;
exit;
@@ -4523,10 +4524,20 @@ package body Exp_Aggr is
-- If we have an others choice, fill in the missing elements
-- subject to the limit established by Max_Others_Replicate.
+ -- If the expression involves a construct that generates
+ -- a loop, we must generate individual assignmentw and
+ -- no flattening is possible.
if Nkind (Choice) = N_Others_Choice then
Rep_Count := 0;
+ if Nkind_In (Expression (Elmt),
+ N_Quantified_Expression,
+ N_Iterated_Component_Association)
+ then
+ return False;
+ end if;
+
for J in Vals'Range loop
if No (Vals (J)) then
Vals (J) := New_Copy_Tree (Expression (Elmt));
@@ -7235,6 +7246,10 @@ package body Exp_Aggr is
Static_Components := False;
return False;
+ elsif Nkind (Expr_Q) = N_Quantified_Expression then
+ Static_Components := False;
+ return False;
+
elsif Possible_Bit_Aligned_Component (Expr_Q) then
Static_Components := False;
return False;