[fpc-devel] Might need some help with this one

Yuriy Sydorov jura at cp-lab.com
Thu Nov 26 20:04:10 CET 2020


Hi,

On 26.11.2020 17:34, J. Gareth Moreton via fpc-devel wrote:
> Hi everyone,
> 
> So a couple of people have reported that -O2 sometimes produces bad code under x86_64.  So far it seems isolated to that 
> CPU.
> 
> https://bugs.freepascal.org/view.php?id=38129
> 
> After my own investigations with the attached code, the problem still occurs even if the peephole optimizer is disabled, 
> and the uninitialised register is being allocated within conditional code that is not always executed, rather than 
> before or after it.
> 
> Anyone with any tips on where to dig next (register allocator, node converter etc.) would be most appreciated!

First compile with the "-Ooregvar -alr -sr" switches. You will get the assembler output with imaginary registers and 
notes about register allocations and de-allocations. Inspect if all is correct at this stage. If not then the a code 
generator of some node is buggy.

Then compile with "-Ooregvar -alr". If the issue is present only at this stage, then the bug is in the register allocator.

Yuriy.


More information about the fpc-devel mailing list