public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: stack grow direction wrongly detected
Date: Sat, 6 Mar 2021 10:06:57 +0900	[thread overview]
Message-ID: <20210306100657.135a86aacf935a7f9e9a7847@nifty.ne.jp> (raw)
In-Reply-To: <b9285d42-1400-dabf-83a5-2e244f1efe81@gmail.com>

On Fri, 5 Mar 2021 21:29:49 +0100
Marco Atzeri wrote:
> guile 1.8.8 is 10 years old, but it is still used by some programs
> as all the guile 2.x series were slower.
> the code on recent guile 3.0.x is different, with no recursion at all.
> 
> SCM_I_GSC_STACK_GROWS_UP=0
> AC_RUN_IFELSE([AC_LANG_SOURCE(
> [AC_INCLUDES_DEFAULT
> 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;
                   ^^^^^^^^^^^^^^^^^^^^
This calls find_stack_direction() recursively, isn't it?

>    return dir + dummy;
> }
> 
> int
> main (int argc, char **argv)
> {
>    return find_stack_direction (0, argc + !argv + 20) < 0;
> }])],

Recursion depth seems to be increased to more than 20.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

  reply	other threads:[~2021-03-06  1:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 12:18 Marco Atzeri
2021-03-05 14:31 ` Takashi Yano
2021-03-05 14:43   ` gs-cygwin.com
2021-03-06  8:29     ` Marco Atzeri
2021-03-06  9:29       ` Thomas Wolff
2021-03-05 15:25   ` Thomas Wolff
2021-03-05 18:58 ` Brian Inglis
2021-03-05 20:29   ` Marco Atzeri
2021-03-06  1:06     ` Takashi Yano [this message]
2021-03-06  9:12       ` Marco Atzeri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210306100657.135a86aacf935a7f9e9a7847@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).