bug-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Access Violation with abolish


From: Gustavo Brown - INCO
Subject: Access Violation with abolish
Date: Wed, 1 Jul 2015 17:05:30 -0300

I am getting an access violation when trying to abolish some facts.
All the functions involved are from the file dynam_supp.c file (BipsPL)
 
Inspecting the code (dynam_supp.c) I think the problem is that there is a special marker (ALL_MUST_BE_ERASED) with value 2 that is used in Erase_All to mark that you want to erase all clauses(in member first_erased_cl).
However, when Clean_Erased_Clauses() is called it may be the case that the the first_erased_cl is also marked to keep (because it is still used in the local stack) leading to keep member first_erased_cl with ALL_MUST_BE_ERASED and not its previous value.
 
Now, if PlDelete_Dynamic_Clause is called (e.g. due to a retract), then member next_erased_cl might be copied with that special value ALL_MUST_BE_ERASED.
 
Then if Clean_Erased_Clauses() is called again and now this snippet fails
for (clause = dyn->first_erased_cl; clause; clause = clause1)
 {
   clause1 = clause->next_erased_cl;
   size_of_erased -= clause->term_size;
   Unlink_Clause(clause);
   Free_Clause(clause);
 }
 
because clause->next_erased_cl might hold ALL_MUST_BE_ERASED instead of NULL, which is the stopping condition of that for loop.
 
Using GNU Prolog 1.4.4
 
Regards,
   Gustavo

reply via email to

[Prev in Thread] Current Thread [Next in Thread]