From 8e7791ac232d88f298bd3a5ed3c6cd511c48ce5e Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Mon, 8 Nov 2021 22:55:38 +0000 Subject: [PATCH] Explicitly disable overflow for offset propagation optimization --- compiler/x86/aoptx86.pas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index 8b3ce300d2..55ae9ee3d1 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -4308,12 +4308,15 @@ unit aoptx86; ) then begin OldOffset := taicpu(hp1).oper[0]^.ref^.offset; - +{$push} +{$R-}{$Q-} + { Explicitly disable overflow checking for these offset calculation + as those do not matter for the final result } if ActiveReg=taicpu(hp1).oper[0]^.ref^.base then inc(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.val); 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)); - +{$pop} {$ifdef x86_64} if (taicpu(hp1).oper[0]^.ref^.offset > $7FFFFFFF) or (taicpu(hp1).oper[0]^.ref^.offset < -2147483648) then begin