瀏覽代碼

* tcg.g_array_rtti_helper(): When converting 'high' to 'length', use an intermediate register to do the increment, so that the original value of 'high' parameter is preserved regardless of platform and optimization settings. Should fix regressions introduced by r17068.

git-svn-id: trunk@17071 -
sergei 15 年之前
父節點
當前提交
37d5a6c354
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      compiler/cgobj.pas

+ 4 - 3
compiler/cgobj.pas

@@ -3586,7 +3586,7 @@ implementation
       var
         cgpara1,cgpara2,cgpara3: TCGPara;
         href: TReference;
-        hreg: TRegister;
+        hreg, lenreg: TRegister;
       begin
         cgpara1.init;
         cgpara2.init;
@@ -3604,9 +3604,10 @@ implementation
             a_load_loc_reg(list,OS_INT,highloc,hreg);
           end;
         { increment, converts high(x) to length(x) }
-        a_op_const_reg(list,OP_ADD,OS_INT,1,hreg);
+        lenreg:=getintregister(list,OS_INT);
+        a_op_const_reg_reg(list,OP_ADD,OS_INT,1,hreg,lenreg);
 
-        a_load_reg_cgpara(list,OS_INT,hreg,cgpara3);
+        a_load_reg_cgpara(list,OS_INT,lenreg,cgpara3);
         a_loadaddr_ref_cgpara(list,href,cgpara2);
         a_loadaddr_ref_cgpara(list,ref,cgpara1);
         paramanager.freecgpara(list,cgpara1);