[GHC] #11792: Optimised unsafe FFI call can get wrong argument
GHC
ghc-devs at haskell.org
Tue May 24 23:07:29 UTC 2016
#11792: Optimised unsafe FFI call can get wrong argument
-------------------------------------+-------------------------------------
Reporter: Szunti | Owner:
Type: bug | Status: new
Priority: high | Milestone:
Component: Compiler | Version: 7.10.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by hsyl20):
Replying to [comment:5 osa1]:
> {{{
> third arg: [ movl $7457,%edx]
> fourth arg: [ movl $255,%vI_n4I8, movq 7(%rbx),%vI_n4Ia,
> imulq %vI_s4pW,%vI_n4Ia, movl %vI_n4Ia,%eax,
xorq %rdx,%rdx,
> }}}
>
> These look correct to me. Since the code mostly uses virtual registers
`%edx`
> isn't overridden at this point.
It is overriden: `%rdx` is `xor`ed before each `divq`. With -ddump-asm-
liveness, we can see that `%edx` (`%r3`) born in the `movl` is
overwritten.
{{{
movl $7457,%edx
# born: %r3
# w_dying: %r3
movl $255,%vI_n413
# born: %vI_n413
movq 7(%rbx),%vI_n415
# born: %vI_n415
# r_dying: %r1
imulq %vI_s3Mw,%vI_n415
movl %vI_n415,%eax
# born: %r0
# r_dying: %vI_n415
xorq %rdx,%rdx
# born: %r3
divq %vI_n413
# r_dying: %vI_n413
# w_dying: %r3
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11792#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list