From: SourceForge.net <no...@so...> - 2005-04-19 17:33:06
|
Bugs item #1090869, was opened at 2004-12-24 10:43 Message generated for change (Comment added) made by dgp You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1090869&group_id=10894 Category: 44. Parsing and Eval Group: None Status: Open Resolution: None Priority: 5 Submitted By: sanjeev singh (sanjeev_singh) Assigned to: Kevin B KENNY (kennykb) Summary: Tcl_GetInt Returns Illegal Overlfow On AMD64 Initial Comment: Hi, I am running on Opteron ie Amd 64 bit mc. While porting my 32 bit code I am running into this problem with reading 32 bit numbers that have bit 31 set. Basically the code below fails if the user passed 0x8000000 as the arguments. int tb_test(ClientData dummy, Tcl_Interp *interp, int argc, char **argv) { int code = TCL_OK; int value[2]; Tcl_GetInt(interp, argv[1], &value[0]); Tcl_GetInt(interp, argv[2], &value[1]); printf("VALUE0=0x%x\n", value[0]); printf("VALUE1=0x%x\n", value[1]); return code; } When run in tclsh this gives % myCmd 0x7fffffff 0x80000000 VALUE0=0x7fffffff VALUE1=0x0 integer value too large to represent % The problem seems to be in file tclGet.c in the following line- if ((errno == ERANGE) || (((long)(int) i) != i)) { It should be instead if ((errno == ERANGE) || (((long)(unsigned int) i) != i)) { -sanjeev ---------------------------------------------------------------------- >Comment By: Don Porter (dgp) Date: 2005-04-19 13:33 Message: Logged In: YES user_id=80530 That proposed patch fails 54 tests in the test suite. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1090869&group_id=10894 |