Hi Carl,
You're right, this looks very suspicious - and would explain some of the
random crashes people have been seeing after going round the
edit-compile-test loop enough times (ie after calling dropScriptsFrom
a bunch of times.)
Your patch looks right and seems to work just fine. Have you got any small
examples which crash the old system and work beautifully on the patched
system? After many hours spent chasing bugs through the dictionary
management part of the system, I've learnt that there's really no
substitute for a big pile of carefully targeted regression tests.
Alastair
ps A little surfing reveals that you're a robot hacker of some sort.
Are you actually using Hugs to program robots? We've been doing
a bit of that ourselves here at Yale.
> I have found and (I believe) fixed a nasty bug in
> storage.c:dropScriptsFrom(). Basically, the problem is with the
> following code fragment:
>
> for (i=INSTMIN; i<instHw; i++) {
> List ds = inst(i).dicts;
> List dn = NIL;
>
> while (nonNull(ds)) {
> List temp = tl(ds);
> if (hd(ds)<nameHw) {
> tl(ds) = dn;
> dn = ds;
> }
> ds = temp;
> }
> inst(i).dicts = rev(dn);
> }
>
> In the above fragment, hd(ds) is a Cell representing a heap-allocated
> dictionary object (i.e., a negative number); nameHw is a "name" (a
> positive number). Thus, the test always succeeds, and dictionaries
> are always kept in these lists.
>
> [patch and discussion deleted]