[fpc-devel] Misterious error

Sergei Gorelkin sergei_gorelkin at mail.ru
Mon Jan 2 11:16:25 CET 2012


31.12.2011 23:17, José Mejuto пишет:

> SG>  Plain removal of this if..else breaks a couple of tests in
> SG>  the testsuite. But the information you
> SG>  provided gives some pointers to look at. At least, adding a
> SG>  check that constructor without
> SG>  pi_needs_implicit_finally flag doesn't have any implicit
> SG>  finalization code either will help
> SG>  detecting the actual place of trouble.
> SG>  I'll review it.
>
> I'll be very happy in test any change you may want to try before
> commit to SVN. This kind of problems seems to be very difficult to
> catch, so I'll try to not change my codebase while you investigate in
> order to be able to raise the error as needed.
>
> Another hint, my problem appears at close time and only if a debugger
> is present. If no debugger the operative system eats the error and
> nothing is reported.

The problem appears to be that the implicit finally block in constructors does not only finalize 
managed variables and temps, but also reposition the exit label so 'exit' statements do not jump 
over the AfterConstruction call. Removing this implicit finally block, as well as compiling with 
{$implicitexceptions off}, breaks the correct behavior.
For now, I reverted part of r19668 in r19948, so implicit finally blocks are not optimized, and 
added a test.
The solution to optimize the unnecessary finally blocks without breaking exit behavior is still to 
be found.

Regards,
Sergei



More information about the fpc-devel mailing list