diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclExecute.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index fd369b2..f6d2ea2 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -11,7 +11,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.52 2002/04/15 17:32:18 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.53 2002/04/18 13:04:20 msofer Exp $ */ #include "tclInt.h" @@ -4569,25 +4569,33 @@ IllegalExprOperandType(interp, pc, opndPtr) operatorStrings[opCode - INST_LOR], "\"", (char *) NULL); } else { char *msg = "non-numeric string"; - if (opndPtr->typePtr != &tclDoubleType) { + char *s; + int length; + + s = Tcl_GetStringFromObj(opndPtr, &length); + if (TclLooksLikeInt(s, length)) { + /* + * If something that looks like an integer appears here, then + * it *must* be a bad octal or too large to represent [Bug 542588]. + */ + + if (TclCheckBadOctal(NULL, Tcl_GetString(opndPtr))) { + msg = "invalid octal number"; + } else { + msg = "integer value too large to represent"; + Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", + "integer value too large to represent", (char *) NULL); + } + } else { /* * See if the operand can be interpreted as a double in order to * improve the error message. */ - char *s = TclGetString(opndPtr); double d; if (Tcl_GetDouble((Tcl_Interp *) NULL, s, &d) == TCL_OK) { - /* - * Make sure that what appears to be a double - * (ie 08) isn't really a bad octal - */ - if (TclCheckBadOctal(NULL, TclGetString(opndPtr))) { - msg = "invalid octal number"; - } else { - msg = "floating-point value"; - } + msg = "floating-point value"; } } Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't use ", |