[fpc-devel] Closures -- debug warning @ ttgobj.FreeTemp

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Mar 10 13:47:34 CET 2015

On 09 Mar 2015, at 14:36, Blaise at blaise.ru wrote:

> On 15.01.2012 18:26, Blaise Thorn wrote:
>> I have implemented the support for the Delphi-compatible non- 
>> generic closures.
> I am ready to commit the improved (and fully compilable) version.
> Per Jonas Maebe's suggestion, I am going to create a new branch  
> (also, last time I tried to commit into the existing "closures"  
> branch, I was consistently getting 500 Internal Server Error).

Do you already have an svn account?

> begin
> 	Foo().Bar()
> 	// ^-- Warning: tgobj: (FreeTemp) temp at pos -44 is already free !
> end.
> ----------8<----------
> Does this indicate a problem in the compiler, or is this warning  
> bogus?

It indicates a problem in the compiler. As the message indicates, it  
means that you (or someone else before you) are trying to free a temp  
(allocated via tg.gettemp or the like) twice. The generated code will  
still be ok in this case, but it could lead to trouble in case a temp  
would be allocated again in between which would happen to get the same  
address as the old one, since then the second free of the old temp  
will free the new temp.


More information about the fpc-devel mailing list