id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
7241	GHC-7.6.1 panics on template haskell code	akamaus	simonpj	"While experimenting with TH I stumbled upon a repeating compiler panic. After minifying I got this example which triggers the failure:


{{{
% cat Peekler.hs
module Peekler where

import Language.Haskell.TH

tst = do
  o <- newName ""Foo""
  return $ [DataD [] o [] [RecC o []] [''Show]]
}}}



{{{
% cat PeeklerTest.hs
module PeeklerTest where

import Peekler

$(tst)

test = print Foo
}}}



{{{
% ghci -XTemplateHaskell PeeklerTest.hs             
GHCi, version 7.6.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 2] Compiling Peekler          ( Peekler.hs, interpreted )
[2 of 2] Compiling PeeklerTest      ( PeeklerTest.hs, interpreted )
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.1 for i386-unknown-linux):
        lookupExactOcc
<<details unavailable>>

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

> 
Leaving GHCi.
}}}





{{{
% ghc  -XTemplateHaskell PeeklerTest.hs
[1 of 2] Compiling Peekler          ( Peekler.hs, Peekler.o )
[2 of 2] Compiling PeeklerTest      ( PeeklerTest.hs, PeeklerTest.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.1 for i386-unknown-linux):
        lookupExactOcc
    Foo_a18S{tc}
    [main:PeeklerTest.Foo{tc a18S} defined at PeeklerTest.hs:5:3,
     main:PeeklerTest.Foo{d a18S} defined at PeeklerTest.hs:5:3]

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
}}}



{{{
% lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.1 LTS
Release:        12.04
Codename:       precise
}}}

"	bug	new	normal	7.8.1	Template Haskell	7.6.1				Unknown/Multiple	Unknown/Multiple	Compile-time crash	Unknown				
