Browse Source

* fixed copying of unaligned value parameters

git-svn-id: trunk@3369 -
florian 19 years ago
parent
commit
13493a5355
3 changed files with 12 additions and 4 deletions
  1. 5 1
      compiler/arm/cgcpu.pas
  2. 2 2
      compiler/ncgld.pas
  3. 5 1
      compiler/ncgutil.pas

+ 5 - 1
compiler/arm/cgcpu.pas

@@ -1531,7 +1531,11 @@ unit cgcpu;
 
     procedure tcgarm.g_concatcopy(list : TAsmList;const source,dest : treference;len : aint);
       begin
-        g_concatcopy_internal(list,source,dest,len,true);
+        if (source.alignment in [1..3]) or
+          (dest.alignment in [1..3]) then
+          g_concatcopy_internal(list,source,dest,len,false)
+        else
+          g_concatcopy_internal(list,source,dest,len,true);
       end;
 
 

+ 2 - 2
compiler/ncgld.pas

@@ -596,8 +596,8 @@ implementation
                         { Use unaligned copy when the offset is not aligned }
                         len:=left.resulttype.def.size;
                         if (right.location.reference.offset mod sizeof(aint)<>0) or
-                            (left.location.reference.offset mod sizeof(aint)<>0) or
-                            (right.resulttype.def.alignment<sizeof(aint)) then
+                          (left.location.reference.offset mod sizeof(aint)<>0) or
+                          (right.resulttype.def.alignment<sizeof(aint)) then
                           cg.g_concatcopy_unaligned(current_asmdata.CurrAsmList,right.location.reference,left.location.reference,len)
                         else
                           cg.g_concatcopy(current_asmdata.CurrAsmList,right.location.reference,left.location.reference,len);

+ 5 - 1
compiler/ncgutil.pas

@@ -850,7 +850,11 @@ implementation
                   cg.g_copyshortstring(list,href,localcopyloc.reference,tstringdef(tparavarsym(p).vartype.def).len)
                 end
               else
-                cg.g_concatcopy(list,href,localcopyloc.reference,tparavarsym(p).vartype.def.size);
+                begin
+                  { pass proper alignment info }
+                  localcopyloc.reference.alignment:=tparavarsym(p).vartype.def.alignment;
+                  cg.g_concatcopy(list,href,localcopyloc.reference,tparavarsym(p).vartype.def.size);
+                end;
               { update localloc of varsym }
               tg.Ungetlocal(list,tparavarsym(p).localloc.reference);
               tparavarsym(p).localloc:=localcopyloc;