On Fri, 2 Sep 2011, Arnaud Charlet wrote:

> > This fixes the Ada bootstrap failure introduced by alloca folding.
> > We now fold alloca (0) to &auto-with-size-zero which confuses us.
> > I didn't exactly investigate but what I think happens is that we
> > expand that &auto-with-size-zero to NULL instead of
> > virtual_stack_dynamic_rtx (see zero-size special-case in
> > allocate_dynamic_stack_space) and Ada ends up dereferencing the
> > pointer returned from alloca (0) (something to investigate for
> > the Ada folks I guess), something which "works" if we just
> > return a random stack address.
> 
> Thanks!
> 
> In Ada, it's quite natural to end up with a dynamically sized object of
> size 0. For instance, if you declare an array with a dynamic bound:
> 
>    Table : Unit_Table (1 .. Last_Unit);
> 
> and Last_Unit happens to be 0 at run-time

But are we expected to read/store from the storage?  I'd have
expected that alloca (0) returning NULL shouldn't break
anything at runtime ...

Richard.

Reply via email to