[commit: ghc] master: Fix an egregious bug in the NonRec case of bindFreeVars (fa582cc)

git at git.haskell.org git at git.haskell.org
Thu Aug 28 11:12:24 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/fa582cc4fbff690c3ce2243c0ca00ca29c029134/ghc

>---------------------------------------------------------------

commit fa582cc4fbff690c3ce2243c0ca00ca29c029134
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri May 23 08:15:52 2014 +0100

    Fix an egregious bug in the NonRec case of bindFreeVars
    
    We were missing the free variables of rules etc.  It's correct
    for Rec but wrong for NonRec.  I'm not sure how this bug hasn't
    bitten us before, but it cropped up when I was doing trimAutoRules.


>---------------------------------------------------------------

fa582cc4fbff690c3ce2243c0ca00ca29c029134
 compiler/coreSyn/CoreFVs.lhs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler/coreSyn/CoreFVs.lhs b/compiler/coreSyn/CoreFVs.lhs
index 4011191..69da1ad 100644
--- a/compiler/coreSyn/CoreFVs.lhs
+++ b/compiler/coreSyn/CoreFVs.lhs
@@ -82,7 +82,7 @@ exprsFreeVars = foldr (unionVarSet . exprFreeVars) emptyVarSet
 
 -- | Find all locally defined free Ids in a binding group
 bindFreeVars :: CoreBind -> VarSet
-bindFreeVars (NonRec _ r) = exprFreeVars r
+bindFreeVars (NonRec b r) = rhs_fvs (b,r) isLocalVar emptyVarSet
 bindFreeVars (Rec prs)    = addBndrs (map fst prs)
                                      (foldr (union . rhs_fvs) noVars prs)
                                      isLocalVar emptyVarSet



More information about the ghc-commits mailing list