On Fri, 2 Sep 2011, Arnaud Charlet wrote:
> > > 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?
>
> No, that shouldn't happen, although you can e.g. reference Table'Address
> and expect it to be non null.
Ah, ok. That we'd definitely broke.
> > I'd have
> > expected that alloca (0) returning NULL shouldn't break
> > anything at runtime ...
>
> Not sure exactly what failed here, probably something relatively subtle
> (perhaps related to passing this variable or a "slice" of this variable
> to another procedure).
Hm, maybe we've expanded a block-move of size zero in some funny way.
The bootstrap fail can probably be reproduced with
Index: gcc/explow.c
===================================================================
--- gcc/explow.c (revision 178465)
+++ gcc/explow.c (working copy)
@@ -1159,7 +1159,7 @@ allocate_dynamic_stack_space (rtx size,
to since we can't dereference it. But return a reasonable
address anyway. */
if (size == const0_rtx)
- return virtual_stack_dynamic_rtx;
+ return const0_rtx;
/* Otherwise, show we're calling alloca or equivalent. */
cfun->calls_alloca = 1;
Richard.