Further observations regarding alloca on i586-pc-linux-gnu

Jeffrey A Law law@cygnus.com
Mon Aug 24 04:37:00 GMT 1998


  In message < 199808231820.UAA00204@mira.isdn.cs.tu-berlin.de >you write:
  > > This is well known.  What is not clear to me though, is whether
  > > it is a bug in the compiler or in the test. 
  > 
  > I've tried to find documentation on the semantics of alloca in gcc,
  > but didn't found much. The portable alloca.c says
I don't think alloca's behavior is defined by GCC.  You'll probably
need to look at an ANSI or POSIX standard.

I don't happen to have either handy, but I did find this blurb on
my HPUX system:

           alloca()         Allocates space from the stack of the caller for
                            a block of at least size bytes, but does not
                            initialize the space.  The space is
                            automatically freed when the calling routine
                            exits.

                            Memory returned by alloca() is not related to
                            memory allocated by other memory allocation
                            functions.  Behavior of addresses returned by
                            alloca() as parameters to other memory functions
                            is undefined.

                            The implementation of this routine is system
                            dependent and its use is discouraged.



jeff



More information about the Gcc mailing list