[fpc-pascal] _Release call location for unused function results
Marco van de Voort
marcov at stack.nl
Tue Jan 30 14:40:42 CET 2018
In our previous episode, Maciej Izak said:
> > The question is whether Delphi's behaviour is intentional.
> Sadly it is intentional (but undocumented), the facts:
> * Barry Kelly compiler guy post
> * Works with all known Delphi versions
> * I've checked this for NG compiler - also works like in classic Delphi
> (especially this point means that the "feature" is intentional )
Have you tested this with large methods? The trouble is we only get
reports/code from people for whom the hack succeeded, not from ones that
tried and failed.
I can remember from one of the bugreports or mail threads about very large
procedure bodies (where FPC hit virtual register numbers) that Delphi starts
to deallocate temps earlier depending on procedure size and maybe used
language constructs. (number of structured temps?) That was mostly strings,
but might also go for interfaces. I can also imagine that one would like
to disable this in case recursion is detected.
> Seems like the SCOPEDINTERFACEDESTROY mode-switch is necessary.
No, one could also simply fix the relevant code.
> question is: would we like to enabling this for all Delphi modes?
Everything that needs this is essentially feature abuse. I would not enable
it by default, but IF for some reason this needs to be added, when enabled
add a permanent note/warning that this is a workaround for broken code.
More information about the fpc-pascal