[fpc-devel]Re: Another problem with fpc v1.1

Jonas Maebe jonas at zeus.rug.ac.be
Tue Jul 2 15:17:12 CEST 2002


On zaterdag, juni 29, 2002, at 02:02 , Sergey Korshunoff wrote:

> My answer: fpc v1.1 use a stack of modules which must be compiled
> (may be as a local variables in parser.pas). Sometimes
> this dynamic variable is destoryed (  aTInputFileVar.Free is executed),
> but it is keept in stack and fpc v1.1 go to use this already invalid
> reference.
>
> Why we can not see a problem in standard configuration?
>     there is a _big_ chance (for a standard heap.inc realization) that
>     a freed block is used again for the same type of variable
>
> I think we can raise this error too by increasing a blocksize value in
> heap.inc
>
> What I found with fpc v1.1 made with
>      maxblocksize := 304 + blocksize;
> in rtl/inc/heap.inc.

With this change, I can also reproduce it easily. The problem is that 
the tinputfile of a unit is both stored in the tppumodule and in the 
tscannerfile of a unit. So in the function loadunit in fppu.pas line 
1109-1111 are wrong:

                scanner:=tscannerfile(hp.scanner);
                hp.reset;
                hp.scanner:=scanner;

The reset destroys the tinputfile of the tppumodule (it's in the 
sourcefiles list of tmodule, which is reset by tmodule.reset, which is 
called by tppumodule.reset), but this same tinputfile is still assigned 
to the inputfile field of the scanner and reused! Peter, can you have a 
look at this?


Jonas





More information about the fpc-devel mailing list