#4970: time002 and time004 (ghci) test failures on OS X 64 bit
-------------------------------+--------------------------------------------
Reporter: gwright | Owner: gwright
Type: bug | Status: new
Priority: normal | Component: GHCi
Version: 7.0.1 | Keywords:
Testcase: | Blockedby:
Os: MacOS X | Blocking:
Architecture: x86_64 (amd64) | Failure: Incorrect result at runtime
-------------------------------+--------------------------------------------
Comment(by gwright):
Some notes to self:
The error occurs before the microseconds values from `gettimeofday` is
multiplied by
1000000 to convert to picoseconds. Here's the source in `Time.hs` (the
preprocessed `Time.hsc`):
{{{
getClockTime :: IO ClockTime
{-# LINE 249 "libraries/old-time/./System/Time.hsc" #-}
getClockTime = do
allocaBytes (16) $ \ p_timeval -> do
{-# LINE 251 "libraries/old-time/./System/Time.hsc" #-}
throwErrnoIfMinus1_ "getClockTime" $ gettimeofday p_timeval nullPtr
sec <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) p_timeval :: IO CTime
{-# LINE 253 "libraries/old-time/./System/Time.hsc" #-}
usec <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p_timeval :: IO CTime
{-# LINE 254 "libraries/old-time/./System/Time.hsc" #-}
return (TOD (realToInteger sec) ((realToInteger usec) * 1000000))
}}}
Either `usec` is not getting the right value or something is wrong with
`realToInteger`. I'm guessing it's the former.
I've located where the multiplication by 1000000 is in the assembly code:
{{{
.text
.align 3
_s7ja_info_dsp:
.quad 0
.quad 32
_s7ja_info:
LcfET:
movq %rbx,%r14
leaq _r4N2_closure(%rip),%rax
leaq 1(%rax),%rsi
addq $8,%rbp
jmp _integerzmgmp_GHCziInteger_timesInteger_info
.long _s7ja_info - _s7ja_info_dsp
}}}
and where `gettimeofday` is called:
{{{
.text
.align 3
_oldzmtimezm1zi0zi0zi6_SystemziTime_zdwa3_info_dsp:
.quad
_oldzmtimezm1zi0zi0zi6_SystemziTime_zdwa3_srt-(_oldzmtimezm1zi0zi0zi6_SystemziTime_zdwa3_info)+0
.quad 8589934596
.quad 0
.quad 133143986191
.globl _oldzmtimezm1zi0zi0zi6_SystemziTime_zdwa3_info
_oldzmtimezm1zi0zi0zi6_SystemziTime_zdwa3_info:
LcfGM:
leaq -16(%rbp),%rax
cmpq %r15,%rax
jb LcfGO
movq %r14,%rax
movq %rax,%rdi
xorl %esi,%esi
movl $0,%eax
call ___hscore_gettimeofday
movq %r14,-8(%rbp)
movslq %eax,%rax
cmpq $-1,%rax
jne LcfGQ
leaq _r4S3_closure(%rip),%r14
leaq _s7jh_info(%rip),%rax
movq %rax,-16(%rbp)
addq $-16,%rbp
jmp _base_ForeignziCziError_throwErrno1_info
LcfGO:
leaq _oldzmtimezm1zi0zi0zi6_SystemziTime_zdwa3_closure(%rip),%rbx
jmp *-8(%r13)
LcfGQ:
addq $-16,%rbp
jmp _s69Q_info
.long _oldzmtimezm1zi0zi0zi6_SystemziTime_zdwa3_info -
_oldzmtimezm1zi0zi0zi6_SystemziTime_zdwa3_info_dsp
}}}
Now I need to do a bisection search to locate the bad relocation.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4970#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs