summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--generic/tclExecute.c5
-rw-r--r--tests/expr.test9
3 files changed, 12 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index bdaeec9..0155817 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2006-09-10 Don Porter <dgp@users.sourceforge.net>
+ * generic/tclExecute.c: Corrected INST_EXPON flaw that treated
+ * tests/expr.test: $x**1 as $x**3. [Bug 1555371]
+
* doc/tcltest.n: Bump to version tcltest 2.3.0 to account
* library/tcltest/pkgIndex.tcl: for new "-verbose line" feature.
* library/tcltest/tcltest.tcl:
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 3a7d82f..d664134 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.243 2006/08/29 06:28:38 das Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.244 2006/09/11 04:54:11 dgp Exp $
*/
#include "tclInt.h"
@@ -4856,6 +4856,9 @@ TclExecuteByteCode(
}
w1 *= w1;
w2 /= 2;
+ if (w2 == 0) {
+ break;
+ }
for (; w2>Tcl_LongAsWide(1) ; w1*=w1,w2/=2) {
wasNegative = (wResult < 0);
if (w1 <= 0) {
diff --git a/tests/expr.test b/tests/expr.test
index 23f46bd..a26dc63 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: expr.test,v 1.59 2006/08/31 20:09:20 dgp Exp $
+# RCS: @(#) $Id: expr.test,v 1.60 2006/09/11 04:54:12 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
@@ -970,9 +970,10 @@ test expr-23.39 {INST_EXPON: big integer} {
} 1[string repeat 0 60]
test expr-23.40 {INST_EXPON: overflow to big integer} {expr {(-10)**3}} -1000
test expr-23.41 {INST_EXPON: overflow to big integer} {expr 2**64} [expr 1<<64]
-test expr-23.41 {INST_EXPON: overflow to big integer} {expr 4**32} [expr 1<<64]
-test expr-23.41 {INST_EXPON: overflow to big integer} {expr 16**16} [expr 1<<64]
-test expr-23.41 {INST_EXPON: overflow to big integer} {expr 256**8} [expr 1<<64]
+test expr-23.42 {INST_EXPON: overflow to big integer} {expr 4**32} [expr 1<<64]
+test expr-23.43 {INST_EXPON: overflow to big integer} {expr 16**16} [expr 1<<64]
+test expr-23.44 {INST_EXPON: overflow to big integer} {expr 256**8} [expr 1<<64]
+test expr-23.45 {INST_EXPON: Bug 1555371} {expr 2**1} 2
# Some compilers get this wrong; ensure that we work around it correctly
test expr-24.1 {expr edge cases; shifting} {expr int(5)>>32} 0