[fpc-devel] Might need some help with this one
J. Gareth Moreton
gareth at moreton-family.com
Thu Nov 26 16:34:30 CET 2020
So a couple of people have reported that -O2 sometimes produces bad code
under x86_64. So far it seems isolated to that CPU.
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!
Gareth aka. Kit
P.S. Also, there seems to be a strange, unrelated glitch. If I rename
the file to "break.pp" and change the program name to "break" (from
breakp), the compiled binary doesn't seem to write output (or it
immediately exits - can't tell yet). I'm not sure if this is because of
the program name being the same as an instruction or what.
This email has been checked for viruses by Avast antivirus software.
-------------- next part --------------
function Bar(const progress: single; divs: uint32): string;
BarSym: array[boolean] of char = ('.', '#');
for i := 0 to int32(divs) - 1 do
pChar(result)[i] := BarSym[(progress >= (0.75 + i) / divs) or (i = int32(divs) - 1) and (progress >= 1)];
s := Bar(0.7, 10) + ' 70%';
More information about the fpc-devel