stack grow direction wrongly detected
Takashi Yano
takashi.yano@nifty.ne.jp
Sat Mar 6 01:06:57 GMT 2021
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>
More information about the Cygwin
mailing list