
#10602: ghc panic: Template variable unbound in rewrite rule when compiling with -O2 -------------------------------------+------------------------------------- Reporter: pacak | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc2 Keywords: | Operating System: Linux Architecture: | Type of failure: Compile-time Unknown/Multiple | crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- I've seen a few related tickets, but they are market as closed. % ghc -O2 binlist.hs [1 of 1] Compiling Main ( binlist.hs, binlist.o ) ghc: panic! (the 'impossible' happened) (GHC version 7.10.1.20150630 for x86_64-unknown-linux): Template variable unbound in rewrite rule sg_s5zh [sc_s5zf, sc_s5zg, sg_s5zh, sg_s5zi] [sc_s5zf, sc_s5zg, sg_s5zh, sg_s5zi] [: @ a_a3fo sc_s5zf sc_s5zg] [: @ a_a3fo sc_s5zb sc_s5zc] Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug % cat binlist.hs import Control.Monad import Data.Binary import Data.List newtype A a = A [a] instance Binary a => Binary (A a) where put (A xs) = case splitAt 254 xs of (_, []) -> mapM_ put xs (a, b) -> put (A b) get = do xs <- replicateM 254 get A ys <- get return $ A $ xs ++ ys main :: IO () main = undefined -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10602 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler