From e302eb3463745b8510aaf9a3a6052eadf93c54d7 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 27 Apr 2010 22:09:44 +0100 Subject: [PATCH] fix bad assumption in indexing code. --- C/index.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/C/index.c b/C/index.c index d019ee394..a8c22f4aa 100644 --- a/C/index.c +++ b/C/index.c @@ -3685,9 +3685,18 @@ install_log_upd_clause(ClauseDef *cls, PredEntry *ap, istack_entry *stack) move_next(cls, sp->pos); } else if (sp->pos) { UInt argno = -sp->pos; + UInt arity; skip_to_arg(cls, ap, argno, FALSE); - if (ArityOfFunctor((Functor)RepAppl(sp[-1].val)) - != argno+1) { + if (IsPairTerm(sp[-1].val)) + arity = 2; + else { + Functor f = (Functor)RepAppl(sp[-1].val); + if (IsExtensionFunctor(f)) + arity = 0; + else + arity = ArityOfFunctor((Functor)f); + } + if (arity != argno+1) { last_arg = FALSE; } }