[GHC] #8089: Implementation of GHC.Event.Poll.poll is broken due to bad coercion

GHC ghc-devs at haskell.org
Wed Jul 24 20:08:00 CEST 2013


#8089: Implementation of GHC.Event.Poll.poll is broken due to bad coercion
-------------------------------+-------------------------------------------
        Reporter:  merijn      |            Owner:
            Type:  bug         |           Status:  patch
        Priority:  normal      |        Milestone:
       Component:              |          Version:  7.6.3
  libraries/base               |         Keywords:  patch
      Resolution:              |     Architecture:  Unknown/Multiple
Operating System:              |       Difficulty:  Easy (less than 1 hour)
  Unknown/Multiple             |       Blocked By:
 Type of failure:  Runtime     |  Related Tickets:
  crash                        |
       Test Case:              |
        Blocking:              |
-------------------------------+-------------------------------------------

Comment (by merijn):

 Previously patch is not sufficiently paranoid. It just moves the underflow
 from architectures where Int is smaller than CInt to architectures where
 CInt is smaller than Int. Because the `fromIntegral (maxBound :: CInt) ::
 Int` conversion underflows in the computation of `maxPollTimeout`.

 New patch deals with this by taking the max of `maxBound :: Int` and
 `fromIntegral (maxBound :: CInt) :: Int)`, as a result if the conversion
 from `maxBound :: CInt` to Int underflows the `maxPollTimeout` is turned
 into "maxBound :: Int", which is sufficient, as the poll function can't
 receive time outs bigger than that anyway.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8089#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler




More information about the ghc-tickets mailing list