aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-08-04 09:54:00 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2014-08-04 09:54:00 +0200
commitf5655e4a9433c8a865b36eb098fb2315d7621855 (patch)
tree91119788af8e584b9632c7a81a99301a7bf9abab /gcc/ada/exp_ch4.adb
parent52627911786069aabae42e6393f536ae288adf6d (diff)
downloadgcc-f5655e4a9433c8a865b36eb098fb2315d7621855.zip
gcc-f5655e4a9433c8a865b36eb098fb2315d7621855.tar.gz
gcc-f5655e4a9433c8a865b36eb098fb2315d7621855.tar.bz2
[multiple changes]
2014-08-04 Ed Schonberg <schonberg@adacore.com> * exp_aggr.adb (Expand_Array_Aggregate): Do not attempt expansion if error already detected. We may reach this point in spite of previous errors when compiling with -gnatq, to force all possible errors (this is the usual ACATS mode). 2014-08-04 Gary Dismukes <dismukes@adacore.com> * checks.adb (Generate_Range_Check): For the case of converting a base type with a larger range to a smaller target subtype, only use unchecked conversions of bounds in the range check followed by conversion in the case where both types are discrete. In other cases, convert to the target base type and save in a temporary followed by the range check. (Convert_And_Check_Range): New procedure factoring code to save conversion to a temporary followed by a range check (called two places in Generate_Range_Check). * exp_ch4.adb (Expand_N_Type_Conversion): Relax previous check-in, to generate range checks for conversions between any floating-point types rather than limiting it to matching base types. From-SVN: r213532
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 0e6ea4f..7123389 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -10844,19 +10844,19 @@ package body Exp_Ch4 is
-- 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. For now we
- -- do this only for conversions of discrete types and for floating-point
- -- conversions where the base types of source and target are the same.
+ -- do this only for conversions of discrete types and for float-to-float
+ -- conversions.
if Nkind (N) = N_Type_Conversion then
- -- For now we only support floating-point cases where the base types
- -- of the target type and source expression are the same, so there's
- -- potentially only a range check. Conversions where the source and
- -- target have different base types are still TBD. ???
+ -- For now we only support floating-point cases where both source
+ -- and target are floating-point types. Conversions where the source
+ -- and target involve integer or fixed-point types are still TBD,
+ -- though not clear whether those can even happen at this point, due
+ -- to transformations above. ???
if Is_Floating_Point_Type (Etype (N))
- and then
- Base_Type (Etype (N)) = Base_Type (Etype (Expression (N)))
+ and then Is_Floating_Point_Type (Etype (Expression (N)))
then
if Do_Range_Check (Expression (N))
and then Is_Floating_Point_Type (Target_Type)
@@ -10865,6 +10865,8 @@ package body Exp_Ch4 is
(Expression (N), Target_Type, CE_Range_Check_Failed);
end if;
+ -- Discrete-to-discrete conversions
+
elsif Is_Discrete_Type (Etype (N)) then
declare
Expr : constant Node_Id := Expression (N);