Opened 11 years ago

Closed 11 years ago

#759 closed bug (invalid)

RULES ignored by recompilation checker

Reported by: rl@… Owned by: simonpj
Priority: normal Milestone: 6.6
Component: Compiler Version: 6.4.2
Keywords: Cc:
Operating System: Linux Architecture: x86
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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

Change History (2)

comment:1 Changed 11 years ago by simonmar

Milestone: 6.6
Owner: set to simonpj

comment:2 Changed 11 years ago by simonpj

Resolution: invalid
Status: newclosed

It turns out that the recompilation checker in ghc-ndp (and, apparently, only there) was broken when Roman reported this so the report is bogus.

Note: See TracTickets for help on using tickets.