Browse Source

* Fixed compiler cycling with enabled range and overflow checking.

git-svn-id: trunk@11489 -
yury 17 years ago
parent
commit
4cabbe0e39

+ 1 - 1
compiler/arm/cgcpu.pas

@@ -376,7 +376,7 @@ unit cgcpu;
         l1 : longint;
         l1 : longint;
       begin
       begin
         ovloc.loc:=LOC_VOID;
         ovloc.loc:=LOC_VOID;
-        if is_shifter_const(-a,shift) then
+        if {$ifopt R+}(a<>-2147483648) and{$endif} is_shifter_const(-a,shift) then
           case op of
           case op of
             OP_ADD:
             OP_ADD:
               begin
               begin

+ 1 - 1
compiler/arm/narmmat.pas

@@ -68,7 +68,7 @@ implementation
           (nodetype=divn) and
           (nodetype=divn) and
           (ispowerof2(tordconstnode(right).value,power) or
           (ispowerof2(tordconstnode(right).value,power) or
            (tordconstnode(right).value=1) or
            (tordconstnode(right).value=1) or
-           (tordconstnode(right).value=-1)
+           (tordconstnode(right).value=int64(-1))
           ) and
           ) and
           not(is_64bitint(resultdef)) then
           not(is_64bitint(resultdef)) then
           result:=nil
           result:=nil

+ 1 - 1
compiler/cfileutl.pas

@@ -81,7 +81,7 @@ interface
       PCachedDirectoryEntry =  ^TCachedDirectoryEntry;
       PCachedDirectoryEntry =  ^TCachedDirectoryEntry;
       TCachedDirectoryEntry = record
       TCachedDirectoryEntry = record
         RealName: TCmdStr;
         RealName: TCmdStr;
-        Attr    : byte;
+        Attr    : longint;
       end;
       end;
 
 
       TDirectoryCache = class
       TDirectoryCache = class

+ 1 - 1
compiler/ogbase.pas

@@ -255,7 +255,7 @@ interface
        procedure alloc(len:aword);
        procedure alloc(len:aword);
        procedure allocalign(len:shortint);
        procedure allocalign(len:shortint);
        procedure writebytes(const Data;len:aword);
        procedure writebytes(const Data;len:aword);
-       procedure writeReloc(Data,len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);virtual;abstract;
+       procedure writeReloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);virtual;abstract;
        procedure beforealloc;virtual;
        procedure beforealloc;virtual;
        procedure beforewrite;virtual;
        procedure beforewrite;virtual;
        procedure afteralloc;virtual;
        procedure afteralloc;virtual;

+ 4 - 4
compiler/ogcoff.pas

@@ -133,7 +133,7 @@ interface
          destructor  destroy;override;
          destructor  destroy;override;
          procedure CreateDebugSections;override;
          procedure CreateDebugSections;override;
          function  sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
          function  sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
-         procedure writereloc(data,len:aword;p:TObjSymbol;reloctype:TObjRelocationType);override;
+         procedure writereloc(data:aint;len:aword;p:TObjSymbol;reloctype:TObjRelocationType);override;
          procedure afteralloc;override;
          procedure afteralloc;override;
        end;
        end;
 
 
@@ -774,7 +774,7 @@ const pemagic : array[0..3] of byte = (
         i,zero   : longint;
         i,zero   : longint;
         objreloc : TObjRelocation;
         objreloc : TObjRelocation;
         address,
         address,
-        relocval : aword;
+        relocval : aint;
         relocsec : TObjSection;
         relocsec : TObjSection;
       begin
       begin
         if (ObjRelocations.Count>0) and
         if (ObjRelocations.Count>0) and
@@ -840,7 +840,7 @@ const pemagic : array[0..3] of byte = (
 {$ifdef arm}
 {$ifdef arm}
               RELOC_RELATIVE_24:
               RELOC_RELATIVE_24:
                 begin
                 begin
-                  relocval:=longword(relocval - mempos - objreloc.dataoffset) shr 2 - 2;
+                  relocval:=longint(relocval - mempos - objreloc.dataoffset) shr 2 - 2;
                   address:=address or (relocval and $ffffff);
                   address:=address or (relocval and $ffffff);
                   relocval:=relocval shr 24;
                   relocval:=relocval shr 24;
                   if (relocval<>$3f) and (relocval<>0) then
                   if (relocval<>$3f) and (relocval<>0) then
@@ -980,7 +980,7 @@ const pemagic : array[0..3] of byte = (
       end;
       end;
 
 
 
 
-    procedure TCoffObjData.writereloc(data,len:aword;p:TObjSymbol;reloctype:TObjRelocationType);
+    procedure TCoffObjData.writereloc(data:aint;len:aword;p:TObjSymbol;reloctype:TObjRelocationType);
       var
       var
         curraddr,
         curraddr,
         symaddr : aword;
         symaddr : aword;

+ 2 - 2
compiler/ogelf.pas

@@ -57,7 +57,7 @@ interface
          destructor  destroy;override;
          destructor  destroy;override;
          function  sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
          function  sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
          procedure CreateDebugSections;override;
          procedure CreateDebugSections;override;
-         procedure writereloc(data,len:aword;p:TObjSymbol;reltype:TObjRelocationType);override;
+         procedure writereloc(data:aint;len:aword;p:TObjSymbol;reltype:TObjRelocationType);override;
        end;
        end;
 
 
        TElfObjectOutput = class(tObjOutput)
        TElfObjectOutput = class(tObjOutput)
@@ -646,7 +646,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TElfObjData.writereloc(data,len:aword;p:TObjSymbol;reltype:TObjRelocationType);
+    procedure TElfObjData.writereloc(data:aint;len:aword;p:TObjSymbol;reltype:TObjRelocationType);
       var
       var
         symaddr : longint;
         symaddr : longint;
       begin
       begin

+ 1 - 1
compiler/ptype.pas

@@ -834,7 +834,7 @@ implementation
                   first := false;
                   first := false;
                   storepos:=current_tokenpos;
                   storepos:=current_tokenpos;
                   current_tokenpos:=defpos;
                   current_tokenpos:=defpos;
-                  tstoredsymtable(aktenumdef.owner).insert(tenumsym.create(s,aktenumdef,l.svalue));
+                  tstoredsymtable(aktenumdef.owner).insert(tenumsym.create(s,aktenumdef,longint(l.svalue)));
                   current_tokenpos:=storepos;
                   current_tokenpos:=storepos;
                 until not try_to_consume(_COMMA);
                 until not try_to_consume(_COMMA);
                 def:=aktenumdef;
                 def:=aktenumdef;