[fpc-devel] Competing patches
J. Gareth Moreton
gareth at moreton-family.com
Sun Apr 21 03:48:15 CEST 2019
Recently I decided to take up issue #34772 because, of all things, I was
offered a bounty to fix it! I successfully fixed the bug, but another
developer, seeing that I had assigned the issue to mysef, posted their own
patch which is very different to what I did, but succeeds in what it was
advertised to do. The two patches can't really be applied together (at
least I think I can't), and I want to know what the policy is when it comes
to two different solutions on offer.
The developer, Sergei Gorelkin, gave me his patch to help save me some
work, but was fine as it was, so I was surprised he didn't upload it
earlier, given that this issue has been known since last December.
Granted, I had already fixed the bug but had not let uploaded it due to
double-checking things with the bounty and then because of the server
Not to blow my own trumpet, but I want to say my patch is slightly better
because it's clearer as to what the code is doing to mitigate the issue,
and in one particular case (an implicit finally block by itself), the
compiler produces slightly more efficient code with "Exit" - Sergei's patch
puts the jump destination before a "nop" instruction, while my code (and
the trunk) places it after said "nop".
Still, either way, the patch fixes the problem. I also wrote an
extensive test, "tw34772.pp" that checks all different kinds of procedures
with implicit finally blocks, safecall and explicit finally and except
blocks to see if everything is fixed, along with overridden GetMem and
FreeMem routines that track how many times they are called (increments for
each GetMem and similar calls, decrements for each FreeMem call, so a pass
is given if ReferenceCount = 0).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel