Segfault when using integer-simple

Stephen Paul Weber singpolyma at singpolyma.net
Sat Jun 15 11:02:38 CEST 2013


This may not be integer-simple, but that's my immediate suspicion.  The 
following two programs crash with SIGSEGV and core dump when run on my BB10 
device after being cross-compiled with my GHC-to-QNXNTO-ARM cross-compiling 
GHC:

> module Main (main) where
> 
> import Data.Bits
> import Data.ByteString
> import qualified Data.ByteString.Char8 as C8
> 
> os2ip :: ByteString -> Integer
> os2ip = foldl' (\a b -> (256 * a) .|. (fromIntegral b)) 0
> 
> main :: IO ()
> main = do
> 	print $ os2ip x
> 	where
> 	x = C8.pack "\NUL\STX\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\NUL\ETX\SOH\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255"

---

> module Main (main) where
> 
> main :: IO ()
> main = print 169821641172389640937095636777672117931888945045504182713271897430274187839083732143233634367563316254925040331580602942790529924419031237257992694047545188803054325440702792009735658578224936744314329623399862853427161588994478038000957583036049445212750560294647972107700330648403394932373528288706138101730866129542001812796094504052779945357555018210304989340497464935845180607042646690920787035715174921382511732745931975718868480005317353569848454618331425749699355019762926384123909468814180690222898222556785716853422930906736084397064171894642825018414586574929919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

---

So, it seems to be a problem with forcing very large integers.  I'm not sure 
if this is my integer-simple build, integer-simple in general, or something 
strange in the way I built GHC.

Can one of the people working on Android and/or Raspberry Pi ports try this 
code out and let me know if it works for you?  I'll try to do a native 
(non-cross-compile) build of GHC with integer-simple as well, to test this 
on.

-- 
Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph



More information about the ghc-devs mailing list