[GHC] #14163: Stack Overflow with ApplicativeDo

GHC ghc-devs at haskell.org
Mon Aug 28 18:15:57 UTC 2017


#14163: Stack Overflow with ApplicativeDo
-------------------------------------+-------------------------------------
        Reporter:  lippling          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  MacOS X           |         Architecture:  x86_64
 Type of failure:  Compile-time      |  (amd64)
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by lippling:

Old description:

> I tried to compile one of our server applications with 8.2.1 (which
> compiles fine with 8.0.2).
>
> The compilation runs smooth, but when it reaches a specific file, the RAM
> usage goes up to > 20GB pretty fast on my 16GB machine and the GHC
> process gets terminated with a stack overflow error.
>
> I tried to find a minimal example that causes this behavior:
>
> {{{
> #!/usr/bin/env stack
> -- stack --resolver nightly-2017-08-25 script
>
> {-# LANGUAGE ApplicativeDo #-}
>
> x = do
>     (a, _) <- undefined
>     (b, _) <- undefined
>     (c, _) <- undefined
>     undefined
>
> main = undefined
> }}}
>
> It only happens with at least 3 of these pattern matches.

New description:

 I tried to compile one of our server applications with 8.2.1 (which
 compiles fine with 8.0.2).

 The compilation runs smoothly, but when it reaches a specific file, the
 RAM usage goes up to > 20GB pretty fast on my 16GB machine and the GHC
 process gets terminated with a stack overflow error.

 I tried to find a minimal example that causes this behavior:

 {{{
 #!/usr/bin/env stack
 -- stack --resolver nightly-2017-08-25 script

 {-# LANGUAGE ApplicativeDo #-}

 x = do
     (a, _) <- undefined
     (b, _) <- undefined
     (c, _) <- undefined
     undefined

 main = undefined
 }}}

 It only happens with at least 3 of these pattern matches.

--

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


More information about the ghc-tickets mailing list