|
2016-07-10
| ||
| 06:44 | • Closed ticket [da340d4f32]: clock test failures clock-55.9 and clock-55.10 on 64... artifact: 83f04f3f0a user: apnadkarni | |
| 06:42 | • Ticket [da340d4f32]: 3 changes artifact: 2bdd65cc6a user: apnadkarni | |
| 06:41 | Bugfix [da340d4f32]. clock-55.9 and clock-55.10 test failures. check-in: b6a05c2ceb user: ashok tags: core-8-6-branch | |
|
2016-02-24
| ||
| 06:11 | • Ticket [da340d4f32] clock test failures clock-55.9 and clock-55.10 on 64-bit Win... artifact: 04802fc568 user: apnadkarni | |
| 06:09 | • New ticket [da340d4f32]. artifact: de13a52f36 user: apnadkarni | |
clock test failures clock-55.9 and clock-55.10 on 64-bit Windows
Closed / Fixedda340d4f3252c73d51b609f01c88236e7b999a11Created 11 years agoUpdated 10 years ago
Descriptionplain2016-02-24 06:09:53
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
Referenced by1
b6a05c2cebBugfix [da340d4f32]. clock-55.9 and clock-55.10 test failures. check-in2016-07-10 06:41:54
apnadkarniplain2016-02-24 06:11:52
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
apnadkarniwiki2016-07-10 06:42:59
Fixed in check-in [b6a05c2cebf] for 8.6.6
apnadkarni Closed ticket [da340d4f32].
[History diff]2016-07-10 06:44:16
Log in (anonymous is fine) to add a comment.