🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: net.lang.prolog
1 messages
1 total messages Started by Wayne Citrin Sun, 09 Nov 1986 00:23
Interesting Cprolog 1.5 bug
#795
Author: Wayne Citrin
Date: Sun, 09 Nov 1986 00:23
24 lines
1428 bytes
Here's an interesting bug in Cprolog 1.5 that I stumbled upon.
Take the following program:

main :- foo(_), replace_foo, fail.
foo(1).
replace_foo :- retract(foo(_)), assert(foo(2)), !.

(The cut is needed to remove the choice point set up by the retract,
but that's another bug.)

Run this program by issuing the query ?- main.
The program terminates and fails.  The call to foo/1 in main does not set
up a choice point because there is only one clause in foo at the time the
call is made.  This is the behavior one would expect.

Now, put the interpreter in debug mode and issue the same query.  The program
loops and never terminates.  The call to foo in main now has a choice point,
and there is always a new choice due to the asserted clause.

This actually happened to me yesterday.  What use is a debugger that introduces
new bugs?

Wayne Citrin
(ucbvax!citrin)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads