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

GHC ghc-devs at haskell.org
Thu Feb 8 12:30:56 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:                    |
-------------------------------------+-------------------------------------

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


More information about the ghc-tickets mailing list