]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix crash caused by missing New_Copy_tree
authorMarc Poulhiès <poulhies@adacore.com>
Tue, 5 Mar 2024 14:16:59 +0000 (15:16 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 17 May 2024 08:21:01 +0000 (10:21 +0200)
commit93035031c5045255c7248576cc5750c1cb3dfd15
treef9cf73298b8dcfe536c9e24826a7db35f789dcda
parentcb71c251d846032cfb31e86c8e4d678c58a90ecc
ada: Fix crash caused by missing New_Copy_tree

Since a recent refactor ("Factor common processing in expansion of
aggregates") where Initialize_Array_Component and
Initialize_Record_Component are merged, the behavior has slightly
changed. In the case of the expansion of an aggregate initialization
where the number of 'others' components is <= 3, the initialization
expression is not duplicated anymore, causing some incorrect multiple
definition when said expression is later transformed with
Expressions_With_Action that declares an object. The simple fix is to
add the now missing New_Copy_Tree where the assignments are created.

gcc/ada/

* exp_aggr.adb (Build_Array_Aggr_Code) <Gen_Loop>: Copy the
initialization expression when unrolling the loop.
gcc/ada/exp_aggr.adb