From 2bd2bcb68b3d2bd7c90a9839ef4861546b98c2c3 Mon Sep 17 00:00:00 2001 From: vsc Date: Fri, 23 May 2003 12:31:50 +0000 Subject: [PATCH] fix bad understanding of put_y_val in add_info/index.c git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@832 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/index.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/C/index.c b/C/index.c index 9f87b2bff..14a078714 100644 --- a/C/index.c +++ b/C/index.c @@ -210,7 +210,7 @@ delete_regcopy(wamreg regs[MAX_REG_COPIES], int regs_count, wamreg copy) } i++; } - /* this copy had overflowed */ + /* this copy had overflowed, or it just was not there */ return regs_count; } @@ -1083,18 +1083,20 @@ add_info(ClauseDef *clause, UInt regno) break; case _put_y_val: case _put_unsafe: - if (regcopy_in(myregs, nofregs, cl->u.yx.x)) { - ycopy = cl->u.yx.y; + if (ycopy == cl->u.yx.y) { + nofregs = add_regcopy(myregs, nofregs, cl->u.yx.x); + } else { + nofregs = delete_regcopy(myregs, nofregs, cl->u.yx.x); } cl = NEXTOP(cl,yx); break; case _get_y_val: - if (regcopy_in(myregs, nofregs, cl->u.xy.x)) { + if (regcopy_in(myregs, nofregs, cl->u.yx.x)) { ycopy = cl->u.yx.y; } else if (ycopy == cl->u.yx.y) { - nofregs = add_regcopy(myregs, nofregs, cl->u.xy.x); + nofregs = add_regcopy(myregs, nofregs, cl->u.yx.x); } - cl = NEXTOP(cl,xy); + cl = NEXTOP(cl,yx); break; case _get_atom: if (regcopy_in(myregs, nofregs, cl->u.xc.x)) {