===================================================================
@@ -387,8 +387,10 @@
procedure Activate_Overflow_Check (N : Node_Id) is
begin
- Set_Do_Overflow_Check (N, True);
- Possible_Local_Raise (N, Standard_Constraint_Error);
+ if not Nkind_In (N, N_Op_Rem, N_Op_Mod, N_Op_Plus) then
+ Set_Do_Overflow_Check (N, True);
+ Possible_Local_Raise (N, Standard_Constraint_Error);
+ end if;
end Activate_Overflow_Check;
--------------------------
===================================================================
@@ -93,6 +93,8 @@
-- Sets Do_Overflow_Check flag in node N, and handles possible local raise.
-- Always call this routine rather than calling Set_Do_Overflow_Check to
-- set an explicit value of True, to ensure handling the local raise case.
+ -- Note that this call has no effect for MOD, REM, and unary "+" for which
+ -- overflow is never possible in any case.
procedure Activate_Range_Check (N : Node_Id);
pragma Inline (Activate_Range_Check);
===================================================================
@@ -7910,7 +7910,6 @@
procedure Expand_N_Op_Mod (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
- DOC : constant Boolean := Do_Overflow_Check (N);
DDC : constant Boolean := Do_Division_Check (N);
Left : Node_Id;
@@ -7975,7 +7974,6 @@
Set_Entity (N, Standard_Entity (S_Op_Rem));
Set_Etype (N, Typ);
- Set_Do_Overflow_Check (N, DOC);
Set_Do_Division_Check (N, DDC);
Expand_N_Op_Rem (N);
Set_Analyzed (N);