Article View: net.lang.prolog
Article #795Interesting Cprolog 1.5 bug
From: Wayne Citrin
Date: Sun, 09 Nov 1986 00:23
Date: Sun, 09 Nov 1986 00:23
24 lines
1428 bytes
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)
Technical Details
Message-ID:
<16352@ucbvax.BERKELEY.EDU>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!citrinShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!citrin From: citrin@ucbvax.BERKELEY.EDU (Wayne Citrin) Newsgroups: net.lang.prolog Subject: Interesting Cprolog 1.5 bug Message-ID: <16352@ucbvax.BERKELEY.EDU> Date: Sat, 8-Nov-86 19:23:18 EST Article-I.D.: ucbvax.16352 Posted: Sat Nov 8 19:23:18 1986 Date-Received: Sun, 9-Nov-86 03:46:01 EST Reply-To: citrin@ucbvax.Berkeley.EDU.UUCP (Wayne Citrin) Organization: University of California at Berkeley Lines: 24