Browse Source

Fixed some range check problems

J. Gareth "Curious Kit" Moreton 3 years ago
parent
commit
42eb06f5c6
1 changed files with 4 additions and 0 deletions
  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);