stack grow direction wrongly detected

Marco Atzeri
Fri Mar 5 12:18:38 GMT 2021

Hi Guys,
noted trying to rebuild guile 1.8.8.

The following piece of code in the past
was setting SCM_I_GSC_STACK_GROWS_UP=0
and now produces SCM_I_GSC_STACK_GROWS_UP=1

I assume some change in the gcc compiler is causing the issue.
I presume most of the programs and libraries do not care,
but some special one like guile crashes during build for this issue,
so be aware.


# Which way does the stack grow?
# Following code comes from Autoconf 2.61's internal _AC_LIBOBJ_ALLOCA
# macro (/usr/share/autoconf/autoconf/functions.m4).  Gnulib has
# very similar code, so in future we could look at using that.
# An important detail is that the code involves find_stack_direction
# calling _itself_ - which means that find_stack_direction (or at
# least the second find_stack_direction() call) cannot be inlined.
# If the code could be inlined, that might cause the test to give
# an incorrect answer.

find_stack_direction ()
   static char *addr = 0;
   auto char dummy;
   if (addr == 0)
       addr = &dummy;
       return find_stack_direction ();
     return (&dummy > addr) ? 1 : -1;

main ()
   return find_stack_direction () < 0;
                [AC_MSG_WARN(Guessing that stack grows down -- see 

More information about the Cygwin mailing list