[parisc-linux] Re: Looking at vfprintf.c and alloca.

John David Anglin dave at hiauly1.hia.nrc.ca
Tue Jul 18 21:22:30 MDT 2006


> For the case of gcc-4.2, stack-grows down...

Is this for hppa?  The stack should never grow downward.

> ptr = 0xbfea1fc0
> old = 0xbfea2160
> &old[100] = 0xbfea22f0
> 
> In both the cases (up/down) &old[100] has an offset of
> 400 bytes (correct).

You have to take into account the preferred stack boundary
into account when determining the delta between alloca allocations.

The HP runtime specifies 64 bytes (i.e., cache aligned) for
the preferred stack boundary in the 32-bit runtime.  The stack
boundary is 8 bytes.  This is the minimum alignment that the
hardware needs except for the infamous ldcw instruction.  The
preferred stack boundary could have been 8 bytes.  However,
changing it now would be an ABI change...

HP probably recognized that 64-byte alignment didn't help performance
much, so they relaxed the 64-bit alignment to 16 bytes.  In the 64-bit
runtime, some types are 16-byte aligned.

Dave
-- 
J. David Anglin                                  dave.anglin at nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)



More information about the parisc-linux mailing list