Skip to content
  • Simon Peyton Jones's avatar
    [project @ 2005-03-07 16:46:08 by simonpj] · 36d22a1c
    Simon Peyton Jones authored
    -----------------------------------------
           Fix a long-standing indirection-zapping bug
    	-----------------------------------------
    
    	Merge to STABLE
    
    Up to now we zap indirections as part of the occurence analyser.
    But this is bogus.  The indirection zapper does the following:
    
    	x_local = <expression>
    	...bindings...
    	x_exported = x_local
    
    where x_exported is exported, and x_local is not, then we
    replace it with this:
    
    	x_exported = <expression>
    	x_local = x_exported
    	...bindings...
    
    But this is plain wrong if x_exported has a RULE that mentions
    something (f, say) in ...bindings.., because 'f' will then die.
    
    After hacking a few solutions, I've eventually simply made the indirection
    zapping into a separate pass (which is cleaner anyway), which wraps the
    entire program back into a single Rec if the bad thing can happen.
    
    On the way I've made indirection-zapping work in Recs too, which wasn't the
    case before.
    
    * Move the zapper from OccurAnal into SimplCore
    * Tidy up the printing of pragmas (PprCore and friends)
    * Add a new function Rules.addRules
    * Merge rules in the indirection zapper (previously one set was discarded)
    36d22a1c