Overview
| Artifact ID: | de13a52f366fa5c90ae04585827437ae90c3a525 |
|---|---|
| Ticket: | da340d4f3252c73d51b609f01c88236e7b999a11
clock test failures clock-55.9 and clock-55.10 on 64-bit Windows |
| User & Date: | apnadkarni on 2016-02-24 06:09:53 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed 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 changed to: "0"
- login: "apnadkarni"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "apnadkarni"
- subsystem changed to: "16. Commands A-H"
- title changed to:
clock test failures clock-55.9 and clock-55.10 on 64-bit Windows
- type changed to: "Bug"