Browse Source

* store character constants converted to shortstrings unaligned

git-svn-id: trunk@9106 -
florian 17 years ago
parent
commit
6ac5ed6a47
2 changed files with 12 additions and 2 deletions
  1. 10 0
      compiler/cgutils.pas
  2. 2 2
      compiler/ncgld.pas

+ 10 - 0
compiler/cgutils.pas

@@ -139,6 +139,9 @@ unit cgutils;
     { allocate room for parameters on the stack in the entry code? }
     function use_fixed_stack: boolean;
 
+    { returns r with the given alignment }
+    function setalignment(const r : treference;b : byte) : treference;
+
 implementation
 
 uses
@@ -179,6 +182,13 @@ uses
       end;
 
 
+    { returns r with the given alignment }
+    function setalignment(const r : treference;b : byte) : treference;
+      begin
+        result:=r;
+        result.alignment:=b;
+      end;
+
 {****************************************************************************
                                   TLocation
 ****************************************************************************}

+ 2 - 2
compiler/ncgld.pas

@@ -613,10 +613,10 @@ implementation
                   begin
                     if (target_info.endian = endian_little) then
                       cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_16,(tordconstnode(right).value.svalue shl 8) or 1,
-                          left.location.reference)
+                          setalignment(left.location.reference,1))
                     else
                       cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_16,tordconstnode(right).value.svalue or (1 shl 8),
-                          left.location.reference);
+                          setalignment(left.location.reference,1));
                   end
                 else
                   begin