autoconf-patches
[Top][All Lists]
Advanced

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

Re: Overflow protection in _AC_COMPUTE_INT_COMPILE


From: Akim Demaille
Subject: Re: Overflow protection in _AC_COMPUTE_INT_COMPILE
Date: 15 Nov 2000 12:17:40 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

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

Good news, but could you detail what you are doing.  I mean, I trust
your fix, but I want to understand it: comments are missing.

| 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

There is no reason to x here.

| +      *-*) 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

nor here.

| +      *-*) ;;
| +      *) 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 && \

Please, don't `\'.

| +  AC_MSG_ERROR([Cannot evaluate `$1' while cross-compiling], 77)

s/Cannot/cannot/.

I don't understand this message.  The point of this macro is precisely
that it allows us to compute results with just the compiler, including
when cross-compiling.

|  # 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]