Segfault when using integer-simple

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

Could you open a ticket on trac for this issue? Also have you tried to reproduce it on other architectures? On Saturday, June 15, 2013, Stephen Paul Weber wrote:
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 169821641172389640937095636777** 672117931888945045504182713271**897430274187839083732143233634** 367563316254925040331580602942**790529924419031237257992694047** 545188803054325440702792009735**658578224936744314329623399862** 853427161588994478038000957583**036049445212750560294647972107** 700330648403394932373528288706**138101730866129542001812796094** 504052779945357555018210304989**340497464935845180607042646690** 920787035715174921382511732745**931975718868480005317353569848** 454618331425749699355019762926**384123909468814180690222898222** 556785716853422930906736084397**064171894642825018414586574929** 919999999999999999999999999999**999999999999999999999999999999** 999999999999999999999999999999**999
---
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
______________________________**_________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/**mailman/listinfo/ghc-devshttp://www.haskell.org/mailman/listinfo/ghc-devs

Somebody claiming to be Carter Schonwald wrote:
Could you open a ticket on trac for this issue? Also have you tried to reproduce it on other architectures?
Done: http://hackage.haskell.org/trac/ghc/ticket/7988 I have just now tested on native linux-i486, but nothing else yet. I tried to build a cross-compiler for arm-linux just now and it complained that I don't have curses for terminfo :P If anyone with an Android or other cross-compiler could test it out, that would be awesome too, but I will keep poking. -- Stephen Paul Weber, @singpolyma See http://singpolyma.net for how I prefer to be contacted edition right joseph

On 2013-06-16 22:33, Stephen Paul Weber wrote:
Somebody claiming to be Carter Schonwald wrote:
Could you open a ticket on trac for this issue? Also have you tried to reproduce it on other architectures?
Done: http://hackage.haskell.org/trac/ghc/ticket/7988
I have just now tested on native linux-i486, but nothing else yet. I tried to build a cross-compiler for arm-linux just now and it complained that I don't have curses for terminfo :P
If anyone with an Android or other cross-compiler could test it out, that would be awesome too, but I will keep poking.
I don’t use integer-simple in my Android cross-compiler builds because I ran into problems. Possibly the same problem as you. I never did investigate any further though because it seemed like integer-gmp was the way to go for acceptable performance anyway and the switch was not difficult. -- CJ van den Berg mailto:cj@vdbonline.com xmpp:neurocyte@gmail.com

Somebody claiming to be CJ van den Berg wrote:
I don’t use integer-simple in my Android cross-compiler builds because I ran into problems. Possibly the same problem as you. I never did investigate any further though because it seemed like integer-gmp was the way to go for acceptable performance anyway and the switch was not difficult.
Did you have to seperately cross-compile libgmp first, or does android have it by default? -- Stephen Paul Weber, @singpolyma See http://singpolyma.net for how I prefer to be contacted edition right joseph

On 2013-06-17 14:16, Stephen Paul Weber wrote:
Somebody claiming to be CJ van den Berg wrote:
I don’t use integer-simple in my Android cross-compiler builds because I ran into problems. Possibly the same problem as you. I never did investigate any further though because it seemed like integer-gmp was the way to go for acceptable performance anyway and the switch was not difficult.
Did you have to seperately cross-compile libgmp first, or does android have it by default?
Yes, I have to build gmp, iconv and ncurses for Android first and then only do I build ghc. -- CJ van den Berg mailto:cj@vdbonline.com xmpp:neurocyte@gmail.com
participants (3)
-
Carter Schonwald
-
CJ van den Berg
-
Stephen Paul Weber