Overview
| Artifact ID: | f726d1393daff0f0e41ef5289b56b5bea846e689 |
|---|---|
| Ticket: | 1090869fffffffffffffffffffffffffffffffff
Tcl_GetInt Returns Illegal Overlfow On AMD64 |
| User & Date: | sanjeev_singh on 2004-12-24 15:43:52 |
Changes
- assignee changed to: "msofer"
- cmimetype changed to: "text/plain"
- comment changed to:
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 - foundin changed to: "None"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "sanjeev_singh"
- subsystem changed to: "45. Parsing and Eval"
- title changed to: "Tcl_GetInt Returns Illegal Overlfow On AMD64"
- type changed to: "Bug"