• Simon Peyton Jones's avatar
    Fix an long-standing bug in OccurAnal · 6ec2304f
    Simon Peyton Jones authored
    This bug was beautifully characterised in Trac #12776,
    which showed a small program for which the inliner went
    into an infinite loop.  Eeek.
    
    It turned out to be a genuine and long-standing bug in
    the occurrence analyer, specifically in the bit that
    identifies loop breakers.  In this line
    
      pairs | isEmptyVarSet weak_fvs
            = reOrderNodes   0 bndr_set weak_fvs tagged_nodes []
            | otherwise
            = loopBreakNodes 0 bndr_set weak_fvs loop_breaker_edges []
    
    the 'tagged_nodes' should be 'loop_breaker_edges'.
    That's it!
    
    The diff looks a lot bigger because I did some work on
    comments and variable naming, but that's all it is.  We
    were using the wrong set of dependencies!
    
    I'm astonished that this bug has not caused more trouble.
    It dates back to at least 2011 and maybe further.
    6ec2304f
OccurAnal.hs 78.3 KB