<html><div id="eml-cke__body" title="">I run it no linux. Problem code part.<br />
<br />
type PLongData = ^TLongData;<br />
TLongData = array [0..100] of longint;<br />
<br />
function binarySearchLong ( sortedArray:PLongData; nLen, toFind:longint):longint;<br />
var low, high, mid, l, h, m : longint;<br />
begin<br />
{ Returns index of toFind in sortedArray, or -1 if not found}<br />
low := 0;<br />
high := nLen - 1;<br />
<br />
l := sortedArray^[low];<br />
h := sortedArray^[high];<br />
<br />
while ((l <= toFind) and (h >= toFind)) do<br />
begin<br />
mid := (low + high) shr 1; { var "low" in register r8d }<br />
m := sortedArray^[mid];<br />
<br />
if (m < toFind) then<br />
begin<br />
low := mid + 1;<br />
l := sortedArray^[low];<br />
<br />
{ asm code generated<br />
-- with trunk<br />
lea r8d, [r11d+1H] <br />
mov esi, r8d<br />
--end trunk<br />
-- with overhaul it never set r8d to new value, but should<br />
lea esi, [r11d+1H] <br />
-- end overhaul<br />
<br />
mov r10d, dword [rdi+rsi*4] <br />
jmp ?_00144 <br />
<br />
}<br />
end else<br />
if (m > toFind) then<br />
begin<br />
high := mid - 1;<br />
h := sortedArray^[high];<br />
end else<br />
begin<br />
binarySearchLong:=mid;<br />
exit;<br />
end;<br />
<br />
end;<br />
<br />
if (sortedArray^[low] = toFind) then<br />
begin<br />
binarySearchLong:=low;<br />
end else<br />
binarySearchLong := -1; { Not found}<br />
end;<br />
<br />
</div>
<div id="eml-cke__signature_top" title="Paraksts">
<div class="eml-cke__signature" id="eml-cke__signature_top-wrap" title=""> </div>
</div>
<div class="noTransl">----- Reply to message -----<br />
<b>Subject: </b>Re: [fpc-devel] x86_64 Optimizer Overhaul<br />
<b>Date: </b>2018. gada 2. decembris 23:32:36<br />
<b>From: </b> J. Gareth Moreton <a href="mailto:gareth@moreton-family.com"><gareth@moreton-family.com></a><br />
<b>To: </b> FPC developers' list <a href="mailto:fpc-devel@lists.freepascal.org"><fpc-devel@lists.freepascal.org></a></div>
<blockquote>Thanks for the feedback. Do you have a reproducible case, and does it fail on Linux or Windows? I'll have a look for the infinite loops in the meantime.
<div> </div>
<div>Gareth aka. Kit</div>
<blockquote>
<div> </div>
</blockquote>
</blockquote>
<div id="eml-cke__signature_bottom" title="Paraksts"> </div>
</html>