瀏覽代碼

* cmov ref,reg disabled because ref might be never nil

git-svn-id: trunk@1407 -
florian 20 年之前
父節點
當前提交
8b01dce70a
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      compiler/i386/popt386.pas

+ 8 - 3
compiler/i386/popt386.pas

@@ -1623,9 +1623,14 @@ procedure PeepHoleOptPass2(asml: taasmoutput; BlockStart, BlockEnd: tai);
        CanBeCMOV:=assigned(p) and (p.typ=ait_instruction) and
        CanBeCMOV:=assigned(p) and (p.typ=ait_instruction) and
          (taicpu(p).opcode=A_MOV) and
          (taicpu(p).opcode=A_MOV) and
          (taicpu(p).opsize in [S_L,S_W]) and
          (taicpu(p).opsize in [S_L,S_W]) and
-         ((taicpu(p).oper[0]^.typ = top_reg) or
-          ((taicpu(p).oper[0]^.typ = top_ref) and
-           (taicpu(p).oper[0]^.ref^.refaddr = addr_no))) and
+         ((taicpu(p).oper[0]^.typ = top_reg)
+         { we can't use cmov ref,reg because
+           ref could be nil and cmov still throws an exception
+           if ref=nil but the mov isn't done (FK)
+          or ((taicpu(p).oper[0]^.typ = top_ref) and
+           (taicpu(p).oper[0]^.ref^.refaddr = addr_no))
+         }
+         ) and
          (taicpu(p).oper[1]^.typ in [top_reg]);
          (taicpu(p).oper[1]^.typ in [top_reg]);
     end;
     end;
 {$endif  USECMOV}
 {$endif  USECMOV}