[GHC] #15634: GHCi: Segmentation fault Data.List.sum large number

GHC ghc-devs at haskell.org
Thu Sep 13 11:06:31 UTC 2018


#15634: GHCi: Segmentation fault Data.List.sum large number
-------------------------------------+-------------------------------------
        Reporter:  ksallberg         |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  Research
                                     |  needed
       Component:  GHCi              |              Version:  8.0.1
      Resolution:                    |             Keywords:  segfault
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 Stack overflow is expected. `Prelude.sum` is implemented using `foldl`
 which is leaky and will overflow the stack at some point. Try this:

 {{{
 ~ $ ghci
 GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/omer/rcbackup/.ghci
 λ:1> foldl (+) 0 [1..100000000]
 *** Exception: stack overflow
 λ:2> import Data.List
 λ:3> foldl' (+) 0 [1..100000000]
 5000000050000000
 }}}

 The segfault is an actual bug. Would it be possible for you to try this
 with GHC HEAD or at least 8.4.3? I tried with both and also with 8.0.1,
 but couldn't reproduce the segfault. If you can build GHC HEAD, it'd also
 be helpful to get a backtrace by doing this:

 - vim `which ghc`
 - Replace the last line with this: `exec gdb --args "$executablename"
 -B"$topdir" ${1+"$@"}`
 - Run ghci using `ghc --interactive`
 - On segfault type `bt<enter>`, and paste the backtrace.

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


More information about the ghc-tickets mailing list