浏览代码

* fix for #32576
+ test case

git-svn-id: trunk@38069 -

florian 7 年之前
父节点
当前提交
10ea652493
共有 3 个文件被更改,包括 40 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/x86/aoptx86.pas
  3. 37 0
      tests/webtbs/tw32576.pp

+ 1 - 0
.gitattributes

@@ -15945,6 +15945,7 @@ tests/webtbs/tw32510.pp svneol=native#text/plain
 tests/webtbs/tw3252.pp svneol=native#text/plain
 tests/webtbs/tw3255.pp svneol=native#text/plain
 tests/webtbs/tw3257.pp svneol=native#text/plain
+tests/webtbs/tw32576.pp svneol=native#text/pascal
 tests/webtbs/tw3259.pp svneol=native#text/plain
 tests/webtbs/tw3261.pp svneol=native#text/plain
 tests/webtbs/tw3263.pp svneol=native#text/plain

+ 2 - 0
compiler/x86/aoptx86.pas

@@ -1117,6 +1117,8 @@ unit aoptx86;
           begin
             GetNextInstruction(p, hp1);
             DebugMsg('PeepHole Optimization Mov2Nop done',p);
+            { take care of the register (de)allocs following p }
+            UpdateUsedRegs(tai(p.next));
             asml.remove(p);
             p.free;
             p:=hp1;

+ 37 - 0
tests/webtbs/tw32576.pp

@@ -0,0 +1,37 @@
+{$mode objfpc}
+{$R+}
+{$H+}
+program xx;
+
+
+uses sysutils;
+
+
+function strlsIndexOf(str, searched: pansichar; l1, l2: longint): longint;
+begin
+  result:=-1; //function removed for minimal example
+end;
+
+
+function strindexof(const str, searched: string): longint; inline;
+begin
+  if str = '' then begin result := 0; exit; end;
+  result := strlsIndexOf(pchar(pointer(str)) , pchar(searched), length(str) , length(searched));
+  if result < 0 then begin result := 0; exit; end;
+  inc(result);
+end;
+
+
+function strBefore(const s, sep: string): string;
+var
+  i: Integer;
+begin
+  i := strIndexOf(s, sep); // line 26
+  if i = 0 then result := ''
+  else result := copy(s, 1, i-1);
+end;
+
+
+begin
+  strBefore('hallo', 'a');
+end.