[GHC] #13527: ghc has a stack space leak when prints warnings

GHC ghc-devs at haskell.org
Sun Apr 9 15:00:58 UTC 2017


#13527: ghc has a stack space leak when prints warnings
-------------------------------------+-------------------------------------
        Reporter:  slyfox            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
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 slyfox):

 Slightly more context. '''utf8DecodeString''' overflows stack:
 http://git.haskell.org/ghc.git/blob/HEAD:/compiler/utils/Encoding.hs#l118

 {{{#!hs
 utf8DecodeString :: Ptr Word8 -> Int -> IO [Char]
 utf8DecodeString ptr len
   = unpack ptr
    where
      !end = ptr `plusPtr` len

      unpack p
          | p >= end = return []
          | otherwise  =
          case utf8DecodeChar# (unPtr p) of
             (# c#, nBytes# #) -> do
                  chs <- unpack (p `plusPtr#` nBytes#) -- deep recursion
                  return (C# c# : chs)
 }}}

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


More information about the ghc-tickets mailing list