浏览代码

Fixed some range check problems

J. Gareth "Curious Kit" Moreton 4 年之前
父节点
当前提交
42eb06f5c6
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      compiler/x86/aoptx86.pas

+ 4 - 0
compiler/x86/aoptx86.pas

@@ -4312,12 +4312,14 @@ unit aoptx86;
                 if ActiveReg=taicpu(hp1).oper[0]^.ref^.index then
                   inc(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.val*max(taicpu(hp1).oper[0]^.ref^.scalefactor,1));
 
+{$ifdef x86_64}
                 if (taicpu(hp1).oper[0]^.ref^.offset > $7FFFFFFF) or (taicpu(hp1).oper[0]^.ref^.offset < -2147483648) then
                   begin
                     { Overflow; abort }
                     taicpu(hp1).oper[0]^.ref^.offset := OldOffset;
                   end
                 else
+{$endif x86_64}
                   begin
                     DebugMsg(SPeepholeOptimization + 'AddLea2Lea done',p);
                     if not (cs_opt_level3 in current_settings.optimizerswitches) then
@@ -4937,12 +4939,14 @@ unit aoptx86;
                 if ActiveReg=taicpu(hp1).oper[0]^.ref^.index then
                   Dec(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.val*max(taicpu(hp1).oper[0]^.ref^.scalefactor,1));
 
+{$ifdef x86_64}
                 if (taicpu(hp1).oper[0]^.ref^.offset > $7FFFFFFF) or (taicpu(hp1).oper[0]^.ref^.offset < -2147483648) then
                   begin
                     { Overflow; abort }
                     taicpu(hp1).oper[0]^.ref^.offset := OldOffset;
                   end
                 else
+{$endif x86_64}
                   begin
                     DebugMsg(SPeepholeOptimization + 'SubLea2Lea done',p);