+2019-07-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Type_Conversion): Beef up comment.
+ (Fixup_Universal_Fixed_Operation): Set the base type instead of
+ the type of the enclosing type conversion on the operation.
+
2019-07-22 Ed Schonberg <schonberg@adacore.com>
* exp_ch4.adb (Expand_N_In): Do not suggest the use of attribute
-- Check: are these rules stated in sinfo??? if so, why restate here???
-- The only remaining step is to generate a range check if we still have
- -- a type conversion at this stage and Do_Range_Check is set.
+ -- a type conversion at this stage and Do_Range_Check is set. Note that
+ -- we need to deal with at most 8 out of the 9 possible cases of numeric
+ -- conversions here, because the float-to-integer case is entirely dealt
+ -- with by Apply_Float_Conversion_Check.
if Nkind (N) = N_Type_Conversion
and then Do_Range_Check (Expression (N))
if Nkind (Parent (Conv)) = N_Attribute_Reference
and then Attribute_Name (Parent (Conv)) = Name_Round
then
- Set_Etype (N, Etype (Parent (Conv)));
+ Set_Etype (N, Base_Type (Etype (Parent (Conv))));
Set_Rounded_Result (N);
-- Normal case where type comes from conversion above us
else
- Set_Etype (N, Etype (Conv));
+ Set_Etype (N, Base_Type (Etype (Conv)));
end if;
end Fixup_Universal_Fixed_Operation;
+2019-07-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/fixedpnt6.adb: New testcase.
+
2019-07-22 Ed Schonberg <schonberg@adacore.com>
* gnat.dg/warn26.adb: New testcase.
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-O0" }
+
+procedure Fixedpnt6 is
+
+ type T is delta 0.125 range -2.0 .. 1.875;
+
+ function Mult (A, B : T) return T is
+ begin
+ return T (A * B);
+ end;
+
+ R : T;
+
+begin
+ R := Mult (T'Last, T'Last);
+ raise Program_Error;
+exception
+ when Constraint_Error =>
+ null;
+end;