Selaa lähdekoodia

* make sure tai_align.calculatefillbuf no longer destroys the fillsize
field, because it can still be read afterwards

git-svn-id: trunk@8602 -

Jonas Maebe 18 vuotta sitten
vanhempi
commit
b4b715f213
1 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 7 3
      compiler/x86/aasmcpu.pas

+ 7 - 3
compiler/x86/aasmcpu.pas

@@ -472,19 +472,23 @@ implementation
       var
         bufptr : pchar;
         j : longint;
+        localsize: byte;
       begin
         inherited calculatefillbuf(buf);
         if not use_op then
          begin
            bufptr:=pchar(@buf);
-           while (fillsize>0) do
+           { fillsize may still be used afterwards, so don't modify }
+           { e.g. writebytes(hp.calculatefillbuf(buf)^,hp.fillsize) }
+           localsize:=fillsize;
+           while (localsize>0) do
             begin
               for j:=low(alignarray) to high(alignarray) do
-               if (fillsize>=length(alignarray[j])) then
+               if (localsize>=length(alignarray[j])) then
                 break;
               move(alignarray[j][1],bufptr^,length(alignarray[j]));
               inc(bufptr,length(alignarray[j]));
-              dec(fillsize,length(alignarray[j]));
+              dec(localsize,length(alignarray[j]));
             end;
          end;
         calculatefillbuf:=pchar(@buf);