]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA): Be even smarter.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 20 Jun 2011 05:33:03 +0000 (22:33 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 20 Jun 2011 05:33:29 +0000 (22:33 -0700)
GCC was too smart for the previous patch.  See
<http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00035.html>.

ChangeLog
lib/autoconf/functions.m4

index e0e52ce65633662d34588089a80cbca2a7a2bad5..466b8a84e264b483470ad12c5de7ace69765eeea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA): Be even smarter.
+       GCC was too smart for the previous patch.  See
+       <http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00035.html>.
+
 2011-06-18  Paul Eggert  <eggert@cs.ucla.edu>
 
        * lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA): Try to outsmart GCC.
index 31568872d510da047e9a245040e84551b1ae8ffa..cbc341359a989960ac3734c26594ef7ed53ad41b 100644 (file)
@@ -325,17 +325,20 @@ AC_CACHE_CHECK([stack direction for C alloca],
 [AC_RUN_IFELSE([AC_LANG_SOURCE(
 [AC_INCLUDES_DEFAULT
 int
-find_stack_direction (char *addr)
+find_stack_direction (int *addr, int depth)
 {
-  char dummy;
-  return (! addr ? find_stack_direction (&dummy)
-          : addr < &dummy ? 1 : -1);
+  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;
+  return dir + dummy;
 }
 
 int
-main (void)
+main (int argc, char **argv)
 {
-  return find_stack_direction (0) < 0;
+  return find_stack_direction (0, argc + !argv + 20) < 0;
 }])],
               [ac_cv_c_stack_direction=1],
               [ac_cv_c_stack_direction=-1],