[GHC] #14777: panic

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[GHC] #14777: panic

GHC - devs mailing list
#14777: panic
-------------------------------------+-------------------------------------
           Reporter:  zilinc         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.2
           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:
-------------------------------------+-------------------------------------
 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.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
#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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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. 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.
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:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 If you were able to provide an easily-reproducible test case, it'd make it
 much more likely that we can fix it.  Thanks!

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by zilinc):

 I'm been trying to do that, but strangely any random changes to the code
 could potentially void the bug. I have no clue how to proceed.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 I can't reproduce this. Please can you provide exact reproduction
 instructions?

 Steps I took:

 {{{
 git clone https://github.com/NICTA/cogent.git
 cd cogent/cogent
 git reset --hard 92c40530cbcbac77469865e096dab3228a2fb92f
 git clone https://gist.github.com/e6fc9e8a254d795bbd8ec476ca9fc115.git
 nix-scripts
 cp nix-scripts/* .
 nix-shell
 cabal configure
 cabal build
 }}}

 Then the build completes successfully.

 Here are the nix files.
 https://gist.github.com/e6fc9e8a254d795bbd8ec476ca9fc115

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by zilinc):

 Thank you providing the steps. If you could apply the following change to
 the code, you might be able to reproduce the panic.
 {{{
 diff --git a/cogent/src/Cogent/Desugar.hs b/cogent/src/Cogent/Desugar.hs
 index bdea312..6a6f308 100644
 --- a/cogent/src/Cogent/Desugar.hs
 +++ b/cogent/src/Cogent/Desugar.hs
 @@ -479,7 +479,7 @@ desugarExpr (B.TE t@(S.RT (S.TVariant ts)) (S.Con c
 es) l) = do
  desugarExpr (B.TE _ (S.Seq e1 e2) _) = do
    v <- freshVar
    E <$> (Let v <$> desugarExpr e1 <*> withBinding v (desugarExpr e2))
 -desugarExpr (B.TE _ (S.Lam p mt e) _) = undefined
 +desugarExpr (B.TE _ (S.Lam p mt e) _) = __impossible "xx"
  desugarExpr (B.TE _ (S.App e1 e2) _) = E <$> (App <$> desugarExpr e1 <*>
 desugarExpr e2)
  desugarExpr (B.TE _ (S.If c [] th el) _) = E <$> (If <$> desugarExpr c
 <*> desugarExpr th <*> desugarExpr el)
  desugarExpr (B.TE _ (S.If c vs th el) _) = do
 }}}


 Replying to [comment:5 mpickering]:
 > I can't reproduce this. Please can you provide exact reproduction
 instructions?
 >
 > Steps I took:
 >
 > {{{
 > git clone https://github.com/NICTA/cogent.git
 > cd cogent/cogent
 > git reset --hard 92c40530cbcbac77469865e096dab3228a2fb92f
 > git clone https://gist.github.com/e6fc9e8a254d795bbd8ec476ca9fc115.git
 nix-scripts
 > cp nix-scripts/* .
 > nix-shell
 > cabal configure
 > cabal build
 > }}}
 >
 > Then the build completes successfully.
 >
 > Here are the nix files.
 https://gist.github.com/e6fc9e8a254d795bbd8ec476ca9fc115
 >
 >

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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. 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.
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:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 Thanks, I can reproduce this now.

 {{{
 <no location info>: error:
     ghc: panic! (the 'impossible' happened)
   (GHC version 8.2.2 for x86_64-unknown-linux):
         idInfo
   t_XI02
   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
 }}}

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by zilinc):

 More experiments: after I made the following changes:
 {{{
 diff --git a/cogent/src/Cogent/Desugar.hs b/cogent/src/Cogent/Desugar.hs
 index bdea312..3b8440d 100644
 --- a/cogent/src/Cogent/Desugar.hs
 +++ b/cogent/src/Cogent/Desugar.hs
 @@ -175,9 +175,11 @@ pragmaToNote (_:pragmas) fn note = pragmaToNote
 pragmas fn note
  --
 -----------------------------------------------------------------------------

  lamLftTlv :: S.TopLevel S.RawType B.TypedPatn B.TypedExpr
 -           -> DS t v (S.TopLevel S.RawType B.TypedPatn B.TypedExpr)
 -lamLftTlv (S.FunDef fn sigma alts) = undefined
 +          -> DS t v (S.TopLevel S.RawType B.TypedPatn B.TypedExpr)
 +lamLftTlv (S.FunDef fn sigma alts) = S.FunDef fn sigma <$> mapM lamLftAlt
 alts

 +lamLftAlt :: S.Alt B.TypedPatn B.TypedExpr -> DS t v (S.Alt B.TypedPatn
 B.TypedExpr)
 +lamLftAlt (S.Alt p l e) = S.Alt p l <$> lamLftExpr e

  lamLftExpr :: B.TypedExpr -> DS t v B.TypedExpr
  lamLftExpr (B.TE t (S.Lam p mt e) l) = do
 @@ -192,6 +194,7 @@ lamLftExpr (B.TE t (S.Lam p mt e) l) = do
    let fn = S.FunDef f (S.PT [] t) [S.Alt (B.TP (S.PIrrefutable p) noPos)
 Regular e]  -- no let-generalisation
    lftFun %= (fn:)
    return $ B.TE t (S.TypeApp f [] S.NoInline) l
 +lamLftExpr (B.TE t e l) = B.TE t <$> traverse lamLftExpr e <*> pure l

  -- freeVars :: B.TypedExpr -> Vec v VarName -> [(VarName, S.RawType)]
  -- freeVars (B.TE t (S.Var v) _) vs = maybeToList $ case findIx v vs of
 Just i -> Nothing; Nothing -> Just (v,t)
 @@ -479,7 +482,7 @@ desugarExpr (B.TE t@(S.RT (S.TVariant ts)) (S.Con c
 es) l) = do
  desugarExpr (B.TE _ (S.Seq e1 e2) _) = do
    v <- freshVar
    E <$> (Let v <$> desugarExpr e1 <*> withBinding v (desugarExpr e2))
 -desugarExpr (B.TE _ (S.Lam p mt e) _) = undefined
 +desugarExpr (B.TE _ (S.Lam p mt e) _) = __impossible "desugarExpr (Lam)"
  desugarExpr (B.TE _ (S.App e1 e2) _) = E <$> (App <$> desugarExpr e1 <*>
 desugarExpr e2)
  desugarExpr (B.TE _ (S.If c [] th el) _) = E <$> (If <$> desugarExpr c
 <*> desugarExpr th <*> desugarExpr el)
  desugarExpr (B.TE _ (S.If c vs th el) _) = do
 }}}

 It doesn't crash with the `__impossible`, but this time it crashes with
 the `undefined`.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by zilinc):

 For quite a few times, after I change some code, if it crashes, I can
 always fix it by changing one `__impossible` to `undefined` or v.v. I'm
 unsure whether it's a coincidence or not.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by tdammers):

 I tried to reproduce this on GHC 8.2.1, but it builds cleanly, both with
 `__impossible` and `undefined`. I'm using the current `master` branch
 though, because the specified commit doesn't seem to exist in any of the
 exposed branches anymore.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by zilinc):

 Replying to [comment:11 tdammers]:
 > I tried to reproduce this on GHC 8.2.1, but it builds cleanly, both with
 `__impossible` and `undefined`. I'm using the current `master` branch
 though, because the specified commit doesn't seem to exist in any of the
 exposed branches anymore.

 The commit is still there. But I totally believe that you could not
 reproduce it on an arbitrary commit, otherwise it would be easier to
 figure out what crashed the compiler.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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. 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.
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/9420861128a8c445138aa6a48c62140d8c5f72eb/cogent/src/Cogent/Desugar.hs#L482
 and
 https://github.com/NICTA/cogent/blob/9420861128a8c445138aa6a48c62140d8c5f72eb/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:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------
Changes (by sighingnow):

 * Attachment "T14774.zip" added.

 Self-contained test case for T14777

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by sighingnow):

 I have create a self-contained minimal case (still have several files but
 only depends on base, mtl and containers) that can trigger this panic.

 I **can** reproduce this panic with ghc-8.2.1 (nightly-2017-11-24) and
 ghc-8.2.2 (lts-10.3/lts-10.4) but **cannot** with ghc-8.4.1 and ghc-head.
 Maybe it has already been fixed. I also have test with with ghc-8.0.1
 (lts-9.4) but also failed to trigger the panic with this minimal case.

 Step to reproduce with ghc-8.2.2: unzip and enter `src`, then

 {{{
 stack exec --resolver=lts-10.4 -- ghc Cogent.Desugar -fforce-recomp  -O2
 }}}

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------
Changes (by monoidal):

 * Attachment "Cogent.zip" added.

 smaller reproduction testcase

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by monoidal):

 I have simplified a bit further, to 2 files; can be reproduced with

 {{{
 ghc-8.2.1 --make Cogent/Desugar -fforce-recomp -O2
 }}}

 This doesn't appear on ghc 8.4 - likely this was fixed. However, the panic
 depends on many conditions, even small changes to code can make it
 disappear, so it might be worth further investigation.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 I took a peek at monoidal's reproduction, using a devel2 build of 8.2.2
 with some extra `HasCallStack`s. Running with Core Lint and `-O2`, I get

 {{{
 [2 of 2] Compiling Cogent.Desugar   ( Cogent/Desugar.hs, Cogent/Desugar.o
 )
 WARNING: file compiler/simplCore/OccurAnal.hs, line 69
   Glomming in Cogent.Desugar: [s55P :-> OnceL!]
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 8.2.2 for x86_64-unknown-linux):
         idInfo
   v_X5mQ
   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
         idInfo, called at compiler/basicTypes/Id.hs:736:37 in ghc:Id
         idInlinePragma, called at compiler/basicTypes/Id.hs:745:49 in
 ghc:Id
         idInlineActivation, called at
 compiler/simplCore/SimplUtils.hs:923:56 in ghc:SimplUtils
         getUnfoldingInRuleMatch, called at
 compiler/simplCore/Simplify.hs:1946:34 in ghc:Simplify
         tryRules, called at compiler/simplCore/Simplify.hs:1776:22 in
 ghc:Simplify
 }}}

 (I have no idea if the lint warning is relevant). About all I can see
 about what's gone wrong is that something seems to be treating a type
 variable as though it were a term variable. That is, if I understand the
 `Var` type properly.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

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

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#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:                    |
-------------------------------------+-------------------------------------
Changes (by dfeuer):

 * cc: dfeuer (added)


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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
12