[fpc-devel] Going to properly investigate that 3.0.2 bug

J. Gareth Moreton gareth at moreton-family.com
Sat Jul 10 19:31:33 CEST 2021


That's got to be the worst kind of bug - I know it's been fixed but I 
can't remember what fix it was (assuming it was me who fixed it).  
Without a reproducible case I can't exactly identify the patch that 
fixes it, and yet I don't want to leave FPC 3.2.0 in a state where the 
optimizer is in an unreliable state.

Gareth aka. Kit

On 10/07/2021 13:53, Martin Frb via fpc-devel wrote:
> On 10/07/2021 06:40, J. Gareth Moreton via fpc-devel wrote:
>> Hi everyone,
>>
>> So I want to fix that optimisation bug in FPC 3.0.2 and 3.2.0 etc, 
>> but I need a little bit of help.  I know that Lazarus doesn't build 
>> properly with optimisations, but does anyone know of a smaller 
>> project that compiles incorrectly and causes an easy crash when run?  
>> If not, what do I need to do with Lazarus to make it crash?  With 
>> that, I can do a kind of manual binary search with revisions to find 
>> the point where it no longer crashes (since it was fixed for FPC 3.3.1).
>
> The one that I got is very hard to catch.
>
> It seem to me, that something is doing a write to random memory. So 
> any tiny change, and the bug disappears.
>
>
> This is the revision that for me reproduces it.
> https://github.com/User4martin/lazarus/tree/f-fpc-crash-fpdebug
>
> The testcase is
> components\lazdebuggers\lazdebuggerfp\test\LazDebFpTest.lpi
> build mode "64bit -O2"
>
> To run it you need to copy    fpclist.txt.sample   to  fpclist.txt
> edit it, and point it to your fpc (can be an older, can be trunk, does 
> not have to be the crashing version)
> you need only one fpc in it.
>
> You also need to create some folders
> logs/
> lib/
> testapps/lib/
>
> And it is Windows 64 bit only.
>
> Make sure it crashes  for you, before trying to hunt down what it is.
>
> -------------------------------------
>
> I tried to create a console test case => but then it does not crash.
>
> If you use OoNOPEEPHOLE  => no crash
>
> If you use "implicit exception off" => no crash
> see 
> https://github.com/User4martin/lazarus/tree/f-fpdebug-fpc-optimizer-bug
>
> I did trace it down to the specialization of some generic, that needed 
> to be done while "implicit exception off"
> But that is a lot of functions...
>
> -----
> All that said, I know there is no proof the bug is not in my code.
> It's just based on likelyhood.
>
> I valgrinded the crap out of it. Nothing.
> Well it is only windows, but if I accessed a dangling pointer, 
> valgrind would find it, even if it caused no harm on Linux.
> So the bug is apparently not in the compiled code on Linux.
>
> And that is basically all I have....
>
>
> --------------------------
> you can edit the project file and change
>
>   TestRunner.RunExecute(TestRunner);
>   //Application.Run;
>
> then the test runs automatically.
>
> Or even
>   TestRunner.Show;
> TestRunner.RunTest(TTest(TestRunner.TestTree.Items[0].Items[2].Data));
>
> To run just a small subset of tests (you might need to change that 
> depending on your fpclist.txt)
>
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>

-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the fpc-devel mailing list