Allow negative offset in segment:offset declarations, if the resulting

address is valid (fixes webtbs/tw1622.pp on go32v2).

git-svn-id: trunk@14100 -
This commit is contained in:
giulio2 2009-11-07 14:38:13 +00:00
parent 5bfbd8e15d
commit 58eb923ff5

View File

@ -993,6 +993,9 @@ implementation
abssym : tabsolutevarsym;
pt,hp : tnode;
st : tsymtable;
{$ifdef i386}
tmpaddr : int64;
{$endif}
begin
abssym:=nil;
{ only allowed for one var }
@ -1042,11 +1045,12 @@ implementation
pt:=expr;
if is_constintnode(pt) then
begin
if (Tordconstnode(pt).value<int64(low(abssym.addroffset))) or
(Tordconstnode(pt).value>int64(high(abssym.addroffset))) then
tmpaddr:=abssym.addroffset shl 4+tordconstnode(pt).value.svalue;
if (tmpaddr<int64(low(abssym.addroffset))) or
(tmpaddr>int64(high(abssym.addroffset))) then
message(parser_e_range_check_error)
else
abssym.addroffset:=abssym.addroffset shl 4+tordconstnode(pt).value.svalue;
abssym.addroffset:=tmpaddr;
abssym.absseg:=true;
end
else