[GHC] #7988: Big integers crashing integer-simple on qnxnto-arm

#7988: Big integers crashing integer-simple on qnxnto-arm --------------------------+------------------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: QNX | Architecture: arm Failure: Runtime crash | Blockedby: Blocking: | Related: --------------------------+------------------------------------------------- The following program gives a SIGSEGV when run on qnxnto-arm (my Blackberry Z10 running OS10.1, to be exact) after being compiled by my cross-compiler. Initial investigation shows that compiling a non-cross-compiler for i486 that uses integer-simple does *not* crash on the same program, so it's not a fundamental issue with integer-simple (unless the bug has been fixed between the version of source my cross-compiler uses and HEAD, which I have not yet tested because I'm not sure how to build HEAD to make a good- style statically-linking-libraries GHC). {{{ module Main(main) where main::IO() main=print 169821641172389640937095636777672117931888945045504182713271897430274187839083732143233634367563316254925040331580602942790529924419031237257992694047545188803054325440702792009735658578224936744314329623399862853427161588994478038000957583036049445212750560294647972107700330648403394932373528288706138101730866129542001812796094504052779945357555018210304989340497464935845180607042646690920787035715174921382511732745931975718868480005317353569848454618331425749699355019762926384123909468814180690222898222556785716853422930906736084397064171894642825018414586574929919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7988: Big integers crashing integer-simple on qnxnto-arm --------------------------+------------------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: QNX | Architecture: arm Failure: Runtime crash | Blockedby: Blocking: | Related: --------------------------+------------------------------------------------- Comment(by singpolyma): The following code *works*, so the integer can exist and operations can be done on it, but certain operations apparently cause it to fail: {{{ module Main(main) where import Data.Char newShow' :: Integer -> [Int] newShow' 0 = [] newShow' x = (fromIntegral $ x `mod` 10) : newShow' (x `div` 10) newShow :: Integer -> String newShow x = map intToDigit $ reverse (newShow' x) main :: IO () main = print $ newShow x where x = 169821641172389640937095636777672117931888945045504182713271897430274187839083732143233634367563316254925040331580602942790529924419031237257992694047545188803054325440702792009735658578224936744314329623399862853427161588994478038000957583036049445212750560294647972107700330648403394932373528288706138101730866129542001812796094504052779945357555018210304989340497464935845180607042646690920787035715174921382511732745931975718868480005317353569848454618331425749699355019762926384123909468814180690222898222556785716853422930906736084397064171894642825018414586574929919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7988: Big integers crashing integer-simple on qnxnto-arm --------------------------+------------------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: QNX | Architecture: arm Failure: Runtime crash | Blockedby: Blocking: | Related: --------------------------+------------------------------------------------- Comment(by singpolyma): After investigating the implementation of show, I found that this code crashes: {{{ module Main(main) where baseSize :: Integer -> Integer -> Integer baseSize b n | b > n = b | otherwise = baseSize (b*b) n main :: IO () main = const (print "hai") $! (baseSize 10 x) where x = 1698216411723896409370956367776721179318889450455041827132718974302741878390837321432336343675633162549250403315806029427905299244190312372579926940475451888030543254407027920097356585782249367443143296233998628534271615889944780380009575830360494452127505602946479721077003306484033949323735282887061381017308661295420018127960945040527799453575550182103049893404974649358451806070426466909207870357151749213825117327459319757188684800053173535698484546183314257496993550197629263841239094688141806902228982225567857168534229309067360843970641718946428250184145865749 }}} 29919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7988: Big integers crashing integer-simple on qnxnto-arm --------------------------+------------------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: QNX | Architecture: arm Failure: Runtime crash | Blockedby: Blocking: | Related: --------------------------+------------------------------------------------- Comment(by singpolyma): The bug appears to be some sort of race condition. When compiled with `-debug -rtsopts`, the test programs from above still crash, if that version is then run with `+RTS -v`, the program works fine. Here's the output: {{{ created capset 0 of type 2 created capset 1 of type 3 cap 0: initialised assigned cap 0 to capset 0 assigned cap 0 to capset 1 cap 0: created thread 1 cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (stack overflow) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stoppedcap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stoppecap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stoppedcap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC)cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (heap overflow) cap 0: starting GC cap 0: GC working cap 0: GC idle cap 0: GC done cap 0: GC idle cap 0: GC done cap 0: GC idle cap 0: GC done cap 0: GC idle cap 0: GC done cap 0: all caps stopped for GC cap 0: finished GC cap 0: running thcap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thrcap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thcap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (heap overflow) cap 0: starting GC cap 0: GC working cap 0: GC idle cap 0: GC done cap 0: GC idle cap 0: GC done cap 0: GC idle cap 0: GC done cap 0: GC idle cap 0: GC done cap 0: all caps stopped for GC cap 0: finished GC cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (yielding) cap 0: running thread 1 (ThreadRunGHC) cap 0: thread 1 stopped (suspended while making a foreign call) cap 0: running thread 1 (ThreadRunGHC) 169821641172389640937095636777672117931888945045504182713271897430274187839083732143233634367563316254925040331580602942790529924419031237257992694047545188803054325440702792009735658578224936744314329623399862853427161588994478038000957583036049445212750560294647972107700330648403394932373528288706138101730866129542001812796094504052779945357555018210304989340497464935845180607042646690920787035715174921382511732745931975718868480005317353569848454618331425749699355019762926384123909468814180690222898222556785716853422930906736084397064171894642825018414586574929919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 cap 0: thread 1 stopped (finished) cap 0: created thread 2 cap 0: running thread 2 (ThreadRunGHC) cap 0: thread 2 stopped (finished) cap 0: starting GC cap 0: GC cap 0: GC idle cap 0: GC done cap 0: GC idle cap 0: GC done cap 0: GC idle cap 0: GC done cap 0: GC idle cap 0: GC done cap 0: all caps stopped for GC cap 0: finished GC removed cap 0 from capset 0 removed cap 0 from capset 1 cap 0: shutting down deleted capset 0 deleted capset 1 }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7988: Big integers crashing integer-simple on qnxnto-arm --------------------------+------------------------------------------------- Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: QNX | Architecture: arm Failure: Runtime crash | Blockedby: Blocking: | Related: --------------------------+------------------------------------------------- Comment(by singpolyma): Running it many more times with various debug options, it will usually not crash if a lot of debug output is on, but sometimes will. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7988: Big integers crashing integer-simple on qnxnto-arm ---------------------------+------------------------------------------------ Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: QNX Architecture: arm | Failure: Runtime crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------+------------------------------------------------ Changes (by simonpj): * difficulty: => Unknown Comment: As I understand it, this crash is ARM-specific; that is `integer-simple` is just fine on other architectures. Correct? It's odd because `integer-simple` is just ordinary Haskell code. Nothing fancy, I think. Might be worth using `integer-gmp` to make things work, and checking that all regression tests work. Maybe something simpler will trigger the bug. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7988: Big integers crashing integer-simple on qnxnto-arm ---------------------------+------------------------------------------------ Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: QNX Architecture: arm | Failure: Runtime crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------+------------------------------------------------ Comment(by singpolyma): I just built HEAD registerised (or at least, didn't explicitly --enable- unregisterised). It requires the weird `-lcaps` hack still, but then my first example seems to work. I will try an unregisterised HEAD and if that also works will mark this as resolved. Sorry. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7988: Big integers crashing integer-simple on qnxnto-arm ---------------------------+------------------------------------------------ Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: QNX Architecture: arm | Failure: Runtime crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------+------------------------------------------------ Comment(by singpolyma): Ok, so, my unregisterised build of HEAD still has the crash. So this exists in unregisterised only, AFAICT -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7988: Big integers crashing integer-simple on qnxnto-arm ---------------------------+------------------------------------------------ Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: QNX Architecture: arm | Failure: Runtime crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------+------------------------------------------------ Comment(by singpolyma): Just tested an unregisterised, LLVM, integer-simple x86-linux compiler, and it worked fine, so this is something in the intersection of unregisterised and ARM -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7988: Big integers crashing integer-simple on qnxnto-arm ---------------------------+------------------------------------------------ Reporter: singpolyma | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: QNX Architecture: arm | Failure: Runtime crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------+------------------------------------------------ Changes (by PHO): * cc: pho@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7988#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC