Avoid range errors or overflows on for AVR cpu, when computing address offsets

git-svn-id: trunk@40378 -
This commit is contained in:
pierre 2018-11-27 10:21:37 +00:00
parent 044fae62ea
commit b64e9700aa
2 changed files with 10 additions and 10 deletions

View File

@ -234,7 +234,7 @@ implementation
procedure tcginnode.pass_generate_code; procedure tcginnode.pass_generate_code;
var var
adjustment, adjustment,
setbase : aint; setbase : {$ifdef CPU8BITALU}smallint{$else}aint{$endif};
l, l2 : tasmlabel; l, l2 : tasmlabel;
hr, hr,
pleftreg : tregister; pleftreg : tregister;

View File

@ -361,7 +361,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
procedure tasmlisttypedconstbuilder.flush_packed_value(var bp: tbitpackedval); procedure tasmlisttypedconstbuilder.flush_packed_value(var bp: tbitpackedval);
var var
bitstowrite: longint; bitstowrite: longint;
writeval : AInt; writeval : {$ifdef CPU8BITALU}smallint{$else}aint{$endif};
begin begin
if (bp.curbitoffset < AIntBits) then if (bp.curbitoffset < AIntBits) then
begin begin
@ -403,7 +403,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
{ parses a packed array constant } { parses a packed array constant }
procedure tasmlisttypedconstbuilder.parse_packed_array_def(def: tarraydef); procedure tasmlisttypedconstbuilder.parse_packed_array_def(def: tarraydef);
var var
i : aint; i : {$ifdef CPU8BITALU}smallint{$else}aint{$endif};
bp : tbitpackedval; bp : tbitpackedval;
begin begin
if not(def.elementdef.typ in [orddef,enumdef]) then if not(def.elementdef.typ in [orddef,enumdef]) then
@ -455,7 +455,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
procedure tasmlisttypedconstbuilder.tc_emit_stringdef(def: tstringdef; var node: tnode); procedure tasmlisttypedconstbuilder.tc_emit_stringdef(def: tstringdef; var node: tnode);
var var
strlength : aint; strlength : {$ifdef CPU8BITALU}smallint{$else}aint{$endif};
strval : pchar; strval : pchar;
ll : tasmlabofs; ll : tasmlabofs;
ca : pchar; ca : pchar;
@ -1518,11 +1518,11 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
sorg,s : TIDString; sorg,s : TIDString;
tmpguid : tguid; tmpguid : tguid;
recoffset, recoffset,
fillbytes : aint; fillbytes : {$ifdef CPU8BITALU}smallint{$else}aint{$endif};
bp : tbitpackedval; bp : tbitpackedval;
error, error,
is_packed: boolean; is_packed: boolean;
startoffset: aword; startoffset: {$ifdef CPU8BITALU}word{$else}aword{$endif};
procedure handle_stringconstn; procedure handle_stringconstn;
begin begin
@ -1733,10 +1733,10 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
obj : tobjectdef; obj : tobjectdef;
srsym : tsym; srsym : tsym;
st : tsymtable; st : tsymtable;
objoffset : aint; objoffset : {$ifdef CPU8BITALU}smallint{$else}aint{$endif};
s,sorg : TIDString; s,sorg : TIDString;
vmtwritten : boolean; vmtwritten : boolean;
startoffset:aint; startoffset : {$ifdef CPU8BITALU}smallint{$else}aint{$endif};
begin begin
{ no support for packed object } { no support for packed object }
if is_packed_record_or_object(def) then if is_packed_record_or_object(def) then
@ -1926,7 +1926,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
recsym, recsym,
srsym : tsym; srsym : tsym;
sorg,s : TIDString; sorg,s : TIDString;
recoffset : aint; recoffset : {$ifdef CPU8BITALU}smallint{$else}aint{$endif};
error, error,
is_packed: boolean; is_packed: boolean;
@ -2095,7 +2095,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
obj : tobjectdef; obj : tobjectdef;
srsym : tsym; srsym : tsym;
st : tsymtable; st : tsymtable;
objoffset : aint; objoffset : {$ifdef CPU8BITALU}smallint{$else}aint{$endif};
s,sorg : TIDString; s,sorg : TIDString;
begin begin
{ no support for packed object } { no support for packed object }