ada: Fix bogus Storage_Error on dynamic array with static zero length
commit0a769b29ee0beef9998f7694894b6c8f5aa93e6a
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 13 Mar 2023 22:01:54 +0000 (13 23:01 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 30 May 2023 07:12:18 +0000 (30 09:12 +0200)
tree96504d0d8b973194b7efd008812fe0f636a833fa
parent0e58d85c40223fcdde298aaa443d8d5f7863ab16
ada: Fix bogus Storage_Error on dynamic array with static zero length

This works around the limitations present for the support of arrays in the
middle-end by clearing the TREE_OVERFLOW flag for arrays with zero length.

gcc/ada/

* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: Use a
local variable for the GNAT index type.
<E_Array_Subtype>: Likewise.  Call Is_Null_Range on the bounds and
force the zero on TYPE_SIZE and TYPE_SIZE_UNIT if it returns true.
gcc/ada/gcc-interface/decl.cc