diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-02 15:05:08 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-02 15:05:08 +0200 |
commit | b6b5cca81b846b91c3a4b35bcedd2294a6ee4dfd (patch) | |
tree | 77297aeeb5ef4433fd70088533b5e97a0664932a /gcc/ada/sem_eval.adb | |
parent | 6e6636ec8b5044a7ab2b464f6e7d7d71ade42356 (diff) | |
download | gcc-b6b5cca81b846b91c3a4b35bcedd2294a6ee4dfd.zip gcc-b6b5cca81b846b91c3a4b35bcedd2294a6ee4dfd.tar.gz gcc-b6b5cca81b846b91c3a4b35bcedd2294a6ee4dfd.tar.bz2 |
[multiple changes]
2012-10-02 Ben Brosgol <brosgol@adacore.com>
* gnat_rm.texi: Minor editing.
2012-10-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Analyze_Function_Return): Reject a return
expression whose type is a local access to subprogram type.
2012-10-02 Robert Dewar <dewar@adacore.com>
* sem_eval.adb: Minor improvement to Compile_Time_Compare.
2012-10-02 Robert Dewar <dewar@adacore.com>
* checks.adb (Apply_Arithmetic_Overflow_Minimized_Eliminated):
Fix base type problem that resulted in improper conversion.
(Minimize_Eliminate_Overflow_Checks): Properly handle top
level case to avoid unnecessary conversion to bignum or LLI.
(Minimize_Eliminate_Overflow_Checks): Implement uniform two phase
approach for arithmetic operators and for if/case expressions.
* checks.ads: Minor comment fix.
* exp_ch4.adb (Minimized_Eliminated_Overflow_Check): New function,
implements a uniform way of treating minimized/eliminated checks in
two phases.
(Expand_Compare_Minimize_Eliminate_Overflow): Fix cut and
paste error resulting in wrong results for less than in some
cases. (Expand_Membership_Minimize_Eliminate_Overflow):
Fix error caused by incorrect capture of operand types.
(Expand_Membership_Minimize_Eliminate_Overflow): Fix error in
handling of bignum case.
(Expand_N_Case_Expression): Implement
proper two phase handling (Expand_N_If_Expression): Implement
proper two phase handling (Expand_N_Op_Abs): Implement proper
two phase handling ditto for all other arithmetic operators
* sem_res.adb (Resolve_If_Expression): Avoid introducing
unneeded conversions.
From-SVN: r191980
Diffstat (limited to 'gcc/ada/sem_eval.adb')
-rw-r--r-- | gcc/ada/sem_eval.adb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 3d13e9c..116864a 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -949,21 +949,31 @@ package body Sem_Eval is LLo, LHi : Uint; RLo, RHi : Uint; + Single : Boolean; + -- True if each range is a single point + begin Determine_Range (L, LOK, LLo, LHi, Assume_Valid); Determine_Range (R, ROK, RLo, RHi, Assume_Valid); if LOK and ROK then + Single := (LLo = LHi) and then (RLo = RHi); + if LHi < RLo then + if Single and Assume_Valid then + Diff.all := RLo - LLo; + end if; + return LT; elsif RHi < LLo then + if Single and Assume_Valid then + Diff.all := LLo - RLo; + end if; + return GT; - elsif LLo = LHi - and then RLo = RHi - and then LLo = RLo - then + elsif Single and then LLo = RLo then -- If the range includes a single literal and we can assume -- validity then the result is known even if an operand is |