diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2024-03-01 10:31:12 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-17 10:20:58 +0200 |
commit | 1da18c25593fceed40233cd2cd49409ea817372a (patch) | |
tree | bed56e4e16b0893b49b88d5f88fea166e0fbb5cc /gcc/ada | |
parent | d7d49b2d58c709f15d51651119e325d8a56b5950 (diff) | |
download | gcc-1da18c25593fceed40233cd2cd49409ea817372a.zip gcc-1da18c25593fceed40233cd2cd49409ea817372a.tar.gz gcc-1da18c25593fceed40233cd2cd49409ea817372a.tar.bz2 |
ada: Small cleanup in aggregate expansion code
This patch moves a statement outside of a loop because it didn't
need to be inside that loop. The behavior of the program is not
affected.
gcc/ada/
* exp_aggr.adb (Flatten): Small cleanup.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/exp_aggr.adb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 5d2b334..cff04fc 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -4626,6 +4626,14 @@ package body Exp_Aggr is Component_Loop : while Present (Elmt) loop Expr := Expression (Elmt); + -- If the expression involves a construct that generates a + -- loop, we must generate individual assignments and no + -- flattening is possible. + + if Nkind (Expr) = N_Quantified_Expression then + return False; + end if; + -- In the case of a multidimensional array, check that the -- aggregate can be recursively flattened. @@ -4642,14 +4650,6 @@ package body Exp_Aggr is if Nkind (Choice) = N_Others_Choice then Rep_Count := 0; - -- If the expression involves a construct that generates - -- a loop, we must generate individual assignments and - -- no flattening is possible. - - if Nkind (Expr) = N_Quantified_Expression then - return False; - end if; - for J in Vals'Range loop if No (Vals (J)) then Vals (J) := New_Copy_Tree (Expr); |