bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in check for stack growth direction in _AC_LIBOBJ_ALLOCA


From: Eric Blake
Subject: Re: bug in check for stack growth direction in _AC_LIBOBJ_ALLOCA
Date: Mon, 20 Jun 2011 11:54:16 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

[adding bug-gnulib]

On 06/19/2011 11:35 PM, Paul Eggert wrote:
> On 06/19/11 12:01, Andy Wingo wrote:
>> No, this program also exhibits the same incorrect behavior, for purposes
>> of stack growth checking.
> 
> Thanks, I guess we'll have to turn it up a notch.  How about the
> following test program?
> 
> int
> find_stack_direction (int *addr, int depth)
> {
>   int dir, dummy = 0;
>   if (! addr)
>     addr = &dummy;
>   *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
>   dir = depth ? find_stack_direction (addr, depth - 1) : 0;
>   return dir + dummy;
> }
> 
> int
> main (int argc, char **argv)
> {
>   return find_stack_direction (0, argc + !argv + 20) < 0;
> }
> 
> 
> This program is reflected in my most recent patch, here:
> 
> http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497

Hmm, we'll need to backport this improved stack-direction testing to
gnulib and libsigsegv, then, since your previous autoconf patch (which
has been defeated by newer gcc optimization) was lifted from gnulib's
c-stack stack-direction probe.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]