<HTML>
That's interesting. Thanks for that. Time to get fixing.<br>
<br>
In the meantime I'm also fixing up the buggy optimisation that caused the original crash on Linux... nothing against the contributor, but it looks like some badly-copied code from the MovXX routine... it even still mentions "movsx" in the comments!<br>
<br>
Hopefully this effort on the overhaul won't all be for naught.<br>
<br>
Gareth aka. Kit<br>
<br>
<br>
<br>
<span style="font-weight: bold;">On Sun 02/12/18 23:21 , "Marģers ." margers.roked@inbox.lv sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT:0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"><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>
<span style="font-weight: bold;">Subject: </span>Re: [fpc-devel] x86_64 Optimizer Overhaul<br>
<span style="font-weight: bold;">Date: </span>2018. gada 2. decembris 23:32:36<br>
<span style="font-weight: bold;">From: </span> J. Gareth Moreton <a href="javascript:top.opencompose('gareth@moreton-family.com','','','')"><gareth@moreton-family.com></gareth@moreton-family.com></a><br>
<span style="font-weight: bold;">To: </span> FPC developers' list <a href="javascript:top.opencompose('fpc-devel@lists.freepascal.org','','','')"><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>
</blockquote></HTML>