Mail Archives: djgpp/1999/06/24/10:06:32
"Dr. András Sólyom" wrote:
> "Campbell, Rolf [SKY:1U32:EXCH]" wrote:
> > Old code (that worked before) failing now, is a sure sign of wild
> > pointer access.
>
> Most probably. But: Can it be caused by some compiler problems?
Technically, it could, but I doubt that it is.
> I have a code
> that is working when compiled with DJGPP V2.1 and fails with GPFs when
> compiled with V2.2. It is not very big (about 2000 lines), I tried to find
> pointer errors by a) examining the code very carefully and b) by using malloc
> debuggers under Linux, where I could find no problems.
This is even more convincing that it is a wild pointer (accessing beyond the
end of allocated blocks). I've seen this before, and if I remember right, v2.2
uses a different style for memory allocation. In 2.1, after a header is tacked
on to the malloc block, the size is rounded up to the nearest power of 2. This
means there is usually a sizable cushion at the end of each malloc'ed block
where technically you can write without getting errors. In v2.2, it is done
some other way which removes that cushion and thus makes a bug in your code more
obvious.
--
-Rolf Campbell (39)3-6318
- Raw text -