Artifacts Associated With Ticket 613117ffffffffff
Ticket change [f4a39f00b9] (rid 129953) by jkbonfield on 2002-09-23 08:50:13:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
The following script produces an incorrect output ("ld" instead of "150" for the last line) when run on a Compaq personal workstation 433au (Alpha processor) running Digital Unix 4.0E. My window manager is afterstep. set tk_strictMotif 1 tk_getOpenFile; #then hit cancel puts [expr {double(150)/100}] puts [expr 150] I'm currently trying to analyse the bug with purify on Solaris and memdebug on the alpha. I'll post any suitable debug info here. - foundin initialized to: "obsolete: 8.4.0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "jkbonfield"
- subsystem initialized to: "42. Memory Preservation"
- title initialized to: "Memory corruption (in expr?)"
- type initialized to: "Bug"
Ticket change [7fc0a6593f] (rid 97612) by jkbonfield on 2002-09-23 16:36:54:
- icomment:
Logged In: YES user_id=154581 I've now tried this with --enable-memdebug on the Alpha system. It triggers no response (assuming I'm using it correctly): % bash$ /tmp/ins/bin/tclsh8.4 % package require Tk 8.4 % memory validate on % set tk_strictMotif 1 1 % tk_getOpenFile % puts [expr {double(150)/100}] 1.5 % puts [expr 150] ld % I've also now built it on Solaris 8 using -DPURIFY and tested under purify. This greatly reduces the number of warnings to just a few dlopen issues (which are probably false). - login: "jkbonfield"
- mimetype: "text/plain"
- username: "jkbonfield"
- icomment:
Ticket change [c7b5ca70a1] (rid 121985) by jkbonfield on 2002-09-23 17:42:02:
- icomment:
Logged In: YES user_id=154581 Now I'm getting somewhere. Still no useful debug output from the memory checkers (which may imply an algorithmic bug?), but I can replace the tk_getOpenFile with a one line procedure calling grid. It has to be a procedure. The -minsize parameter in the grid is the number which becomes cached incorrectly. Eg: package require Tk proc bug {} { grid columnconfig . 0 -minsize 10 } bug puts [expr {double(10)}] puts [expr 10] exit Fortunately this is now sufficiently short to start low level debugging... - login: "jkbonfield"
- mimetype: "text/plain"
- username: "jkbonfield"
- icomment:
Ticket change [640d3947f0] (rid 92686) by jkbonfield on 2002-09-23 23:24:32:
- icomment:
Logged In: YES user_id=154581 It's not a memory corruption, but a sprintf format bug. The TCL_LL_MODIFIER gets set to ll, which leads to a sprintf of %lld and this in turn leads to printing up of "ld" (as Digital Unix does not support this, and neither does it support lltostr). Digital Unix, running on an Alpha, has long as 64bits. %d is for 32-bit integers and %ld for l64-bit longs. This is the nice and easy case, which other OSes have broken away from with their long long hacks. I need to figure out why the automatic type detection in tcl.h is chosing the wrong macro, but once I've done that I'll submit a patch for testing (I cannot test it on linux/alpha). What I cannot figure out from all this is quite how come this bug required the black magic invocations I listed at the start to trigger it. Clearly calling double(150) causes a 64-bit version of the number and a removal of the string-format copy, but I cannot see why this is dependant on 150 being used in an argument to grid! Anyway, I'm pleased to finally get somewhere with this rather bizarre bug! James
- login: "jkbonfield"
- mimetype: "text/plain"
- username: "jkbonfield"
- icomment:
Ticket change [7556d29e2e] (rid 105374) by hobbs on 2002-09-23 23:43:31:
- assignee changed to: "dkf"
- icomment:
Logged In: YES user_id=72656 Good analysis. Forwarding to dkf to fix (his code changes IIRC).
- login: "hobbs"
- mimetype: "text/plain"
- priority changed to: "6"
- username: "hobbs"
Ticket change [191ad05479] (rid 122765) by jkbonfield on 2002-09-23 23:53:55:
- icomment:
Logged In: YES user_id=154581 Ok I said I'd produce a patch, but I think I'm going to break things royally if I try! I see that the correct Makefile defines to get things working for me are -DTCL_WIDE_INT_TYPE_IS_LONG -DTCL_WIDE_INT=long. In addition to this we need to add a definition of TCL_LL_MODIFIER to be "l" for this case. The code looks incomplete and when TCL_WIDE_INT_TYPE is indeed long this never gets defined. Eg as an (incomplete) patch: *** tcl.h~ Wed Sep 18 15:54:35 2002 --- tcl.h Mon Sep 23 17:45:20 2002 *************** *** 401,406 **** --- 401,407 ---- # define Tcl_LongAsWide(val) ((long)(val)) # define Tcl_WideAsDouble(val) ((double)((long)(val))) # define Tcl_DoubleAsWide(val) ((long)((double)(val))) + # define TCL_LL_MODIFIER "l" #else /* TCL_WIDE_INT_IS_LONG */ # ifndef __WIN32__ # ifdef HAVE_STRUCT_STAT64 How to define TCL_WIDE_INT_IS_LONG? Looks like tcl.m4 and the SC_TCL_64BIT_FLAGS macro. This is where I start failing, not having enough knowledge of autoconf. I think an AC_TRY run of "int main() {exit(sizeof(long)==8);}" may suffice, but I'm not certain. - login: "jkbonfield"
- mimetype: "text/plain"
- username: "jkbonfield"
- icomment:
Ticket change [1604d8617c] (rid 124657) by techentin on 2002-09-24 03:50:23:
- icomment:
Logged In: YES user_id=43494 For what it is worth, I can reproduce this bug on our alpha running OSF1 v4.0. But I also get a number of test suite failures, where some numeric value is expected, but the string "ld" is returned. Like this: ==== expr-15.12 ExprCallMathFunc: call registered math function FAILED ==== Contents of test case: expr T3(21, wide(37)) ---- Result was: ld ---- Result should have been (exact matching): 37 ==== expr-15.12 FAILED Apparently related tests failing (for me) are for binary scan, expr, format, scan, interp and slave recursion limits, tell, file size, and string is integer/double. I can send a list, if that is helpful. - login: "techentin"
- mimetype: "text/plain"
- username: "techentin"
- icomment:
Ticket change [427b781217] (rid 116391) by pspjuth on 2002-09-24 04:33:47:
- icomment:
Logged In: YES user_id=98900 Looks like a case of object shimmering in shared literals. I extended the script with some debug info to see what's going on. ([info objtype] is something in my debug version that prints the internal object type): proc bug {} { grid columnconfig . 0 - minsize 10 } proc main {} { puts "Before bug: [info objtype 10]" bug puts "After bug: [info objtype 10]" puts [expr {double(10)}] puts "After double: [info objtype 10]" puts [expr 10] puts "After expr: [info objtype 10]" } proc main2 {} { puts "\nWithout bug: [info objtype 11]" puts [expr {double(11)}] puts "After double: [info objtype 11]" puts [expr 11] puts "After expr: [info objtype 11]" } main main2 Before bug: int After bug: pixel 10.0 After double: wideInt 10 After expr: wideInt Without bug: int 11.0 After double: int 11 After expr: int Grid turns the literal into a "pixel" object and then it seems double() has a preference for "wideInt" when faced with something that isn't an "int", which may or may not be considered a bug. It sure is a bug though that wide integers don't work properly on your platform, but this shows why it triggers the bug in that strange case. Does this also trigger the bug? puts [expr wide(10)] - login: "pspjuth"
- mimetype: "text/plain"
- username: "pspjuth"
- icomment:
Ticket change [ceaf15b5a7] (rid 96096) by dkf on 2002-09-24 15:47:14:
- icomment:
Logged In: YES user_id=79902 Definitely sounds like something has come unstuck, probably in configure.
- login: "dkf"
- mimetype: "text/plain"
- priority changed to: "8"
- subsystem changed to: "53. Configuration and Build Tools"
- username: "dkf"
- icomment:
Ticket change [489b70a958] (rid 99920) by dkf on 2002-09-24 15:59:19:
- icomment:
Logged In: YES user_id=79902 Does the following produce the wrong output? puts [expr wide(5+5)]
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [121e9b5213] (rid 95258) by dkf on 2002-09-24 16:04:34:
- icomment:
Logged In: YES user_id=79902 The correct thing to do is to define TCL_WIDE_INT_IS_LONG on all AXP-based platforms. Why is this not happening here?
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [d370d69361] (rid 123288) by dkf on 2002-09-24 16:12:30:
- icomment:
Logged In: YES user_id=79902 D'oh! Stupid error on my part that just happened to work on some platforms. TCL_WIDE_INT_IS_LONG was never being defined in tcl.m4, contrary to documentation and expectation...
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [a12cc13ce2] (rid 109672) by dkf on 2002-09-24 16:31:09:
- closedate changed to: "2002-09-24T09:31:09"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 I believe this is fixed in CVS now; please reopen if that's not the case. Fix was to add AC_DEFINE(TCL_WIDE_INT_IS_LONG) to tcl.m4 a couple of lines before the place where TCL_WIDE_INT_TYPE is defined (it should be fairly easy to spot) and regenerate configure (for those people who don't just want to synch with the HEAD.)
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"
Ticket change [7eafa16cdd] (rid 97458) by jkbonfield on 2002-09-24 20:34:28:
- closedate changed to: "2002-09-24T13:34:28"
- closer changed to: "jkbonfield"
- icomment:
Logged In: YES user_id=154581 The CVS change fixes this for gcc, but not for the native cc. This appears to pick __int64 as the data type and hence starts using %lld again. Would it be sensible to do the long == 64bits check as the first test as this then enables lots of code to be ifdefed out (so should take priority over using an alternative type).
- login: "jkbonfield"
- mimetype: "text/plain"
- username: "jkbonfield"
Ticket change [17ea72fa38] (rid 122577) by dkf on 2002-09-24 21:29:42:
- closedate changed to: "2002-09-24T14:29:42"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 OK, I think I've got it cracked now. (You've got one mighty strange compiler, there!)
- login: "dkf"
- mimetype: "text/plain"
- status changed to: "Pending"
- username: "dkf"
Ticket change [9517c49afb] (rid 106104) by techentin on 2002-09-25 05:20:42:
- icomment:
Logged In: YES user_id=43494 The latest CVS head now works fine on my system. Only bug left seems to be bug 574573
- login: "techentin"
- mimetype: "text/plain"
- username: "techentin"
- icomment:
Ticket change [073796a5ff] (rid 89350) by jkbonfield on 2002-09-25 15:39:40:
- icomment:
Logged In: YES user_id=154581 The configure script seems to work for me now with both DEC cc and GNU gcc. Thanks Donal.
- login: "jkbonfield"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "jkbonfield"
- icomment:
Ticket change [ca1ce1cbac] (rid 122404) by dkf on 2002-09-25 15:52:48:
- closedate changed to: "2002-09-25T08:52:48"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Cool.
- login: "dkf"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "dkf"