From bf0844a2a0d14b3fa441a76ca2ba6e67779b1271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Mon, 20 Oct 2014 00:33:36 +0100 Subject: [PATCH] make sure to reset state after error. --- C/arith2.c | 3 ++- C/eval.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/C/arith2.c b/C/arith2.c index e221782a8..e314b84e4 100644 --- a/C/arith2.c +++ b/C/arith2.c @@ -687,12 +687,13 @@ p_exp(Term t1, Term t2 USES_REGS) { Int i1 = IntegerOfTerm(t1); Int i2 = IntegerOfTerm(t2); - Int pow = ipow(i1,i2); + Int pow; if (i2 < 0) { return Yap_ArithError(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, t2, "%d ^ %d", i1, i2); } + pow = ipow(i1,i2); #ifdef USE_GMP /* two integers */ if ((i1 && !pow)) { diff --git a/C/eval.c b/C/eval.c index e0bea1a1c..38144c5b6 100644 --- a/C/eval.c +++ b/C/eval.c @@ -437,6 +437,7 @@ Yap_EvalError(yap_error_number type, Term where, char *format,...) va_list ap; if (LOCAL_ArithError) { + LOCAL_ArithError = YAP_NO_ERROR; return Yap_Error( LOCAL_Error_TYPE, LOCAL_Error_Term, LOCAL_ErrorMessage); }