[fpc-devel] Closures -- debug warning @ ttgobj.FreeTemp
    Jonas Maebe 
    jonas.maebe at elis.ugent.be
       
    Tue Mar 10 14:40:12 CET 2015
    
    
  
On 10 Mar 2015, at 14:29, Blaise at blaise.ru wrote:
> On 10.03.2015 15:47, Jonas Maebe wrote:
>
>> Do you already have an svn account?
>
> The one I had back in 2012.
> My old branch is here: http://svn.freepascal.org/svn/fpc/branches/blaise/closures
You should still have access to everything under http://svn.freepascal.org/svn/fpc/branches/blaise
>> It indicates a problem in the compiler.
>
> Thanks.
> Shall I file it in the bug tracker, then?
Can't hurt.
>> 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.
>
> I am slightly confused by your choice of the pronoun, so allow me to  
> reiterate: the issue exists in the "stock" compiler, even without my  
> patches applied.
Then it will be "someone else before you".
>> 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.
>
> I am not at all familiar with this part of the compiler, so devising  
> a test case, that would result in invalid codegen, would be  
> difficult for me.
> Based on your explanation, it seems it would be something like
> 	Foo().Bar( YieldAnotherTemp() )
> assuming that YieldAnotherTemp() is called after Foo()?
It depends on when exactly the second free of the initial temp occurs.  
A testcase that results in invalid code is not necessary, however. It  
should be easily debuggable without that (although fixing it may be  
more tricky).
Jonas
    
    
More information about the fpc-devel
mailing list