diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclExecute.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 6bab480..3a870e0 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.318 2007/08/19 22:50:03 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.319 2007/08/20 16:52:57 msofer Exp $ */ #include "tclInt.h" @@ -5300,10 +5300,17 @@ TclExecuteByteCode( #endif { /* - * Must check for overflow. + * Must check for overflow. The macro tests for overflows + * in sums by looking at the sign bits. As we have a + * subtraction here, we are adding -w2. As -w2 could in turn + * overflow, we test with ~w2 instead: it has the opposite + * sign bit to w2 so it does the job. Note that the only + * "bad" case (w2==0) is irrelevant for this macro, as in + * that case w1 and wResult have the same sign and there + * is no overflow anyway. */ - if (Overflowing(w1, w2, wResult)) { + if (Overflowing(w1, ~w2, wResult)) { goto overflow; } } |