ada: Fix couple of issues with arrays indexed by enumeration type
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 12 Oct 2022 10:41:49 +0000 (12:41 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 4 Nov 2022 13:47:31 +0000 (14:47 +0100)
commit4eac8834f9fb703ea04d3d3992a497182f4f86f0
tree4fd65dd0c81f748d4bf6f1f9bfac4c71c81f6fbf
parent9a27e6a9f9e29adb968e4dfcd1328347b4da1df9
ada: Fix couple of issues with arrays indexed by enumeration type

The first one is that Remove_Warning_Messages reinstates the Original_Node
of an N_Raise_Constraint_Error node in the tree for no clear reasons, and
the Original_Node may contain constructs whose expansion has been stopped
when the Constraint_Error was asserted, eventually causing gigi to stop.

The second one is that a path in Build_Array_Aggr_Code.Gen_Loop does not
copy the loop bounds, unlike other paths, thus triggering a sharing issue.

gcc/ada/

* errout.adb (Remove_Warning_Messages.Check_For_Warning): Do not
reinstate the Original_Node in the tree.
* exp_aggr.adb (Build_Array_Aggr_Code.Gen_Loop): Copy the bounds
on all paths.
gcc/ada/errout.adb
gcc/ada/exp_aggr.adb