]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Use corect capacity with two dimensional arrays
authorViljar Indus <indus@adacore.com>
Wed, 4 Sep 2024 09:21:40 +0000 (12:21 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 8 Oct 2024 08:37:13 +0000 (10:37 +0200)
commit4ca91b84aa1cdb5fcd178ecb2bc7a13c9be082e3
treee33997f74c04fa7d3381bb788acf6cbdf09e9bbf
parent9ca4d98d0349882510b1ae705087a00ee9dcb0f5
ada: Use corect capacity with two dimensional arrays

Previously when a bounded list was initialized with an array aggregate
then we used the correct size only if the array was one dimensional.
This patch adds support for deriving the size for multidimensional array
types as well.

gcc/ada/ChangeLog:
* exp_aggr.adb (Build_Siz_Exp): Support deriving the size of the
container aggregate with multi-dimensional arrays. Make the
function return an node of an expression instead of an integer.
Additionally calculate the size expression for
Component_Associations.
(To_Int) make this method available for more functions.
(Aggregate_Size) Relocate the calculation of
Componenet_Associations to Build_Siz_Exp.
gcc/ada/exp_aggr.adb