* 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.ntype:=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;
{$pop}
hstab.nvalue:=StabStrSec.Size;
MaybeSwapStab(hstab);
StabsSec.Data.seek(0);

View File

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

View File

@ -72,7 +72,7 @@ implementation
else r := m;
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]
else
findreg_by_intname:=0;