From 84be45f55d92a379c237d76f7b2db9e55e0603d7 Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Thu, 24 Nov 2022 17:01:37 +0000 Subject: [PATCH] Fix compilation failure of RTL with -Co option for x86_64-linux target --- compiler/nadd.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/nadd.pas b/compiler/nadd.pas index c9691ff3fc..d3ed2a5202 100644 --- a/compiler/nadd.pas +++ b/compiler/nadd.pas @@ -960,11 +960,13 @@ implementation { convert n - n mod const into n div const*const } if (nodetype=subn) and (right.nodetype=modn) and is_constintnode(tmoddivnode(right).right) and - (left.isequal(tmoddivnode(right).left)) and not(might_have_sideeffects(left)) then + (left.isequal(tmoddivnode(right).left)) and not(might_have_sideeffects(left)) and + not(cs_check_overflow in localswitches) then begin result:=caddnode.create_internal(muln,cmoddivnode.create(divn,left,tmoddivnode(right).right.getcopy),tmoddivnode(right).right); left:=nil; tmoddivnode(right).right:=nil; + result.localswitches:=localswitches; exit; end;