[GHC] #14777: panic when using a function defined in terms of `error` (was: panic)

GHC ghc-devs at haskell.org
Thu Feb 8 06:42:50 UTC 2018


#14777: panic when using a function defined in terms of `error`
-------------------------------------+-------------------------------------
        Reporter:  zilinc            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
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 zilinc:

Old description:

> The error message I got from GHC was:
>
> {{{
> <no location info>: error:
>     ghc: panic! (the 'impossible' happened)
>   (GHC version 8.2.2 for x86_64-unknown-linux):
>         idInfo
>   t_XG0J
>   Call stack:
>       CallStack (from HasCallStack):
>         prettyCurrentCallStack, called at
> compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
>         callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in
> ghc:Outputable
>         pprPanic, called at compiler/basicTypes/Var.hs:526:34 in ghc:Var
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
> }}}
>
> How was it triggerred (in short):
> There's function definition, `f x = undefined`. If I change it to `f x =
> __impossible "Oops!"`, ghc crashes. The definition of `__impossible`
>  is simply `__impossible s = error $ s ++ "some text"`.
>
> The code can be found here:
> https://github.com/NICTA/cogent/blob/92c40530cbcbac77469865e096dab3228a2fb92f/cogent/src/Cogent/Desugar.hs#L482
> and
> https://github.com/NICTA/cogent/blob/92c40530cbcbac77469865e096dab3228a2fb92f/cogent/src/Cogent/Compiler.hs#L30
>
> It seems that this bug is not limited to 8.2.2; it also happened in
> 8.2.1.
>
> I'm happy to provide more information, if someone can advice me what is
> needed. I'll also try to shrink it to a small test case.

New description:

 The error message I got from GHC was:

 {{{
 <no location info>: error:
     ghc: panic! (the 'impossible' happened)
   (GHC version 8.2.2 for x86_64-unknown-linux):
         idInfo
   t_XG0J
   Call stack:
       CallStack (from HasCallStack):
         prettyCurrentCallStack, called at
 compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
         callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in
 ghc:Outputable
         pprPanic, called at compiler/basicTypes/Var.hs:526:34 in ghc:Var

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

 How was it triggerred (in short):
 There's function definition, `f x = undefined`. If I change it to `f x =
 __impossible "Oops!"`, ghc crashes. If I change it to `f x = error
 "Oops!", it's OK. `The definition of `__impossible`
  is simply `__impossible s = error $ s ++ "some text"`.

 The code can be found here:
 https://github.com/NICTA/cogent/blob/92c40530cbcbac77469865e096dab3228a2fb92f/cogent/src/Cogent/Desugar.hs#L482
 and
 https://github.com/NICTA/cogent/blob/92c40530cbcbac77469865e096dab3228a2fb92f/cogent/src/Cogent/Compiler.hs#L30

 It seems that this bug is not limited to 8.2.2; it also happened in 8.2.1.

 I'm happy to provide more information, if someone can advice me what is
 needed. I'll also try to shrink it to a small test case.

--

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


More information about the ghc-tickets mailing list