Artifacts Associated With Ticket da340d4f32
Ticket change [de13a52f36] (rid 144974) by apnadkarni on 2016-02-24 06:09:53:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Tests clock-55.9 and clock-55.10 fail for all 8.6.* code bases on 64-bit Windows when using the Windows 2003 SDK compiler (in particular, this includes ActiveState releases since they are built with that compiler). 32-bit builds do not exhibit these failures. 64-bit builds with optimization disabled and 64-bit builds with newer Visual Studio (2013) also do not exhibit the failure. It appears that the failures are caused by the following statement on line 1502 of tclClock.c ym1o4 = ym1 / 4; When ym1 is -1 (0001 B.C.), the 2003 SDK compiler sets ym1o4 to -1 (towards -infinity) whereas the VS 2013 compiler sets ym1o4 to 0 (towards 0). Thus test results are off by exactly one day. I thought this is a compiler bug, but the ANSI C 89 standard states: "If either operand is negative, whether the result of the / operator is the largest integer less than the algebraic quotient or the smallest integer greater than the algebraic quotient is implementation-defined" Although the specific test case trigger based on negative years, my fear is that there are other possibly more common failures lurking as integer division and % operations are (obviously) used in many places in the clock implementation and may involve negative operands. Replacing the above line with the following fragment if (ym1 >= 0) ym1o4 = ym1 / 4; else { ym1o4 = - (((unsigned int) -ym1) / 4); } (the cast is necessary) seems to fix the problem. But note there are many other places that would need a similar fix and I would suggest too risky a change for 8.6.5 /Ashok - is_private initialized to: "0"
- login: "apnadkarni"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "apnadkarni"
- subsystem initialized to: "16. Commands A-H"
- title initialized to:
clock test failures clock-55.9 and clock-55.10 on 64-bit Windows
- type initialized to: "Bug"
Ticket change [04802fc568] (rid 144975) by apnadkarni on 2016-02-24 06:11:52:
- assignee changed to: "kbk"
- icomment:
For anyone familiar with x64 assembler (and in case it helps), below is the disassembly. SDK 2003 (test failures) 000000001002DD74 cdq 000000001002DD75 and edx,3 000000001002DD78 mov r13d,eax 000000001002DD7B lea r15d,[rdx+rax] 000000001002DD7F sar r13d,2 000000001002DD83 and r15d,3 000000001002DD87 sub r15d,edx VS2013 (no test failures) 0000000068932C96 mov eax,r14d 0000000068932C99 cdq 0000000068932C9A and edx,3 0000000068932C9D add eax,edx 0000000068932C9F mov esi,eax 0000000068932CA1 and eax,3 0000000068932CA4 sub eax,edx 0000000068932CA6 sar esi,2 0000000068932CA9 mov ebp,eax
- login: "apnadkarni"
- mimetype: "text/plain"
Ticket change [2bdd65cc6a] (rid 147812) by apnadkarni on 2016-07-10 06:42:59:
- icomment: "Fixed in check-in [b6a05c2cebf] for 8.6.6"
- login: "apnadkarni"
- mimetype: "text/x-fossil-wiki"
Ticket change [83f04f3f0a] (rid 147813) by apnadkarni on 2016-07-10 06:44:16:
- closedate changed to: "2457579.78074166"
- closer changed to: "apnadkarni"
- login: "apnadkarni"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"