diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-04-21 12:58:23 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-18 05:08:16 -0400 |
commit | 2e64cf055250718d8e1659d37738c9eb2d2da1e3 (patch) | |
tree | 096699604d1e0afd5de2c620a107309c0bb3ce58 | |
parent | e49f6ee11d9de33706a410f3f1cb328a4b6e6616 (diff) | |
download | gcc-2e64cf055250718d8e1659d37738c9eb2d2da1e3.zip gcc-2e64cf055250718d8e1659d37738c9eb2d2da1e3.tar.gz gcc-2e64cf055250718d8e1659d37738c9eb2d2da1e3.tar.bz2 |
[Ada] Fix invalid expression sharing in Expand_Array_Equality
2020-06-18 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_ch4.adb (Expand_Array_Equality): For the optimization of
the 2-element case, build new expression lists for the indices.
-rw-r--r-- | gcc/ada/exp_ch4.adb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index c4cd9b5..2735a48 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -2009,34 +2009,33 @@ package body Exp_Ch4 is Ctyp : constant Entity_Id := Component_Type (Ltyp); L, R : Node_Id; TestL, TestH : Node_Id; - Index_List : List_Id; begin - Index_List := New_List (New_Copy_Tree (Low_Bound (First_Idx))); - L := Make_Indexed_Component (Loc, Prefix => New_Copy_Tree (New_Lhs), - Expressions => Index_List); + Expressions => + New_List (New_Copy_Tree (Low_Bound (First_Idx)))); R := Make_Indexed_Component (Loc, Prefix => New_Copy_Tree (New_Rhs), - Expressions => Index_List); + Expressions => + New_List (New_Copy_Tree (Low_Bound (First_Idx)))); TestL := Expand_Composite_Equality (Nod, Ctyp, L, R, Bodies); - Index_List := New_List (New_Copy_Tree (High_Bound (First_Idx))); - L := Make_Indexed_Component (Loc, Prefix => New_Lhs, - Expressions => Index_List); + Expressions => + New_List (New_Copy_Tree (High_Bound (First_Idx)))); R := Make_Indexed_Component (Loc, Prefix => New_Rhs, - Expressions => Index_List); + Expressions => + New_List (New_Copy_Tree (High_Bound (First_Idx)))); TestH := Expand_Composite_Equality (Nod, Ctyp, L, R, Bodies); |