Răsfoiți Sursa

ARM: avoid some range check errors, while running a compiler compiled with -CR

git-svn-id: trunk@33257 -
Károly Balogh 9 ani în urmă
părinte
comite
e0c21b6f8b
3 a modificat fișierele cu 8 adăugiri și 8 ștergeri
  1. 6 6
      compiler/arm/aasmcpu.pas
  2. 1 1
      compiler/nutils.pas
  3. 1 1
      compiler/ogelf.pas

+ 6 - 6
compiler/arm/aasmcpu.pas

@@ -2779,15 +2779,15 @@ implementation
 
 
       function MakeRegList(reglist: tcpuregisterset): word;
       function MakeRegList(reglist: tcpuregisterset): word;
         var
         var
-          i, w: word;
+          i, w: integer;
         begin
         begin
           result:=0;
           result:=0;
-          w:=1;
+          w:=0;
           for i:=RS_R0 to RS_R15 do
           for i:=RS_R0 to RS_R15 do
             begin
             begin
               if i in reglist then
               if i in reglist then
-                result:=result or w;
-              w:=w shl 1
+                result:=result or (1 shl w);
+              inc(w);
             end;
             end;
         end;
         end;
 
 
@@ -2980,9 +2980,9 @@ implementation
                   bytes:=bytes or (((oper[0]^.ref^.offset-8) shr 2) and $ffffff);
                   bytes:=bytes or (((oper[0]^.ref^.offset-8) shr 2) and $ffffff);
 
 
                   if (opcode<>A_BL) or (condition<>C_None) then
                   if (opcode<>A_BL) or (condition<>C_None) then
-                    objdata.writereloc(bytes,4,currsym,RELOC_RELATIVE_24)
+                    objdata.writereloc(aint(bytes),4,currsym,RELOC_RELATIVE_24)
                   else
                   else
-                    objdata.writereloc(bytes,4,currsym,RELOC_RELATIVE_CALL);
+                    objdata.writereloc(aint(bytes),4,currsym,RELOC_RELATIVE_CALL);
 
 
                   exit;
                   exit;
                 end;
                 end;

+ 1 - 1
compiler/nutils.pas

@@ -814,7 +814,7 @@ implementation
               ordconstn:
               ordconstn:
                 begin
                 begin
 {$ifdef ARM}
 {$ifdef ARM}
-                  if not(is_shifter_const(tordconstnode(p).value.svalue,dummy)) then
+                  if not(is_shifter_const(aint(tordconstnode(p).value.svalue),dummy)) then
                     result:=2;
                     result:=2;
 {$endif ARM}
 {$endif ARM}
                   exit;
                   exit;

+ 1 - 1
compiler/ogelf.pas

@@ -864,7 +864,7 @@ implementation
                if (reltype in [RELOC_RELATIVE_24,RELOC_RELATIVE_CALL]) and
                if (reltype in [RELOC_RELATIVE_24,RELOC_RELATIVE_CALL]) and
                   (p.objsection=CurrObjSec) then
                   (p.objsection=CurrObjSec) then
                  begin
                  begin
-                   data:=(data and $ff000000) or (((((data and $ffffff) shl 2)+(symaddr-CurrObjSec.Size)) shr 2) and $FFFFFF); // TODO: Check overflow
+                   data:=aint((data and $ff000000) or (((((data and $ffffff) shl 2)+(symaddr-CurrObjSec.Size)) shr 2) and $FFFFFF)); // TODO: Check overflow
                  end
                  end
                else
                else
 {$endif ARM}
 {$endif ARM}