[GHC] #15108: Panic: collectNBinders

GHC ghc-devs at haskell.org
Mon Apr 30 22:55:33 UTC 2018


#15108: Panic: collectNBinders
-------------------------------------+-------------------------------------
        Reporter:  cdisselkoen       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Profiling         |              Version:  8.4.2
      Resolution:                    |             Keywords:  panic
                                     |  collectNBinders
Operating System:  Linux             |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by cdisselkoen:

Old description:

> GHC 8.4.2 panics with the error message `collectNBinders`, when compiling
> with profiling.  This is a very similar bug to #15002, but although
> #15002 is fixed in 8.4.2, this panic persists.
>
> Steps to reproduce:
>
> `stack.yaml`:
> {{{
> resolver: nightly-2018-04-30
> }}}
>
> `bug.cabal`:
> {{{
> name:                bug
> version:             0.1.0.0
> build-type:          Simple
> cabal-version:       >=1.10
>
> executable bug
>   main-is:             Main.hs
>   build-depends:       base
>   default-language:    Haskell2010
> }}}
>
> `Main.hs`:
> {{{
> module Main where
>
> main :: IO ()
> main = do
>   _ <- return $ getInt Circle
>   return ()
>
> newtype MyInt = MyInt Int
>
> data Shape = Circle
>            | Square
>
> getInt :: Shape -> MyInt
> getInt sh =
>   case sh of
>     Circle ->
>         let (MyInt i) = MyInt 3
>         in myInt i
>     Square ->
>         let (MyInt i) = MyInt 2
>         in myInt i
>     where
>       myInt = MyInt
> }}}
>
> Then run:
> {{{
> $ stack ghc -- --version
> The Glorious Glasgow Haskell Compilation System, version 8.4.2
>
> $ stack build --profile
> bug-0.1.0.0: build (lib + exe)
> Preprocessing library for bug-0.1.0.0..
> Building library for bug-0.1.0.0..
> Preprocessing executable 'bug' for bug-0.1.0.0..
> Building executable 'bug' for bug-0.1.0.0..
> [1 of 1] Compiling Main             ( Main.hs, .stack-work/dist/x86_64
> -linux-tinfo6-nopie/Cabal-2.2.0.1/build/bug/bug-tmp/Main.p_o )
> ghc: panic! (the 'impossible' happened)
>   (GHC version 8.4.2 for x86_64-unknown-linux):
>         collectNBinders
>   1
>   Call stack:
>       CallStack (from HasCallStack):
>         callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in
> ghc:Outputable
>         pprPanic, called at compiler/coreSyn/CoreSyn.hs:2025:25 in
> ghc:CoreSyn
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
>

> --  While building custom Setup.hs for package bug-0.1.0.0 using:
>       /usr/local/home/<USER>/.stack/setup-exe-cache/x86_64-linux-
> tinfo6-nopie/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.2 --builddir=.stack-
> work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.2.0.1 build lib:bug exe:bug
> --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
>     Process exited with code: ExitFailure 1
> }}}

New description:

 GHC 8.4.2 panics with the error message `collectNBinders`, when compiling
 with profiling.  This is a very similar bug to #15002, but although #15002
 is fixed in 8.4.2, this panic persists.

 Steps to reproduce:

 `stack.yaml`:
 {{{
 resolver: nightly-2018-04-30
 }}}

 `bug.cabal`:
 {{{
 name:                bug
 version:             0.1.0.0
 build-type:          Simple
 cabal-version:       >=1.10

 executable bug
   main-is:             Main.hs
   build-depends:       base
   default-language:    Haskell2010
 }}}

 `Main.hs`:
 {{{
 module Main where

 main :: IO ()
 main = do
   _ <- return $ getInt Circle
   return ()

 newtype MyInt = MyInt Int

 data Shape = Circle
            | Square

 getInt :: Shape -> MyInt
 getInt sh =
   case sh of
     Circle ->
         let (MyInt i) = MyInt 3
         in myInt i
     Square ->
         let (MyInt i) = MyInt 2
         in myInt i
     where
       myInt = MyInt
 }}}

 Then run:
 {{{
 $ stack ghc -- --version
 The Glorious Glasgow Haskell Compilation System, version 8.4.2

 $ stack build --profile
 bug-0.1.0.0: configure (exe)
 Configuring bug-0.1.0.0...
 bug-0.1.0.0: build (exe)
 Preprocessing executable 'bug' for bug-0.1.0.0..
 Building executable 'bug' for bug-0.1.0.0..
 [1 of 1] Compiling Main             ( Main.hs, .stack-work/dist/x86_64
 -linux-tinfo6-nopie/Cabal-2.2.0.1/build/bug/bug-tmp/Main.p_o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.4.2 for x86_64-unknown-linux):
         collectNBinders
   1
   Call stack:
       CallStack (from HasCallStack):
         callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in
 ghc:Outputable
         pprPanic, called at compiler/coreSyn/CoreSyn.hs:2025:25 in
 ghc:CoreSyn

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug


 --  While building custom Setup.hs for package bug-0.1.0.0 using:
       /usr/local/home/cdisselk/.stack/setup-exe-cache/x86_64-linux-
 tinfo6-nopie/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.2 --builddir=.stack-
 work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.2.0.1 build exe:bug --ghc-
 options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
     Process exited with code: ExitFailure 1
 }}}

--

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


More information about the ghc-tickets mailing list