Fix a bug which caused the compiler to miscompile

Estimated hours taken: 8

Fix a bug which caused the compiler to miscompile
value_number__substitute_access_vns.

compiler/cse_detection.m:
	In find_bind_var_for_cse, ensure that if the variable which
	we are trying to hoist is bound to a different functor than
	the one we're searching for, then we stop searching for
	a match.  This is necessary, because the code that checks
	for a match assumes that the variable we're trying to hoist
	has not yet been bound.
This commit is contained in:
Fergus Henderson
1996-02-07 06:00:26 +00:00
parent 8e2a254fd2
commit 48c6589b6e

View File

@@ -555,6 +555,17 @@ find_bind_var_for_cse([GoalPair0 | Goals0], Substitution0, Var, MaybeUnify0,
Substitution = Substitution2,
CseInfo = CseInfo0,
MaybeUnify = MaybeUnify0
;
%
% if the variable was bound, but the deconstruction wasn't
% similar, then stop searching
%
Term = term__functor(_, _, _)
->
Goals = [Goal0 - GoalInfo | Goals0],
Substitution = Substitution2,
CseInfo = CseInfo0,
MaybeUnify = no
;
find_bind_var_for_cse(Goals0, Substitution2, Var,
MaybeUnify0, CseInfo0, CseInfo,