Commit ed170742 by Arnaud Charlet Committed by Pierre-Marie de Rodat

[Ada] Add provision for floating-point in Apply_Division_Check

2018-07-17  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* checks.adb (Apply_Division_Check): Add provision for floating-point
	checks.

From-SVN: r262801
parent f4c26077
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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment