[m-dev.] Diff: Fix an old CLP(R) bug

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Feb 8 17:44:32 AEDT 2000


On 07-Feb-2000, Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> Last week I wrote:
> > Estimated hours taken: 0.25
> > 
> > Fix an _old_ CLP(R) bug.
> > 
> > clpr/clpr/init.c:
> > 	When checking pointers to determine whether tagging is going to work
> > 	OK, check all three kinds of pointers, not just the first two.
> 
> Obviously I didn't test this before I committed it.  It turns out that under 
> Linux/i386 (at least my Red Hat 6.0(?) installation here), the third kind of 
> pointer (local stack variable) has the top bit set, and so the standalone 
> CLP(R) refuses to run now.
> 
> Either CLP(R) never actually tags pointers to local stack variables (in 
> which case my fix was wrong), or it was just lucky that it (apparently) 
> worked before.
...
> Thoughts?

The main purpose of including the CLP(R) interface in the Mercury
distribution is as a "technology demonstration".  It is sample
code which shows how you can interface with a constraint solver
from Mercury.

However, CLP(R) itself is severely flawed.  The source code is
pretty horrible, e.g. it makes use of non-portable techniques with
pointer tags, it uses "extern" declarations rather than header files,
etc. -- basically it is a classic example of "legacy code".
Furthermore, it is encumbered with some nasty IP restrictions.

Therefore I would not recommend using Mercury's CLP(R) interface
for any purpose other than as a demonstration.

That said, my guess is that CLP(R) probably does not make use of
tags on locals.  So I suggest you undo your change.
It's possible that the code might use tags on locals
somewhere, in which case it will be buggy on x86 Linux,
but it's also possible that there are lots of other bugs
in it too; if it appears to work for some simple examples,
then I think it fulfils its role as a technology demonstration
just fine.

I also propose to add some comments similar to my comments
above to the extras/clpr/README file.

--------------------

Estimated hours taken: 0.5

extras/clpr/README:
	Document that the CLP(R) interface is only intended
	as a "technology demonstration", and advise against
	using it for other purposes.

Workspace: /d-drive/home/hg/fjh/mercury
Index: extras/clpr/README
===================================================================
RCS file: /home/mercury1/repository/clpr/README,v
retrieving revision 1.5
diff -u -d -r1.5 README
--- extras/clpr/README	1997/09/30 14:13:37	1.5
+++ extras/clpr/README	2000/02/08 06:39:29
@@ -21,3 +21,17 @@
 	dec-alpha-osf3.2
 	i586-pc-linux-gnu
 
+The main purpose of including the CLP(R) interface in the Mercury
+distribution is as a "technology demonstration".  It is sample
+code which shows how you can interface with a constraint solver
+from Mercury.
+
+However, CLP(R) itself is rather flawed.  The source code is
+not very nice, e.g. it makes use of non-portable techniques with
+pointer tags, it uses "extern" declarations rather than header files,
+etc. -- basically it is a classic example of "legacy code".
+Furthermore, it is encumbered with some severe licencing restrictions.
+
+Therefore we do not recommend using Mercury's CLP(R) interface
+for any purpose other than as a demonstration.
+

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list