On Thu, May 28, 2015 at 1:09 AM, Jan Engelhardt <jeng...@inai.de> wrote:

> On Thursday 2015-05-28 05:43, J Decker wrote:
>
> >Stack space for variables is also only allocated at the subroutine
> >prefix code and deallocated at the suffix....
>
> That is a false statement. gcc expands the stack in the middle - it
> has to - in case of dynamicly-sized reservations on automatic
> storage. (VLAs, alloca, ...)
>
>
but since it's not a VLA it could be in the prefixed stack expansion..

Some quick tests though...

gcc 4.8 (at least) seems to have no issue with VLA's at that level
MSVC 2013 supports c99.VLA (but 2012 and below do not)
openwatcom 2.0 still has no support for VLA
lcc-win32 supports VLA

I vaguely remember one compiler (maybe an older gcc) threw an error if the
size value of the VLA wasn't a function parameter (as a function parameter
it could use it in the pre-allocation of stack space for the function).
*shrug*

(gcc -S reveals that it doesn't call alloca either, it generates code to
directly manipulate SP (esp) )

I forget such things since it's not a universal feature

----- worst case program? ----
volatile int c;

int g( void )
{
   return c * 2;
}

void f( int a )
{
int b;
int va1[a];
for( b = 0; b < g(); b++ )
{
int va2[b];
int c;
for( c = 0; c < b; c++ )
 va2[c] = c;
}
}

int __stdcall WinMain( void *a, void *b, char *cmd, int d )
{
   c = 3;
   return 0;
}
_______________________________________________
Freetype mailing list
Freetype@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype

Reply via email to