Improve stack direction detection

When the function in the test program is inlined, all bets are
off whether the detection will work correctly or not. Make it
harder for the compiler to play games on us by making the
function recursive.

https://bugzilla.gnome.org/show_bug.cgi?id=307947
This commit is contained in:
Matthias Clasen 2013-11-23 20:24:49 -05:00
parent df71ecfc2d
commit 341c0b1988

View File

@ -596,9 +596,8 @@ dnl
AC_CACHE_CHECK([for growing stack pointer],glib_cv_stack_grows,[
AC_TRY_RUN([
volatile int *a = 0, *b = 0;
void foo (void);
int main () { volatile int y = 7; a = &y; foo (); return b > a; }
void foo (void) { volatile int x = 5; b = &x; }
void f (int i) { volatile int x = 5; if (i == 0) b = &x; else f (i - 1); }
int main () { volatile int y = 7; a = &y; f (100); return b > a; }
],
glib_cv_stack_grows=yes
,