[patch i386]: For target x86_64-pc-mingw32 _alloca and _stkchk may corrupts stack alignment

Kai Tietz Kai.Tietz@onevision.com
Tue Feb 12 14:37:00 GMT 2008


Hi Danny,

> On Feb 11, 2008 10:06 PM, Kai Tietz <Kai.Tietz@onevision.com> wrote:
> > BTW: Should we do the same thing for 32-bits, too? At least the 
alignment
> > issue.
> > I opened a bug for this PR/35124. Partly this bug is fix now for 
64-bit
> > bits, but 32-bit remains.
> >
> 
> The __alloca in cygwin.asm is equivalent to _alloca_probe in MSVC, ie
> an alias for _chkstk.  It is not and  has never been documented as an
> equivarent to __builtin_alloca.  (The _alloca that MS exports -- but
> does not document --  in some win32api dll's is like  gcc's
> __builtin_alloca.)  I wasn't aware that newer version(s) of the
> MSVCRT.dll  runtime exported _alloca.
> 
> 
> If the meaning of  cygwin.asm's  __allocate changes, you will also
> need to change allocate_stack_worker_32 to  call __chkstk..

Do you meant something like that patch I prepared?

ChangeLog

2008-02-12  Kai Tietz  <kai.tietz@onevision.com>

        * config/i386/i386.md: (allocate_stack_worker_32): Call __chkstk
        instead of __alloca.
        * config/i386/cygwin.asm: __alloca add return address like alloca.
        (__alloca,__chkstk): Enforce stack alignment on 4 byte boundary.

  Kai

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: alloca_pr35124.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080212/611a3ecc/attachment.txt>


More information about the Gcc-patches mailing list