From: Denis A Nicole (dan_at_email.domain.hidden)
Date: 2004-07-13 13:16:59
Sverre/
Thank you very much for this. There is also a long-standing problem with
SPoC which is exposed by some particular code that Oyvind needed to
compile several years ago. I have looked at it on-and-off and been unable
to trace through the data structures created by the GMD tools. I really
feel rather guilty about this, as Oyvind probably knows.
One of the reasons I have not made a full frontal assault on this compiler
issue is the status of the GMD tools themselves. As you can see on
"http://www.cocolab.de", the current versions are a highly restricted
commercial product, requiring a USB key for activation. I believe I am
free to distribute the GMD version that appears with SPoC, but I do not
have full source. There is a critical file for puma which I have in binary
only and which I suspect contains some bugs; these were explicitly worked
around when SPoC was developed.
Some time ago I was contacted by Richard Stallman who was unhappy about
the use of the GMD tools in what would otherwise be free software. He
wanted me to rewrite SPoC to remove them. If you have looked inside, you
will know that this would pretty much mean rewriting SPoC completely.
I had been dragging my feet hoping that as the GMD tools became old they
would become open source "abandonware"; this does not, however, seem to be
happening.
The short question is, what would the community like me to do and do any
of you still care?
Best Wishes,
Denis Nicole.
---------------------------------------------------------------------------
On Tue, 13 Jul 2004, Sverre Hendseth wrote:
> Hmm. According to my internet search other people have tried compiling
> SPoC on other platforms than sun and have had problems too. Read the
> SPoC comments in some Barnes' doctoral thesis at
> http://www.cs.kent.ac.uk/pubs/2003/1701/content.ps - I quote:
>
> "Attempts to build SPoC cleanly (from the various versions on their
> website), largely failed when tried on a modern Linux system often
> realised as an internal (SPoC occam) compiler error when compiling
> certain library files. Tracking these bugs down and fixing them is
> certainly possible, but as yet has not been attempted."
>
> I guess they have had the same problems that I have.
>
> Anyway, With the help of "valgrind" (and an update to my linux kernel) I
> got rid of the problem; The main problem is, it seems to me, usage of
> the gmd "reuse" function StGetString as in
>
> int l = LengthSt(S);
> char *str = (char*) malloc((l==0)?1:l);
> StGetString(S,str);
>
> The body of StGetString looks like
>
> --
> void StGetString (stringref, string)
> register tStringRef stringref;
> register char * string;
> {
> register cardinal length = LengthSt (stringref);
> register char * stringReg = (char *) stringref + 2;
>
> while (length -- > 0) * string ++ = * stringReg ++;
> * string = '\0';
> }
> --
>
> where, after staring at it for a while, the last assignment is found
> to be beyond the malloc'ed memory area.
>
> I have added one to the malloc'ed memory areas in the following places
> (referring to SPOC v1.3 source):
>
> build/Cout.c:817
> build/Cout.c:841
> build/TypeChk.c:6574 (generated from source/gmd/typechk.trafo:1414 ?)
>
> These was enough for me to compile the libraries without problems, but
> I made no exhaustive search for such too-small allocations (I guess
> there are more). Valgrind also complains about invalid reads -
> typically the lexer in source/c/Lexer.c accesses strings with index -1
> more places, and gives a lot of warnings of "Conditional jump or move
> depends on uninitialised value(s)" e.g.
>
> at UpdateUsage (Tree.c:74)
> by UpdateElementalUsage (TypeChk.c:2365)
> by TypeCheckParameters (TypeChk.c:2248)
> by TypeCheckParameters (TypeChk.c:2283)
>
> whatever this means...
>
> Now, with some more simple changes referring to C #defines
> (ARCH/SUN/linux) occ2c seems to work ok on linux, and I have an
> ambition of making a cygwin (on windows) port of it also. Other things
> to think about could be:
>
> * Clean out the rest of the Valgrind (/purify ?) complaints.
> * Straighten out the make system (configure maybe, I have never used
> it myself), making a "make install" ? At least get rid of the -DSUN
> popping up in compilation when not appropriate.
> * Improve the docs - Now it seems SPoC is a tool for experienced
> occam programmers and not an "easy way into the world of occam".
> * Make a cookbook for porting the runtime system.
> * I see some socket communication code - how does this work anyway :-)
>
> You tell me; Is it worth the bother ? Would you or somebody else that
> knows the system be interested in a (slow-going) dialogue about this ?
> I am *not* eager to walk into the gmd-toolchest (I evaluated the
> different compiler toolkits a few years ago, and decided that
> prototyping in haskell was the thing for me :-)
>
>
> Sverre
>
> ----- Original Message -----
> From: "Denis A Nicole" <dan_at_ecs.soton.ac.uk>
> To: "Sverre Hendseth" <sverre_at_hendseth.2y.net>
> Sent: Thursday, June 03, 2004 1:10 PM
> Subject: Re: SPoC - status ?
>
>
> > On Wed, 2 Jun 2004, Sverre Hendseth wrote:
> >
> > >
> > > Hi,
> > >
> > > I have tried compiling both version 1.1 and 1.3a as found on
> > > http://wotug.ukc.ac.uk/parallel/occam/compilers/spoc/
> > >
> > > Both versions, on both cygwin/windows and linux fails when trying to
> compile
> > > the libraries. The symptom is that free is called on a bad pointer, but
> this
> > > happens from inside a fopen call on the destination file (?), and the
> > > parameters to the call seems ok, so I guess there is a more nontrivial
> > > problem ?
> >
> > Unless there is a serious problem with your Cygwin version, this sounds
> > like a problem with the filename parameter to fopen.
> >
> > > I have the cocktail toolkit installed, would it help using this to
> > > regenerate C sources ?
> >
> > Probably not.
> >
> > > Has anyone else encountered this problem ? Any hints to how it can be
> solved
> > > ? Would it be worth the bother to try to find the error ?
> >
> > No, this is a new problem. I'll have a look. What platform do you actually
> > want to use SPoC on? Windows, or Linux?
> >
> > > I am teaching real-time programming this autumn at the norwegian
> institute
> > > of technology (master level), and had planned to include OCCAM and
> > > excersices using SPoC... Any advice in this context ?
> > >
> > > Sverre
> > >
> > >
> > >
> > >
> >
> > Denis A Nicole WWW: http://www.hpcc.ecs.soton.ac.uk/~dan
> > Department of Electronics Email: dan_at_ecs.soton.ac.uk
> > & Computer Science Phone: +44 23 8059 2703
> > University of Southampton Fax: +44 23 8059 3045
> > SO17 1BJ
> > United Kingdom
> >
> >
>
>
Denis A Nicole WWW: http://www.hpcc.ecs.soton.ac.uk/~dan
Department of Electronics Email: dan_at_ecs.soton.ac.uk
& Computer Science Phone: +44 23 8059 2703
University of Southampton Fax: +44 23 8059 3045
SO17 1BJ
United Kingdom
This archive was generated by hypermail 2.1.7 on 2004-10-31 20:04:02 GMT
© Copyright WoTUG
All rights reserved