Re: Fatal Error

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Fri 08 Dec 2000 05:57:12 PM GMT
Message-ID: <3A3120F8.BAE7835F@icparc.ic.ac.uk>
Sebastian Brand wrote:
> 
> Dies hier (Datei t.pl)
> 
>   t1  :-         p(_, X, _).
> 
>   t2  :-  X = X, p(_, X, _).
> 
>   p(_, X, _)  :-  writeln(x = X), X = a, writeln(x = X).
> 
> liefert
> 
> ECLiPSe Constraint Logic Programming System [kernel]
> Copyright Imperial College London and ICL
> Certain libraries copyright Parc Technologies Ltd
> GMP library copyright Free Software Foundation
> Version 5.1.0, Wed Nov 22 12:31 2000
> [eclipse 1]: [t].
> *** Warning: Singleton variables in clause 1 of t1/0: X
> t.pl       compiled traceable 332 bytes in 0.00 seconds
> 
> yes.
> [eclipse 2]: t1.
> x = X
> x = a
> 
> yes.
> [eclipse 3]: t2.
> x = BAD_TERM_0x800000ff_0x108158
> 
> no (more) solution.
> [eclipse 4]:
> 
> Ich vermute nicht, dass der Fehler mit der lokalen Konfiguration von
> Eclipse hier zusammenhaengt; es waere aber eine Moeglichkeit.

No, it is a buggy compiler optimization... It occasionally gets things
wrong, especially with explicit unifications (and sequences of them).

There are two ways to work around it.
One is to switch off optimizations for the critical predicates by using

:- pragma(noexpand).
t2  :-  X = X, p(_, X, _).
:- pragma(expand).

The other is to insert 'true' (which prevents the compiler from
trying to optimize across several goals):

t2  :-  X = X, true, p(_, X, _).


We will probably not try to fix this bug anymore because we plan
to completely replace the current compiler sometime next year.


> Uebrigens, unter Eclipse 3.5.2 (das hier noch vorhanden war) hat das
> Praedikat t2 den gleichen Effekt wie t1.

It does occur already with 3.5.2, but the optimizations were
switched off by default in that version...


-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc, Imperial College   /            mailto:J.Schimpf@ic.ac.uk
 London SW7 2AZ, UK         /    http://www.icparc.ic.ac.uk/eclipse
Received on Fri Dec 08 17:57:19 2000

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:02 PM GMT GMT