diff options
author | Kevin B Kenny <kennykb@acm.org> | 2005-08-05 18:50:20 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2005-08-05 18:50:20 (GMT) |
commit | 33f99a107c785f2a316908111b390ec9bed82a6a (patch) | |
tree | 198e2c38a17a43259d35c7f36b254a93b0182e76 /generic | |
parent | c411bb62c886240f5cbd8f59c5c3c8ff5c9f5754 (diff) | |
download | tcl-33f99a107c785f2a316908111b390ec9bed82a6a.zip tcl-33f99a107c785f2a316908111b390ec9bed82a6a.tar.gz tcl-33f99a107c785f2a316908111b390ec9bed82a6a.tar.bz2 |
Handle abs(-0x80000000) [Bug 1241572]
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 5c36bbc..4414c52 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.164 2005/07/26 17:06:12 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.165 2005/08/05 18:50:27 kennykb Exp $ */ #include "tclInt.h" @@ -5091,12 +5091,20 @@ ExprAbsFunc(clientData, interp, objc, objv) if (i < 0) { iResult = -i; if (iResult < 0) { - /* FIXME: This should promote to wide! */ +#ifdef TCL_WIDE_INT_IS_LONG Tcl_SetObjResult(interp, Tcl_NewStringObj( "integer value too large to represent", -1)); Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", "integer value too large to represent", (char *) NULL); return TCL_ERROR; +#else + /* + * Special case: abs(MIN_INT) must promote to wide. + */ + TclNewWideIntObj(oResult, -(Tcl_WideInt) i); + Tcl_SetObjResult(interp, oResult); + return TCL_OK; +#endif } } else { iResult = i; |