summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-06-19 22:33:03 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-06-19 22:33:29 -0700
commit6cd9f12520b0d6f76d3230d7565feba1ecf29497 (patch)
tree2549e859d3226d3b448958978026bdc923c37f33
parentb1747413a80add0271d6909aecfdc2b638456257 (diff)
downloadautoconf-6cd9f12520b0d6f76d3230d7565feba1ecf29497.tar.gz
* 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>.
-rw-r--r--ChangeLog6
-rw-r--r--lib/autoconf/functions.m415
2 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index e0e52ce6..466b8a84 100644
--- 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.
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 31568872..cbc34135 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -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],