From: Ed Schonberg Date: Fri, 25 May 2018 09:04:59 +0000 (+0000) Subject: [Ada] Fix expansion of quantified expressions as part of "others" associations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1f6237e3ddfba881d87d9c62d0b806717a71fbe5;p=gcc.git [Ada] Fix expansion of quantified expressions as part of "others" associations 2018-05-25 Ed Schonberg 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 73dec9d74d6..dfe117ad9c5 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2018-05-25 Ed Schonberg + + * 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 * libgnat/s-secsta.adb (SS_Allocate): Reimplemented. diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 81d35533b18..f4619a8b9e1 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;