diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-04-22 17:03:16 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2018-04-22 17:03:16 +0000 |
commit | e6044e02b0c04d2212568dad3033c8be3c60fa6c (patch) | |
tree | 62fae83b789730b4c4b731095153e48808bac9d8 /compiler/cgobj.pas | |
parent | e3e340b703faf25d21c2b19c891dfc1fa3681256 (diff) | |
download | fpc-e6044e02b0c04d2212568dad3033c8be3c60fa6c.tar.gz |
* keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
(e.g. in case of array indexing or record field accesses) (mantis #33628)
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@38814 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/cgobj.pas')
-rw-r--r-- | compiler/cgobj.pas | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/cgobj.pas b/compiler/cgobj.pas index 6b30cfb0a1..a40ceb1b19 100644 --- a/compiler/cgobj.pas +++ b/compiler/cgobj.pas @@ -965,7 +965,7 @@ implementation a_load_reg_reg(list,size,cgpara.location^.size,r,cgpara.location^.register); LOC_REFERENCE,LOC_CREFERENCE: begin - reference_reset_base(ref,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.alignment,[]); + reference_reset_base(ref,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.location^.reference.temppos,cgpara.alignment,[]); a_load_reg_ref(list,size,cgpara.location^.size,r,ref); end; LOC_MMREGISTER,LOC_CMMREGISTER: @@ -996,7 +996,7 @@ implementation a_load_const_reg(list,cgpara.location^.size,a,cgpara.location^.register); LOC_REFERENCE,LOC_CREFERENCE: begin - reference_reset_base(ref,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.alignment,[]); + reference_reset_base(ref,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.location^.reference.temppos,cgpara.alignment,[]); a_load_const_ref(list,cgpara.location^.size,a,ref); end else @@ -1125,7 +1125,7 @@ implementation begin if assigned(location^.next) then internalerror(2010052906); - reference_reset_base(ref,location^.reference.index,location^.reference.offset,newalignment(cgpara.alignment,cgpara.intsize-sizeleft),[]); + reference_reset_base(ref,location^.reference.index,location^.reference.offset,location^.reference.temppos,newalignment(cgpara.alignment,cgpara.intsize-sizeleft),[]); if (size <> OS_NO) and (tcgsize2size[size] <= sizeof(aint)) then a_load_ref_ref(list,size,location^.size,tmpref,ref) @@ -1341,7 +1341,7 @@ implementation a_loadfpu_reg_ref(list,paraloc.size,paraloc.size,paraloc.register,ref); LOC_REFERENCE : begin - reference_reset_base(href,paraloc.reference.index,paraloc.reference.offset,align,[]); + reference_reset_base(href,paraloc.reference.index,paraloc.reference.offset,paraloc.reference.temppos,align,[]); { use concatcopy, because it can also be a float which fails when load_ref_ref is used. Don't copy data when the references are equal } if not((href.base=ref.base) and (href.offset=ref.offset)) then @@ -1409,7 +1409,7 @@ implementation end; LOC_REFERENCE : begin - reference_reset_base(href,paraloc.reference.index,paraloc.reference.offset,align,[]); + reference_reset_base(href,paraloc.reference.index,paraloc.reference.offset,paraloc.reference.temppos,align,[]); case getregtype(reg) of R_ADDRESSREGISTER, R_INTREGISTER : @@ -1838,7 +1838,7 @@ implementation LOC_REFERENCE,LOC_CREFERENCE: begin cgpara.check_simple_location; - reference_reset_base(ref,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.alignment,[]); + reference_reset_base(ref,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.location^.reference.temppos,cgpara.alignment,[]); a_loadfpu_reg_ref(list,size,size,r,ref); end; LOC_REGISTER,LOC_CREGISTER: @@ -1879,7 +1879,7 @@ implementation LOC_REFERENCE,LOC_CREFERENCE: begin cgpara.check_simple_location; - reference_reset_base(href,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.alignment,[]); + reference_reset_base(href,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.location^.reference.temppos,cgpara.alignment,[]); { concatcopy should choose the best way to copy the data } g_concatcopy(list,ref,href,tcgsize2size[size]); end; @@ -2293,7 +2293,7 @@ implementation a_loadmm_reg_reg(list,size,cgpara.location^.size,reg,cgpara.location^.register,shuffle); LOC_REFERENCE,LOC_CREFERENCE: begin - reference_reset_base(href,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.alignment,[]); + reference_reset_base(href,cgpara.location^.reference.index,cgpara.location^.reference.offset,cgpara.location^.reference.temppos,cgpara.alignment,[]); a_loadmm_reg_ref(list,size,cgpara.location^.size,reg,href,shuffle); end; LOC_REGISTER,LOC_CREGISTER: @@ -2334,7 +2334,7 @@ implementation begin if not(cgpara.location^.next^.size in [OS_32,OS_S32]) then internalerror(2009112911); - reference_reset_base(href,cgpara.location^.next^.reference.index,cgpara.location^.next^.reference.offset,cgpara.alignment,[]); + reference_reset_base(href,cgpara.location^.next^.reference.index,cgpara.location^.next^.reference.offset,cgpara.location^.next^.reference.temppos,cgpara.alignment,[]); a_load_reg_ref(list,OS_32,cgpara.location^.next^.size,tmpreg,href); end; end @@ -2693,7 +2693,7 @@ implementation begin { offset in the wrapper needs to be adjusted for the stored return address } - reference_reset_base(href,reference.index,reference.offset+sizeof(pint),sizeof(pint),[]); + reference_reset_base(href,reference.index,reference.offset+sizeof(pint),reference.temppos,sizeof(pint),[]); a_op_const_ref(list,OP_SUB,size,ioffset,href); end else |