id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
4524	Template variable unbound in rewrite rule	guest		"I was trying to compile the latest darcs source (darcs get --lazy http://darcs.net) using ghc7.  I had to modify darcs.cabal to add !NoMonoLocalBinds to 3 places (just search for extensions, and add it to the END of the lists).

When I do a build I get this:
{{{
[ 65 of 154] Compiling Darcs.Patch.V1.Commute ( src/Darcs/Patch/V1/Commute.lhs, dist/build/Darcs/Patch/V1/Commute.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.0.1 for i386-unknown-linux):
	Template variable unbound in rewrite rule
    sg_s2vkQ{tv} [co]
    [x{tv a2uFt} [sk], y{tv a2uFu} [sk], sg_s2vkQ{tv} [co],
     sc_s2vkR{v} [lid], sc_s2vkS{v} [lid]]
    [x{tv X2uJc} [sk], y{tv X2uJe} [sk], sg_s2vkQ{tv} [co],
     sc_s2vkR{v} [lid], sc_s2vkS{v} [lid]]
    [TYPE y{tv a2uFu} [sk], TYPE y{tv a2uFu} [sk],
     TYPE x{tv a2uFt} [sk], TYPE x{tv a2uFt} [sk],
     TYPE x{tv a2uFt} [sk], sc_s2vkS{v} [lid], sc_s2vkR{v} [lid],
     darcs-2.5:Darcs.Witnesses.Ordered.NilRL{v ruI5} [gid[DataCon]]
       @ darcs-2.5:Darcs.Patch.V1.Core.Patch{tc r1EYF}
       @ x{tv a2uFt} [sk]
       @ x{tv a2uFt} [sk]
       @ x{tv a2uFt} [sk]]
    [TYPE y{tv a2uFu} [sk], TYPE y{tv a2uFu} [sk],
     TYPE x{tv a2uFt} [sk], TYPE x{tv a2uFt} [sk],
     TYPE x{tv a2uFt} [sk], wild_s2vhT{v} [lid], sc_s2vke{v} [lid],
     darcs-2.5:Darcs.Witnesses.Ordered.NilRL{v ruI5} [gid[DataCon]]
       @ darcs-2.5:Darcs.Patch.V1.Core.Patch{tc r1EYF}
       @ x{tv a2uFt} [sk]
       @ x{tv a2uFt} [sk]
       @ x{tv a2uFt} [sk]]

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
}}}

As an additional data point, this module builds correctly without !NoMonoLocalBinds.  The reason I was adding !NoMonoLocalBinds to the .cabal file is because I can't use `#if __GLASGOW_HASKELL >= 700` to conditionally add in this language flag.  The reason is because ghc6 will not correctly understand the language flag appearing inside a CPP #if/#endif block and I want this code to compile on ghc6 and 7.

Please let me know if I can provide additional information to help reproduce this bug.  My email address is dagitj on gmail, also on CC of this ticket."	bug	closed	normal		Compiler	7.0.1	fixed		dagitj@… ganesh	Linux	x86	Compile-time crash		typecheck/should_compile/T4524			
