diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/checks.adb | 25 |
2 files changed, 23 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index afee8f4..38db4d6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-07-17 Arnaud Charlet <charlet@adacore.com> + + * checks.adb (Apply_Division_Check): Add provision for floating-point + checks. + 2018-07-17 Ed Schonberg <schonberg@adacore.com> * exp_aggr.adb (Component_OK_For_Backend): If an array component of the diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 8e061eb..0af436f 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -1888,13 +1888,24 @@ package body Checks is Set_Do_Division_Check (N, False); if (not ROK) or else (Rlo <= 0 and then 0 <= Rhi) then - Insert_Action (N, - Make_Raise_Constraint_Error (Loc, - Condition => - Make_Op_Eq (Loc, - Left_Opnd => Duplicate_Subexpr_Move_Checks (Right), - Right_Opnd => Make_Integer_Literal (Loc, 0)), - Reason => CE_Divide_By_Zero)); + if Is_Floating_Point_Type (Etype (N)) then + Insert_Action (N, + Make_Raise_Constraint_Error (Loc, + Condition => + Make_Op_Eq (Loc, + Left_Opnd => Duplicate_Subexpr_Move_Checks (Right), + Right_Opnd => Make_Real_Literal (Loc, Ureal_0)), + Reason => CE_Divide_By_Zero)); + + else + Insert_Action (N, + Make_Raise_Constraint_Error (Loc, + Condition => + Make_Op_Eq (Loc, + Left_Opnd => Duplicate_Subexpr_Move_Checks (Right), + Right_Opnd => Make_Integer_Literal (Loc, 0)), + Reason => CE_Divide_By_Zero)); + end if; end if; end if; end if; |