This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Fix size of array with zero-sized element in Ada
> So the corner case is an exceptionally large array (to trigger signed
> overflow) of zero-sized elements that needs to be of zero size.
Yep, see the testcase.
> So why is 0 * length not 0 when TREE_OVERFLOW is set on length?
It's 0 with TREE_OVERFLOW set, the bit is sticky.
> Or are you concerned about TREE_OVERFLOW being set on the final size then?
Yes, this results in bogus warnings later on.
> Thus, what about an unconditional
>
> /* Make sure an array of zero-sized element is zero-sized regardless
> of its extent. */
> if (integer_zerop (element_size))
> length = size_zero_node;
>
> instead?
Fine with me of course, but is this required if sizetype is unsigned?
--
Eric Botcazou