[commit: ghc] ghc-8.0: Do not eta-reduce across Ticks in CorePrep (7f2d6f5)

git at git.haskell.org git at git.haskell.org
Fri Mar 25 11:14:41 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/7f2d6f5a18d7b15b76bd1bf5cd59b81fb241365b/ghc

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

commit 7f2d6f5a18d7b15b76bd1bf5cd59b81fb241365b
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Mar 25 09:23:17 2016 +0000

    Do not eta-reduce across Ticks in CorePrep
    
    The function tryEtaReducePrep was being over-ambitious.
    When Breakpoint ticks were involved (i.e. in GHCi), eta
    reduction left an out-of-scope variable in the Tick.
    
    Easily fixed. Fixes the original report in Trac #111728.
    
    (cherry picked from commit 356e5e03e63558019fd0571b6c462740aceb7810)


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

7f2d6f5a18d7b15b76bd1bf5cd59b81fb241365b
 compiler/coreSyn/CorePrep.hs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs
index 04452d2..7df3409 100644
--- a/compiler/coreSyn/CorePrep.hs
+++ b/compiler/coreSyn/CorePrep.hs
@@ -971,8 +971,13 @@ tryEtaReducePrep bndrs (Let bind@(NonRec _ r) body)
   where
     fvs = exprFreeVars r
 
-tryEtaReducePrep bndrs (Tick tickish e)
-  = fmap (mkTick tickish) $ tryEtaReducePrep bndrs e
+-- NB: do not attempt to eta-reduce across ticks
+-- Otherwise we risk reducing
+--       \x. (Tick (Breakpoint {x}) f x)
+--   ==> Tick (breakpoint {x}) f
+-- which is bogus (Trac #17228)
+-- tryEtaReducePrep bndrs (Tick tickish e)
+--   = fmap (mkTick tickish) $ tryEtaReducePrep bndrs e
 
 tryEtaReducePrep _ _ = Nothing
 



More information about the ghc-commits mailing list