fpc/tests/webtbs/tw40647.pp
J. Gareth "Curious Kit" Moreton 068b8f9e9d * New test for i40647
2024-02-18 15:31:20 +00:00

18 lines
340 B
ObjectPascal

{ %OPT=-O1 }
program tw40647;
var
k: longint = 2;
x: longint;
begin
{ Tests faulty LEA optimisations that manifest under -O1 since the node
tree doesn't simplify k + k in this instance }
x := k + k + 1;
if x <> 5 then
begin
WriteLn('FAIL: Expected 5 but got ', x);
Halt(1);
end;
WriteLn('ok');
end.