From fae3da865917ed8be3aca0aaaa596091cb874b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Mon, 25 Nov 2013 18:31:33 +0100 Subject: [PATCH] fix high arity and nth clause --- C/cdmgr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/C/cdmgr.c b/C/cdmgr.c index 5d052d2cc..c1a2dc50f 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -5203,6 +5203,7 @@ p_nth_clause( USES_REGS1 ) LogUpdClause *cl; Int ncls; + Int CurSlot, sl; if (!IsIntegerTerm(tn)) return FALSE; ncls = IntegerOfTerm(tn); @@ -5211,8 +5212,11 @@ p_nth_clause( USES_REGS1 ) return FALSE; PELOCK(47,pe); if (!(pe->PredFlags & (SourcePredFlag|LogUpdatePredFlag))) { + UNLOCK(pe->PELock); return FALSE; } + CurSlot = Yap_StartSlots( PASS_REGS1 ); + sl = Yap_InitSlot( ARG4 PASS_REGS ); /* in case we have to index or to expand code */ if (pe->ModuleOfPred != IDB_MODULE) { UInt i; @@ -5227,6 +5231,8 @@ p_nth_clause( USES_REGS1 ) IPred(pe, 0, CP); } cl = Yap_NthClause(pe, ncls); + ARG4 = Yap_GetFromSlot( sl PASS_REGS ); + LOCAL_CurSlot = CurSlot; if (cl == NULL) { UNLOCK(pe->PELock); return FALSE;