Browse Source

* better alignment checking

florian 20 years ago
parent
commit
e26ab8447c
1 changed files with 7 additions and 4 deletions
  1. 7 4
      compiler/ncgld.pas

+ 7 - 4
compiler/ncgld.pas

@@ -599,9 +599,9 @@ implementation
 {$warning HACK: unaligned test, maybe remove all unaligned locations (array of char) from the compiler}
 {$warning HACK: unaligned test, maybe remove all unaligned locations (array of char) from the compiler}
                         { Use unaligned copy when the offset is not aligned }
                         { Use unaligned copy when the offset is not aligned }
                         len:=left.resulttype.def.size;
                         len:=left.resulttype.def.size;
-                        if ((right.location.reference.offset mod sizeof(aint)<>0) or
-                            (left.location.reference.offset mod sizeof(aint)<>0)) and
-                           (len>=sizeof(aint)) then
+                        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
                           cg.g_concatcopy_unaligned(exprasmlist,right.location.reference,left.location.reference,len)
                           cg.g_concatcopy_unaligned(exprasmlist,right.location.reference,left.location.reference,len)
                         else
                         else
                           cg.g_concatcopy(exprasmlist,right.location.reference,left.location.reference,len);
                           cg.g_concatcopy(exprasmlist,right.location.reference,left.location.reference,len);
@@ -956,7 +956,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.137  2005-02-10 21:54:36  peter
+  Revision 1.138  2005-02-13 19:57:15  florian
+    * better alignment checking
+
+  Revision 1.137  2005/02/10 21:54:36  peter
     * data with inittables need to have a memory location assigned
     * data with inittables need to have a memory location assigned
       for incrref
       for incrref