[GHC] #11944: Simplifier ticks exhausted When trying UnfoldingDone ip_X7RI

GHC ghc-devs at haskell.org
Sat Apr 16 14:13:31 UTC 2016


#11944: Simplifier ticks exhausted   When trying UnfoldingDone ip_X7RI
--------------------------------------+---------------------------------
           Reporter:  simone.trubian  |             Owner:
               Type:  bug             |            Status:  new
           Priority:  normal          |         Milestone:
          Component:  Compiler        |           Version:  7.10.2
           Keywords:                  |  Operating System:  Linux
       Architecture:  x86_64 (amd64)  |   Type of failure:  None/Unknown
          Test Case:                  |        Blocked By:
           Blocking:                  |   Related Tickets:
Differential Rev(s):                  |         Wiki Page:
--------------------------------------+---------------------------------
 When trying compiling the following code I get a ghc panic

 {{{#!hs
 import Network.Wai
 import Network.Wai.Handler.Warp
 import Network.HTTP.Types
   ( status200
   , status404)

 import Blaze.ByteString.Builder (copyByteString)
 import qualified Data.ByteString.UTF8 as BU
 import Data.Monoid


 main = do
     let port = 3000
     putStrLn $ "Listening on port " ++ show port
     run port app


 app req respond =
     respond
       $ case pathInfo req of
         ["avOK"] -> avOK
         ["avWrong"] -> avWrong
         x -> index x


 avOK =
     responseBuilder
     status200
     [("Content-Type", "text/html")]
     $ mconcat
     $ map copyByteString
     [ "<!DOCTYPE html>"
     , "<html>"
     , "<head>"
     , "<title>Title</title>"
     , "</head>"
     , "<body>"
     , "<div class=\"status\">"
     , "In stock, usually dispatched in 1 business day"
     , "</div>"
     , "</body>"
     , "</html>"]


 avWrong =
     responseBuilder
     status404
     [("Content-Type", "text/html")]
     $ mconcat
     $ map copyByteString ["<p>wong!</p>"]


 index x =
     responseBuilder
     status200
     [("Content-Type", "text/html")]
     $ mconcat
     $ map copyByteString
     [ "<p>Hello from "
     , BU.fromString $ show x
     , "!</p>"
     , "<p><a href='/yay'>yay</a></p>\n" ]

 }}}

 ```<no location info>:
     ghc: panic! (the 'impossible' happened)
   (GHC version 7.10.2 for x86_64-unknown-linux):
         Simplifier ticks exhausted
   When trying UnfoldingDone ip_X7RI
   To increase the limit, use -fsimpl-tick-factor=N (default 100)
   If you need to do this, let GHC HQ know, and what factor you needed
   To see detailed counts use -ddump-simpl-stats
   Total ticks: 53522k```


 After a little bit of debugging I realised that it's the `copyBytestring`
 imported from `import Blaze.ByteString.Builder` function that is causing
 trouble, by reducing the number of elements in the list the function
 doesn't crash the compiler, so for instance:

 {{{#!hs

 avOK =
     responseBuilder
     status200
     [("Content-Type", "text/html")]
     $ mconcat
     $ map copyByteString
     [ "<!DOCTYPE html>"
     , "<html><head><title>Title</title></head>"
     , "<body>"
     , "<div class=\"status\">"
     , "In stock, usually dispatched in 1 business day"
     , "</div>"
     , "</body>"
     , "</html>"]
 }}}

 compiles happily. I'm using
 - bytestring-0.10.6.0
 - wai-3.0.4.0
 - warp-3.1.8
 - http-types-0.8.6
 - blaze-builder-0.4.0.1
 - utf8-string-1.0.1.1

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


More information about the ghc-tickets mailing list