Explorar el Código

Allow negative offset in segment:offset declarations, if the resulting
address is valid (fixes webtbs/tw1622.pp on go32v2).

git-svn-id: trunk@14100 -

giulio2 hace 15 años
padre
commit
58eb923ff5
Se han modificado 1 ficheros con 7 adiciones y 3 borrados
  1. 7 3
      compiler/pdecvar.pas

+ 7 - 3
compiler/pdecvar.pas

@@ -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