From 1541ede1e18b72f77b84fdef0478e97684d14cf1 Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Mon, 28 May 2018 08:54:18 +0000 Subject: [PATCH] [Ada] Copy index expression trees rather than relocating them 2018-05-28 Ed Schonberg gcc/ada/ * exp_aggr.adb (Flatten): Copy tree of expression in a component association with a range or a set of discrete choices, rather than relocating the node. This avoids inconsistencies in the tree when handling nested subprograms with uplevel references for LLVM. From-SVN: r260829 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/exp_aggr.adb | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a9f89f57..95e482241 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2018-05-28 Ed Schonberg + + * exp_aggr.adb (Flatten): Copy tree of expression in a component + association with a range or a set of discrete choices, rather than + relocating the node. This avoids inconsistencies in the tree when + handling nested subprograms with uplevel references for LLVM. + 2018-05-28 Arnaud Charlet * exp_util.adb (Possible_Bit_Aligned_Component): Always return False in diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index c7158a3..cedc722 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -4490,7 +4490,9 @@ package body Exp_Aggr is return False; end if; - Vals (Num) := Relocate_Node (Elmt); + -- Duplicate expression for each index it covers. + + Vals (Num) := New_Copy_Tree (Elmt); Num := Num + 1; Next (Elmt); -- 2.7.4