id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
759	RULES ignored by recompilation checker	rl@…	simonpj	"The recompilation checker does not seem to take RULES into account. This can lead to some really nasty optimisation bugs. A small example:

{{{
[rl@rl-lap stuff]$ cat T.hs
module T where
foo n = n+1
{-# RULES
""foo"" forall n.
  foo (foo n) = foo (n+2)
#-}

[rl@rl-lap stuff]$ cat U.hs
module Main where
import T
main = print $ foo (foo 5)

[rl@rl-lap stuff]$ ghc --make U.hs -O
Chasing modules from: U.hs
Compiling T                ( ./T.hs, ./T.o )
Compiling Main             ( U.hs, U.o )
Linking ...
}}}

Change the rule in T.hs:

{{{
[rl@rl-lap stuff]$ cat T.hs
module T where
foo n = n+1
{-# RULES
""foo"" forall n.
  foo (foo n) = foo (n+3)
#-}

[rl@rl-lap stuff]$ ghc --make U.hs -O
Chasing modules from: U.hs
Compiling T                ( ./T.hs, ./T.o )
Skipping  Main             ( U.hs, U.o )
Linking ...
[rl@rl-lap stuff]$ ghc -c U.hs -O
compilation IS NOT required
}}}"	bug	closed	normal	6.6	Compiler	6.4.2	invalid			Linux	x86		Unknown				
