[fpc-devel] [patch] fixes check for unused threadvars

Sergei Gorelkin sergei_gorelkin at mail.ru
Thu Apr 23 01:49:31 CEST 2009


Sergei Gorelkin wrote:

> Attached is a one-line fix that makes programs a couple of bytes smaller 
> by preventing creation of empty threadvar tables when threadvars are not 
> actually used.
> The condition "Assigned(TAsmList.First)" always evaluates to True 
> because the list contains at least one marker item.
> 

Whoops, not that easy. It appears that 
Tresourcestrings.CreateResourceStringData
does not create new section in current_asmdata.asmlists[al_const] and 
therefore it
depends on the state in which that asmlist was left by the previously 
executed code. Hence, compiling a unit that does not have threadvars but 
has resourcestrings ends up in an IE.

Attached a corrected patch. The section prefix 'RESSTRTABLE' is my wild 
guess, so it may need to be changed.

Regards,
Sergei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threadvarfix.diff
Type: text/x-patch
Size: 1453 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20090423/f008bf7b/attachment.bin>


More information about the fpc-devel mailing list