* fixed code which causes range check errors when compiled with -Cr

git-svn-id: trunk@23889 -
This commit is contained in:
florian 2013-03-17 14:24:50 +00:00
parent e1e11f81e3
commit 20a534e63f
3 changed files with 17 additions and 6 deletions

View File

@ -1315,7 +1315,10 @@ implementation
hstab.strpos:=1; hstab.strpos:=1;
hstab.ntype:=0; hstab.ntype:=0;
hstab.nother:=0; hstab.nother:=0;
{$push}{$R-}
{ for jwawindows.pas, this causes an range check error, it contains too much stab symbols }
hstab.ndesc:=(StabsSec.Size div sizeof(TObjStabEntry))-1; hstab.ndesc:=(StabsSec.Size div sizeof(TObjStabEntry))-1;
{$pop}
hstab.nvalue:=StabStrSec.Size; hstab.nvalue:=StabStrSec.Size;
MaybeSwapStab(hstab); MaybeSwapStab(hstab);
StabsSec.Data.seek(0); StabsSec.Data.seek(0);

View File

@ -2629,12 +2629,14 @@ In case not, the value returned can be arbitrary.
_CWSTRING : _CWSTRING :
begin begin
tokenwritesizeint(patternw^.len); tokenwritesizeint(patternw^.len);
if patternw^.len>0 then
recordtokenbuf.write(patternw^.data^,patternw^.len*sizeof(tcompilerwidechar)); recordtokenbuf.write(patternw^.data^,patternw^.len*sizeof(tcompilerwidechar));
end; end;
_CSTRING: _CSTRING:
begin begin
len:=length(cstringpattern); len:=length(cstringpattern);
tokenwritesizeint(len); tokenwritesizeint(len);
if len>0 then
recordtokenbuf.write(cstringpattern[1],len); recordtokenbuf.write(cstringpattern[1],len);
end; end;
_CCHAR, _CCHAR,
@ -2731,6 +2733,7 @@ In case not, the value returned can be arbitrary.
begin begin
wlen:=tokenreadsizeint; wlen:=tokenreadsizeint;
setlengthwidestring(patternw,wlen); setlengthwidestring(patternw,wlen);
if wlen>0 then
replaytokenbuf.read(patternw^.data^,patternw^.len*sizeof(tcompilerwidechar)); replaytokenbuf.read(patternw^.data^,patternw^.len*sizeof(tcompilerwidechar));
orgpattern:=''; orgpattern:='';
pattern:=''; pattern:='';
@ -2739,8 +2742,13 @@ In case not, the value returned can be arbitrary.
_CSTRING: _CSTRING:
begin begin
wlen:=tokenreadsizeint; wlen:=tokenreadsizeint;
if wlen>0 then
begin
setlength(cstringpattern,wlen); setlength(cstringpattern,wlen);
replaytokenbuf.read(cstringpattern[1],wlen); replaytokenbuf.read(cstringpattern[1],wlen);
end
else
cstringpattern:='';
orgpattern:=''; orgpattern:='';
pattern:=''; pattern:='';
end; end;

View File

@ -72,7 +72,7 @@ implementation
else r := m; else r := m;
end; end;
if int_regname_table[int_regname_index[r]]=s then if (r<=high(tregisterindex)) and (int_regname_table[int_regname_index[r]]=s) then
findreg_by_intname:=int_regname_index[r] findreg_by_intname:=int_regname_index[r]
else else
findreg_by_intname:=0; findreg_by_intname:=0;