[GHC] #7101: Specialise broken for implicit parameters
GHC
cvs-ghc at haskell.org
Fri Jul 27 14:00:56 CEST 2012
#7101: Specialise broken for implicit parameters
---------------------------------+------------------------------------------
Reporter: pcapriotti | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 7.6.1
Component: Compiler | Version: 7.4.2
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: Incorrect result at runtime
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
The `tcrun019` test case is failing with optimization on. Here is an even
simpler test case:
{{{
{-# LANGUAGE ImplicitParams, RankNTypes #-}
module Main where
f :: (?x :: Int) => ((?x :: Int) => Int) -> Bool -> Int
f g False = g
f g True = let ?x = ?x + 1
in f g False
h :: (?x :: Int) => Int
h = ?x
main :: IO ()
main = print (let ?x = 0 in f h True)
}}}
What happens is that `f` gets incorrectly specialized, and, as a result,
the
recursive call to `f` uses the old binding for the implicit parameter.
I think the problem was introduced with the refactoring in
5a8ac0f823c151c062a3f1903574030423bb255c, which broke the test for
implicit
parameter constraints in `Specialise.lhs`.
The attached patch seems to fix it.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7101>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list