[glib] Improve stack direction detection



commit 341c0b1988542f88f6c506145fda2ebd694f3331
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Nov 23 20:24:49 2013 -0500

    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

 configure.ac |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7d268db..3811a26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
         ,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]