Opened 3 years ago

Closed 3 years ago

#13106 closed bug (fixed)

impossible happened: initTc: unsolved constraints

Reported by: codygman Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: initTc Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #12921 Differential Rev(s):
Wiki Page:

Description (last modified by codygman)

Below is the error:

I got the following error:

ghc: panic! (the 'impossible' happened)
      (GHC version 8.0.1.20161213 for x86_64-unknown-linux):
        initTc: unsolved constraints
      WC {wc_insol =
            [W] cp_a6SB :: t_a6SA[tau:1] (CHoleCan: cp)
            [W] minimal_a6SI :: t_a6SH[tau:1] (CHoleCan: minimal)
            [W] frames_a6SL :: t_a6SK[tau:1] (CHoleCan: frames)
            [W] ps_a6Tb :: t_a6Ta[tau:1] (CHoleCan: ps)
            [W] minimal_a6Ti :: t_a6Th[tau:1] (CHoleCan: minimal)
            [W] frames_a6Tm :: t_a6Tl[tau:1] (CHoleCan: frames)
            [W] map_hd_a6Tv :: t_a6Tu[tau:1] (CHoleCan: map_hd)
            [W] ps_a6Ty :: t_a6Tx[tau:1] (CHoleCan: ps)}

It was created with this repo: https://github.com/codygman/minimal-frames-lookup-map/blob/master/src/Main.hs

Apologies for the setup needed, but I also had to download judy-0.3.0 manually and then include it for it to build (not sure why, but unrelated problem I think).

GHC Head is still compiling for me, but maybe I'll be able to try to reproduce this with HEAD tomorrow.

Change History (6)

comment:1 Changed 3 years ago by codygman

Description: modified (diff)

comment:2 Changed 3 years ago by simonpj

Probably a dup of #12921 (which I have not yet examined).

comment:3 Changed 3 years ago by RyanGlScott

A minimal reproducible test case is:

{-# LANGUAGE TemplateHaskell #-}                                                          
module Main (main) where                                                                  
                                                                                          
main :: IO ()                                                                             
main = do                                                                                 
   cp minimal-frames-lookup-map.ps minimal-frames-lookup-map_hd.ps                        
cp minimal-frames-lookup-map.ps  minimal-frames-lookup-map_hy.ps

Or even more minimally:

{-# LANGUAGE TemplateHaskell #-}
module Main (main) where

main :: IO ()
main = do
   cp
cp

comment:4 Changed 3 years ago by RyanGlScott

Like #12921, this only happens on GHC 8.0.2 and HEAD, not on GHC 8.0.1.

comment:5 Changed 3 years ago by Simon Peyton Jones <simonpj@…>

In f5f6d423/ghc:

Fix top-level constraint handling (Trac #12921)

Some out-of-scope errors were not being reported if anyone
throws an un-caught exception in the TcM monad.  That led to

  ghc: panic! (the 'impossible' happened)
	initTc: unsolved constraints

I fixed this

* Splitting captureConstraints to use an auxilliary
  tryCaptureConstraints (which never fails)

* Define a new TcSimplify.captureTopConstraints (replacing
  the old TcRnMonad.captureTopConstraints), which reports
  any unsolved out-of-scope constraints before propagating
  the exception

That in turn allowed me to do some tidying up of the static-constraint
machinery, reducing duplication.

Also solves #13106.

comment:6 Changed 3 years ago by simonpj

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.