diff options
author | Eric Blake <ebb9@byu.net> | 2007-04-25 14:04:12 +0000 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2007-09-21 15:48:17 -0600 |
commit | b5180b4f731b0227efc25f8c56c2d1eb1860a50a (patch) | |
tree | b1e007a15d0f75eb3e8f6b1ae9fbfb3f4c76c57a | |
parent | b5ee646ef03f8b6c94a353692fa0e8e60720eae7 (diff) | |
download | m4-b5180b4f731b0227efc25f8c56c2d1eb1860a50a.tar.gz |
Fix negative division within eval, regression of 2007-01-06.
* doc/m4.texinfo (Eval): Catch this bug.
* src/eval.c (mult_term): Fix it.
* NEWS: Document this.
* THANKS: Update.
Reported by Cesar Strauss.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | doc/m4.texinfo | 8 | ||||
-rw-r--r-- | src/eval.c | 4 |
5 files changed, 21 insertions, 4 deletions
@@ -1,3 +1,12 @@ +2007-04-25 Eric Blake <ebb9@byu.net> + + Fix negative division within eval, regression of 2007-01-06. + * doc/m4.texinfo (Eval): Catch this bug. + * src/eval.c (mult_term): Fix it. + * NEWS: Document this. + * THANKS: Update. + Reported by Cesar Strauss. + 2007-04-23 Eric Blake <ebb9@byu.net> Start 1.4.9a. @@ -4,7 +4,8 @@ Foundation, Inc. Version 1.4.10 - ?? ??? 2007, by ???? (CVS version 1.4.9a) -* +* Fix regression introduced in 1.4.9 in the `eval' builtin when performing + division. Version 1.4.9 - 23 Mar 2007, by Eric Blake (CVS version 1.4.8c) @@ -23,6 +23,7 @@ Bjorn R. Bjornsson brb@falcon.is Bob Badour bob@badour.net Brendan Kehoe brendan@cygnus.com Bruno Haible bruno@clisp.org +Cesar Strauss cestrauss@gmail.com Chris McGuire chris@wso.net Damian Menscher menscher@uiuc.edu Dan Jacobson jidanni@jidanni.org diff --git a/doc/m4.texinfo b/doc/m4.texinfo index 719c97c5..0c97fa12 100644 --- a/doc/m4.texinfo +++ b/doc/m4.texinfo @@ -4966,6 +4966,12 @@ Here are a few examples of use of @code{eval}. @example eval(`-3 * 5') @result{}-15 +eval(`-99 / 10') +@result{}-9 +eval(`-99 % 10') +@result{}-9 +eval(`99 % -10') +@result{}9 eval(index(`Hello world', `llo') >= 0) @result{}1 eval(`0r1:0111 + 0b100 + 0r3:12') @@ -4979,7 +4985,7 @@ square(square(`5')` + 1') define(`foo', `666') @result{} eval(`foo / 6') -@error{}m4:stdin:8: bad expression in eval: foo / 6 +@error{}m4:stdin:11: bad expression in eval: foo / 6 @result{} eval(foo / 6) @result{}111 @@ -718,10 +718,10 @@ mult_term (eval_token et, int32_t *v1) if (v2 == 0) return DIVIDE_ZERO; else if (v2 == -1) - /* Avoid the x86 SIGFPE on INT_MIN / -1. */ + /* Avoid overflow, and the x86 SIGFPE on INT_MIN / -1. */ *v1 = (int32_t) -(uint32_t) *v1; else - *v1 = (int32_t) ((uint32_t) *v1 / (uint32_t) v2); + *v1 /= v2; break; case MODULO: |