diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-04 10:07:57 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-04 10:07:57 +0200 |
commit | 98bf4cf4973d9b66774c85fe271073e7bc0ff916 (patch) | |
tree | a49b72b107d4323bbc67eda560d73754064ea1c9 /gcc/ada | |
parent | ce5ba43a4ea1fe705546313188ce51b783b4037c (diff) | |
download | gcc-98bf4cf4973d9b66774c85fe271073e7bc0ff916.zip gcc-98bf4cf4973d9b66774c85fe271073e7bc0ff916.tar.gz gcc-98bf4cf4973d9b66774c85fe271073e7bc0ff916.tar.bz2 |
[multiple changes]
2014-08-04 Ed Schonberg <schonberg@adacore.com>
* sem_util.adb (Is_Potentially_Unevaluated): If the original
node of a parent node in the tree is a short-circuit operation,
the node is potentially unevaluated.
2014-08-04 Robert Dewar <dewar@adacore.com>
* sem_res.adb (Resolve_Type_Conversion): Set Do_Range_Check on
conversion from a real type to an integer type.
From-SVN: r213538
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 21 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 11 |
3 files changed, 38 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 09575eb..b797f13 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2014-08-04 Ed Schonberg <schonberg@adacore.com> + + * sem_util.adb (Is_Potentially_Unevaluated): If the original + node of a parent node in the tree is a short-circuit operation, + the node is potentially unevaluated. + +2014-08-04 Robert Dewar <dewar@adacore.com> + + * sem_res.adb (Resolve_Type_Conversion): Set Do_Range_Check on + conversion from a real type to an integer type. + 2014-08-04 Yannick Moy <moy@adacore.com> * sem_aggr.adb, sem_ch3.adb, sem_ch5.adb, sem_ch7.adb, sem_ch9.adb, diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index b7fa5f5..87024ee 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -10322,11 +10322,11 @@ package body Sem_Res is -- odd subtype coming from the bounds). if (Is_Entity_Name (Orig_N) - and then - (Etype (Entity (Orig_N)) = Orig_T - or else - (Ekind (Entity (Orig_N)) = E_Loop_Parameter - and then Covers (Orig_T, Etype (Entity (Orig_N)))))) + and then + (Etype (Entity (Orig_N)) = Orig_T + or else + (Ekind (Entity (Orig_N)) = E_Loop_Parameter + and then Covers (Orig_T, Etype (Entity (Orig_N)))))) -- If not an entity, then type of expression must match @@ -10504,6 +10504,17 @@ package body Sem_Res is Apply_Predicate_Check (N, Target_Typ); end if; end if; + + -- If at this stage we have a real to integer conversion, make sure + -- that the Do_Range_Check flag is set, because such conversions in + -- general need a range check. + + if Nkind (N) = N_Type_Conversion + and then Is_Integer_Type (Target_Typ) + and then Is_Real_Type (Operand_Typ) + then + Set_Do_Range_Check (Operand); + end if; end Resolve_Type_Conversion; ---------------------- diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 4c8bddd..5c1a5a8 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -11146,6 +11146,17 @@ package body Sem_Util is begin Expr := N; Par := Parent (N); + + -- A postcondition whose expression is a short-circuit is broken down + -- into individual aspects for better exception reporting. The original + -- short-circuit expression is rewritten as the second operand, and an + -- occurrence of 'Old in that operand is potentially unevaluated. + -- See Sem_ch13.adb for details of this transformation. + + if Nkind (Original_Node (Par)) = N_And_Then then + return True; + end if; + while not Nkind_In (Par, N_If_Expression, N_Case_Expression, N_And_Then, |