Jelajahi Sumber

* fixed a_param_ref for source sizes < 8 bytes

git-svn-id: trunk@10505 -
Jonas Maebe 17 tahun lalu
induk
melakukan
a6b9b3e00a
1 mengubah file dengan 19 tambahan dan 2 penghapusan
  1. 19 2
      compiler/x86_64/cgcpu.pas

+ 19 - 2
compiler/x86_64/cgcpu.pas

@@ -109,15 +109,32 @@ unit cgcpu;
         tmpref, ref: treference;
         location: pcgparalocation;
         sizeleft: aint;
+        sourcesize: tcgsize;
       begin
         location := paraloc.location;
         tmpref := r;
-        sizeleft := paraloc.intsize;
+        { make sure we handle passing a 32 bit value in memory to a }
+        { 64 bit register location etc. correctly                   }
+        if (size<>OS_NO) and
+           (tcgsize2size[size]<paraloc.intsize) then
+          begin
+            paraloc.check_simple_location;
+            if not(location^.loc in [LOC_REGISTER,LOC_CREGISTER]) then
+              internalerror(2008031801);
+            sizeleft:=tcgsize2size[size]
+          end
+        else
+          sizeleft:=paraloc.intsize;
         while assigned(location) do
           begin
             case location^.loc of
               LOC_REGISTER,LOC_CREGISTER:
-                a_load_ref_reg(list,location^.size,location^.size,tmpref,location^.register);
+                begin
+                  sourcesize:=int_cgsize(sizeleft);
+                  if (sourcesize=OS_NO) then
+                    sourcesize:=location^.size;
+                  a_load_ref_reg(list,sourcesize,location^.size,tmpref,location^.register);
+                end;
               LOC_REFERENCE:
                 begin
                   reference_reset_base(ref,location^.reference.index,location^.reference.offset);