make sure wwe always initialise new variables in the body, even if we have a goal New = Old.
This commit is contained in:
parent
1130a3536d
commit
0beb2432a4
11
C/compiler.c
11
C/compiler.c
@ -888,21 +888,14 @@ c_eq(Term t1, Term t2, compiler_struct *cglobs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* first argument is an unbound var */
|
/* first argument is an unbound var */
|
||||||
if (IsNewVar(t1) && !(cglobs->cint.CurrentPred->PredFlags & TabledPredFlag)) {
|
if (IsNewVar(t1) && !IsVarTerm(t2) && !(cglobs->cint.CurrentPred->PredFlags & TabledPredFlag)) {
|
||||||
Int v;
|
Int v;
|
||||||
if (IsVarTerm(t2)) {
|
|
||||||
v = 0;
|
|
||||||
c_var(t2, v, 0, 0, cglobs);
|
|
||||||
cglobs->onhead = TRUE;
|
|
||||||
c_var(t1, v, 0, 0, cglobs);
|
|
||||||
cglobs->onhead = FALSE;
|
|
||||||
} else {
|
|
||||||
v = --cglobs->tmpreg;
|
v = --cglobs->tmpreg;
|
||||||
c_arg(v, t2, 0, 0, cglobs);
|
c_arg(v, t2, 0, 0, cglobs);
|
||||||
cglobs->onhead = TRUE;
|
cglobs->onhead = TRUE;
|
||||||
c_var(t1, v, 0, 0, cglobs);
|
c_var(t1, v, 0, 0, cglobs);
|
||||||
cglobs->onhead = FALSE;
|
cglobs->onhead = FALSE;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (IsVarTerm(t2)) {
|
if (IsVarTerm(t2)) {
|
||||||
c_var(t1, 0, 0, 0, cglobs);
|
c_var(t1, 0, 0, 0, cglobs);
|
||||||
|
Reference in New Issue
Block a user