Artifacts Associated With Ticket 84a5355235
Ticket change [e414388ff6] (rid 217079) by pointsman on 2023-08-08 23:41:11:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
With Tcl trunk on linux (debian, gcc 10-2.1) puts [expr {(-549755813888 >> 32) & 0xFF}] returns 128 to me. On windows, build with mingw, gcc 8.1.0 the same line of code returns 255. - foundin initialized to: "trunk"
- is_private initialized to: "0"
- login: "pointsman"
- priority initialized to: "5 Medium"
- private_contact initialized to: "4ca203a8e925aecdd9419645f936bccf18cd6ea7"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "pointsman"
- subsystem initialized to: "16. Commands A-H"
- title initialized to: "[expr {(-549755813888 >> 32) & 0xFF}]"
- type initialized to: "Bug"
Ticket change [8d0a4419c1] (rid 217081) by pointsman on 2023-08-09 22:41:25:
- icomment:
Confirmed for Tcl 9 on 64-bit Windows vc build, 8.7 on 32-bit linux, OpenBSD 32-bit machine: 8.6:128, 9.0:255, OpenBSD 64-bit machine, 8.6 and 9.0: 128, mac M1 ARM: 128, by reports. The right answer would be 128, I think. This is perhaps related: puts [expr {3537118876014219 >> 51}] Tcl 9 on 64-bit linux: 1 Tcl 9 on 64-bit Windows 0 - login: "pointsman"
- mimetype: "text/plain"
- icomment:
Ticket change [df17903b96] (rid 217181) by pointsman on 2023-08-13 00:38:49:
- assignee changed to: "jan.nijtmans"
- icomment:
Apparently this was introduced with the implementation of TIP 484. Since [30f95df8b0] (5 and a half years ago!) the two examples given so far return the (I think) wrong result on 64-bit windows (the platform I tested, I suspect thats true for the other reported failing platforms also). Prior to that commit the results are the same as on 64-bit linux.
- login: "pointsman"
- mimetype: "text/x-fossil-plain"
Ticket change [a3f2bdfb87] (rid 217201) by chrstphrchvz on 2023-08-13 14:49:17:
- icomment:
In the case for <tt>INST_RSHIFT</tt> in <tt>TEBCresume()</tt> (tclExecute.c line 6080 on core-8-branch): <pre> /* * Quickly force large right shifts to 0 or -1. */<br /> if (w2 >= (Tcl_WideInt)(CHAR_BIT*sizeof(long))) { </pre> Changing <tt>sizeof(long)</tt> to <tt>sizeof(Tcl_WideInt)</tt> appears to fix this issue; I believe that is the appropriate fix since TIP 484 means 32-bit long is no longer used for Tcl integer values. I have not looked for whether the same fix is needed elsewhere for similar issues. I suggest that a test case for this issue be added to expr.test (only the right shift is important, not the bitwise AND). - login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [3b3e9c3274] (rid 217202) by jan.nijtmans on 2023-08-13 15:32:42:
- icomment:
I'm on vacation now, without laptop. But reading the analysis, +1 for the proposed solution. A testcase would be very nice too!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [702063e228] (rid 217203) by jan.nijtmans on 2023-08-13 15:34:20:
- foundin changed to: "8.7"
- icomment:
Please fix 8.7 as well, I expect the same problem there
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [bab4df61b8] (rid 217213) by chrstphrchvz on 2023-08-14 11:37:39:
- icomment:
Better yet, I suggest following DRY and using <tt>sizeof(w1)</tt> instead, and then backporting the change and the test to 8.6.
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [7d731ac94d] (rid 217314) by jan.nijtmans on 2023-08-23 20:22:00:
- icomment: "Fixed [e98c01d752|here] as suggested. Many Thanks!"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [0d34e63e0a] (rid 217315) by jan.nijtmans on 2023-08-23 20:22:11:
- closedate changed to: "2460180.34873965"
- closer changed to: "jan.nijtmans"
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [6568e09658] (rid 217345) by pointsman on 2023-08-24 23:14:54:
- closer changed to: "nobody"
- icomment:
Thanks, that works for the reported cases and help me to continue my testing work with a Tcl 9 adapted tcllib branch. The root cause here was that sizeof(long) returns something else under 64-bit windows then on most other 64-bit platforms. That is obviously a problem: depending on input not always the same code path is called on different platforms. Beside the cases you fixed there are two more such sizeof(long) calls in tclExecute.c: [https://core.tcl-lang.org/tcl/file?udc=1&ln=8848&ci=73da5acb07ce0b3e&name=generic%2FtclExecute.c] [https://core.tcl-lang.org/tcl/file?udc=1&ln=8878&ci=73da5acb07ce0b3e&name=generic%2FtclExecute.c] Perhaps you can say much easier than me if this two are harmless - I would have to get familiar with that code first.
- login: "pointsman"
- mimetype: "text/x-fossil-plain"
- status changed to: "Open"
Ticket change [804089efcf] (rid 217366) by jan.nijtmans on 2023-08-25 15:20:17:
- closedate changed to: "2460182.13909363"
- closer changed to: "jan.nijtmans"
- icomment:
See: [6a9a8809f29fa1be] Closing now
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Closed"