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!

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.
https://www.avast.com/antivirus
program breakp;

function Bar(const progress: single; divs: uint32): string;
const
    BarSym: array[boolean] of char = ('.', '#');
var
    i: int32;
begin
    SetLength(result, divs);
    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)];
end;

var
    s: string;

begin
    s := Bar(0.7, 10) + ' 70%';
    writeln(s);
    WriteLn('Odd');
end.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to