* pass the correct size to a_load_cgparaloc_ref in gen_load_cgpara_loc to avoid to overwrite adjacent data

git-svn-id: trunk@36952 -
This commit is contained in:
florian 2017-08-20 15:22:01 +00:00
parent 43b017bde0
commit a53d6bd6bd

View File

@ -676,6 +676,7 @@ implementation
href : treference;
sizeleft : aint;
tempref : treference;
loadsize : tcgint;
{$ifdef mips}
//tmpreg : tregister;
{$endif mips}
@ -717,9 +718,18 @@ implementation
end
else
begin
cg.a_load_cgparaloc_ref(list,paraloc^,href,tcgsize2size[paraloc^.size],destloc.reference.alignment);
inc(href.offset,TCGSize2Size[paraloc^.size]);
dec(sizeleft,TCGSize2Size[paraloc^.size]);
{ the min(...) call ensures that we do not store more than place is left as
paraloc^.size could be bigger than destloc.size of a parameter occupies a full register
and as on big endian system the parameters might be left aligned, we have to work
with the full register size for paraloc^.size }
if tcgsize2size[destloc.size]<>0 then
loadsize:=min(min(tcgsize2size[paraloc^.size],tcgsize2size[destloc.size]),sizeleft)
else
loadsize:=min(tcgsize2size[paraloc^.size],sizeleft);
cg.a_load_cgparaloc_ref(list,paraloc^,href,loadsize,destloc.reference.alignment);
inc(href.offset,loadsize);
dec(sizeleft,loadsize);
end;
unget_para(paraloc^);
paraloc:=paraloc^.next;