[fpc-devel] Compiler gives AV during WPO

Joost van der Sluis joost at cnoc.nl
Fri Oct 25 19:46:40 CEST 2019

Hi all,

I have some problems with WPO. When the unit in the attached example is 
compiled for the third time, the compiler crashes while writing the 
WPO-information to the ppu.

This is because the a tobjectdef which has been added to the WPO-list 
with classes which are created has been freed.

I am not sure what happens exactly, and I was not able to generate a 
simpler example. But my guess is that there is a method in which an 
instance of the class is created. Then there are no calls to this method 
so the method is removed. (and with this method the it's symtable with 
the type-definition. This is the part that I do not really understand)
The reference to the type is still in the WPO-table, so when it is 
written to file, the system collapses.

The attached patch fixes the problem, but I doubt that the fix is 
correct. (Especially when a class is created in multiple places. My 
patch will remove the classtype from the list with created classes, 
regardless the count.)

Besides that, I just discovered that the patch breaks cycling of the 
compiler. But it is wrong anyway...

Can someone help me out?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 1838 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20191025/67c06b94/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug_test.tgz
Type: application/x-compressed-tar
Size: 469 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20191025/67c06b94/attachment-0003.bin>

More information about the fpc-devel mailing list