[GHC] #8695: Arithmetic overflow from (minBound :: Int) `quot` (-1)

GHC ghc-devs at haskell.org
Tue Jan 28 23:00:27 UTC 2014


#8695: Arithmetic overflow from (minBound :: Int) `quot` (-1)
------------------------------------------------+--------------------------
        Reporter:  rleslie                      |            Owner:
            Type:  bug                          |           Status:  patch
        Priority:  normal                       |        Milestone:  7.8.1
       Component:  libraries/haskell2010        |          Version:  7.6.3
      Resolution:                               |         Keywords:
Operating System:  Unknown/Multiple             |     Architecture:
 Type of failure:  Incorrect result at runtime  |  Unknown/Multiple
       Test Case:                               |       Difficulty:
        Blocking:                               |  Unknown
                                                |       Blocked By:
                                                |  Related Tickets:  #1042
------------------------------------------------+--------------------------

Comment (by hvr):

 Replying to [comment:14 rwbarton]:
 > [...]
 > Unfortunately, there is no choice of behavior that is best in all
 contexts. For the kinds of programs I most often write, which are
 computations I run on my own computer, raising an exception is preferable
 ("safer").
 > [...]

 IMHO, different types should be used for different contexts. If you want
 exceptions on any kind of overflow, use something like hackage:safeint, if
 you don't want overflows at all, use `Integer`, and if want wrap-around on
 overflow, use plain `Int`s.

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


More information about the ghc-tickets mailing list