make sure to reset state after error.

This commit is contained in:
Vítor Santos Costa 2014-10-20 00:33:36 +01:00
parent a837a303d4
commit bf0844a2a0
2 changed files with 3 additions and 1 deletions

View File

@ -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)) {

View File

@ -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);
}