iansmith@dali.gatech.edu (Ian E. Smith) (10/13/90)
Greetings. I'm not sure if this is the right newsgroup, but I thought
I might give it a shot...
I've just gotten MH 6.7 installed on my NeXT and it seemed to be
working ok until I tried to use repl. After generating the header
(or informing you that you already have a draft), it promptly gives a
segmentation violation and crashes hard.
I have traced the segmentation violation to the following place in:
$DIST/uip/replsbr.c
for (nxtbuf = compbuffers, i = ncomps; i--; )
free (*nxtbuf++); <-- signal 11 occurs here after a few times
I think that gdb told me it was line #240. I have also determined,
that this is because that the entires in the nxtbuff array (aliased from
compbuffers) beyond a certain value are not available... in other
words, indices above a threshold value are not in the availabe memory
area. I wrote some code to check for the fact the
bug might be a bug in the code generator of gcc (not handling the
*nxtbuff++ right) :
for (i=0; i<ncomps; ++i) {
printf("my free and i is %d\n",i);
free(nxtbuf[i]);
}
But in fact it dies when i is 5 as expected. Also, since ncomps is
generated by:
ncomps = fmt_compile (cp, &fmt) + 1;
I think that ncomps is right. (Otherwise, I would think that other
stuff that uses fmt_compile would die... )
The code that mallocs the space is:
for (i = ncomps; i--; )
if ((*nxtbuf++ = malloc( SBUFSIZ )) == NULL)
adios (NULLCP, "unable to allocate component buffer");
And I checked and indeed it does iterate the correct number (ncomps)
times. Now, my question is... what is wrong?
later,
ian
--
"Daddy what's regret?"
"Well son, all I can say is its always better to regret something you
have
done, than to regret something you haven't done. And, if you see you
mother
this afternoon..." --Gibby