From 37d5a6c354e6ec7feee32cf4e92903b5d9b92457 Mon Sep 17 00:00:00 2001 From: sergei Date: Fri, 4 Mar 2011 17:00:47 +0000 Subject: [PATCH] * 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 - --- compiler/cgobj.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/cgobj.pas b/compiler/cgobj.pas index ba8a63b0fc..f0d35ba37e 100644 --- a/compiler/cgobj.pas +++ b/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);