autoconf-patches
[Top][All Lists]
Advanced

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

Overflow protection in _AC_COMPUTE_INT_COMPILE


From: Pavel Roskin
Subject: Overflow protection in _AC_COMPUTE_INT_COMPILE
Date: Wed, 15 Nov 2000 00:48:48 -0500 (EST)

Hello!

This patch should eliminate the last testsuite failure on HP-UX 10.20 with
CC=cc (where cc is the "bundled" compiler).

Regards,
Pavel Roskin

______________________________
Index: ChangeLog
--- ChangeLog   Tue Nov 14 21:02:08 2000
+++ ChangeLog   Wed Nov 15 00:43:26 2000
@@ -1 +1,6 @@
+2000-11-15  Pavel Roskin  <address@hidden>
+
+       * acgeneral.m4 (_AC_COMPUTE_INT_COMPILE): Protect against overflow
+       in expr.
+
 2000-11-14  Paul Eggert  <address@hidden>
Index: acgeneral.m4
--- acgeneral.m4        Tue Nov 14 21:02:09 2000
+++ acgeneral.m4        Wed Nov 15 00:41:18 2000
@@ -3054,16 +3054,27 @@
 AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= 0])],
  [ac_lo=0 ac_try=0
   while :; do
+    case x$ac_lo in
+      *-*) ac_try=
+           break ;;
+    esac
     AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_try])],
                    [ac_hi=$ac_try; break],
                    [ac_lo=`expr $ac_try + 1`; ac_try=`expr 2 '*' $ac_try + 1`])
   done],
  [ac_hi=-1 ac_try=-1
   while :; do
+    case x$ac_hi in
+      *-*) ;;
+      *) ac_try=
+         break ;;
+    esac
     AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_try])],
                       [ac_lo=$ac_try; break],
                       [ac_hi=`expr $ac_try - 1`; ac_try=`expr 2 '*' $ac_try`])
   done])
+test "x$ac_try" = x && \
+  AC_MSG_ERROR([Cannot evaluate `$1' while cross-compiling], 77)
 # Binary search between lo and hi bounds.
 while test "x$ac_lo" != "x$ac_hi"; do
   ac_try=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
______________________________





reply via email to

[Prev in Thread] Current Thread [Next in Thread]