From 661b9c3b7dc9df4c86a20e774901bf4b500c9a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa=20II?= Date: Tue, 13 Apr 2010 00:31:25 +0100 Subject: [PATCH] protect base choice-point from nasty cutting. --- C/c_interface.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/C/c_interface.c b/C/c_interface.c index df5a6dfb4..63b5490e8 100644 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -1943,7 +1943,7 @@ YAP_RestartGoal(void) { int out; BACKUP_MACHINE_REGS(); - + if (Yap_AllowRestart) { P = (yamop *)FAILCODE; do_putcf = myputc; @@ -2023,7 +2023,9 @@ YAP_PruneGoal(void) B = B->cp_b; } Yap_TrimTrail(); - B = B->cp_b; + /* make sure that we do not destroy the guard choice-point */ + if (Yap_op_from_opcode(B->cp_ap->opc) != _Nstop) + B = B->cp_b; RECOVER_B(); } @@ -2619,6 +2621,7 @@ YAP_Reset(void) } /* reinitialise the engine */ Yap_InitYaamRegs(); + Yap_Initialised = TRUE; RECOVER_MACHINE_REGS(); return(TRUE);