public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* stack grow direction wrongly detected
@ 2021-03-05 12:18 Marco Atzeri
  2021-03-05 14:31 ` Takashi Yano
  2021-03-05 18:58 ` Brian Inglis
  0 siblings, 2 replies; 10+ messages in thread
From: Marco Atzeri @ 2021-03-05 12:18 UTC (permalink / raw)
  To: cygwin

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.

Regards
Marco


#--------------------------------------------------------------------
#
# 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.
#--------------------------------------------------------------------

SCM_I_GSC_STACK_GROWS_UP=0
AC_RUN_IFELSE([AC_LANG_SOURCE(
[AC_INCLUDES_DEFAULT
int
find_stack_direction ()
{
   static char *addr = 0;
   auto char dummy;
   if (addr == 0)
     {
       addr = &dummy;
       return find_stack_direction ();
     }
   else
     return (&dummy > addr) ? 1 : -1;
}

int
main ()
{
   return find_stack_direction () < 0;
}])],
                [SCM_I_GSC_STACK_GROWS_UP=1],
                [],
                [AC_MSG_WARN(Guessing that stack grows down -- see 
scmconfig.h)])


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-03-06  9:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 12:18 stack grow direction wrongly detected 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
2021-03-06  9:12       ` Marco Atzeri

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).