Skip to content

segfault in OS X GHCi when dealing with infinite integers

GHCi happily reports the result of 1/0 to be "Infinity", but negating this value crashes.

GHCi, version 6.10.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> 1/0
Infinity
Prelude> negate (1/0)
-Segmentation fault: 11

Bug occurs on OS X 10.7.4, ghc installed via MacPorts. This seems to be either an OS-specific issue, or maybe solved in later versions of ghc, since on a linux box it is not reproducible:

GHCi, version 6.12.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> 1/0
Infinity
Prelude> negate (1/0)
-Infinity
Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information