diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-20 15:51:39 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-20 15:51:39 +0100 |
commit | 0a3ec628c1db294a2135ea4fab8a71c121186cfb (patch) | |
tree | 095cf327349c4784eca330d90eb13c0e6dd27df0 /gcc/ada/sem_eval.adb | |
parent | a395b2e5cde3b2e62ede6a74b1e8be2d8c6aa792 (diff) | |
download | gcc-0a3ec628c1db294a2135ea4fab8a71c121186cfb.zip gcc-0a3ec628c1db294a2135ea4fab8a71c121186cfb.tar.gz gcc-0a3ec628c1db294a2135ea4fab8a71c121186cfb.tar.bz2 |
[multiple changes]
2017-01-20 Thomas Quinot <quinot@adacore.com>
* sem_warn.adb (Warn_On_Useless_Assignment): Adjust wording of warning
message.
2017-01-20 Nicolas Roche <roche@adacore.com>
* terminals.c: Ignore failures on setpgid and tcsetpgrp commands.
2017-01-20 Bob Duff <duff@adacore.com>
* sem_eval.adb (Compile_Time_Compare): Disable the expr+literal
(etc) optimizations when the type is modular.
2017-01-20 Yannick Moy <moy@adacore.com>
* sem_ch6.adb (Move_Pragmas): move some pragmas,
but copy the SPARK_Mode pragma instead of moving it.
(Build_Subprogram_Declaration): Ensure that the generated spec
and original body share the same SPARK_Pragma aspect/pragma.
* sem_util.adb, sem_util.ads (Copy_SPARK_Mode_Aspect): New
procedure to copy SPARK_Mode aspect.
2017-01-20 Bob Duff <duff@adacore.com>
* sem_ch3.adb (Analyze_Declarations): Disable Resolve_Aspects
even in ASIS mode.
* sem_ch13.adb (Resolve_Name): Enable setting the entity to
Empty even in ASIS mode.
From-SVN: r244720
Diffstat (limited to 'gcc/ada/sem_eval.adb')
-rw-r--r-- | gcc/ada/sem_eval.adb | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 936c1c3..b421926 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -1142,7 +1142,7 @@ package body Sem_Eval is return Unknown; end if; - -- We do not attempt comparisons for packed arrays arrays represented as + -- We do not attempt comparisons for packed arrays represented as -- modular types, where the semantics of comparison is quite different. if Is_Packed_Array_Impl_Type (Ltyp) @@ -1329,28 +1329,35 @@ package body Sem_Eval is -- J .. J + 1. This code can conclude LT with a difference of 1, -- even if the range of J is not known. - declare - Lnode : Node_Id; - Loffs : Uint; - Rnode : Node_Id; - Roffs : Uint; + -- This would be wrong for modular types (e.g. X < X + 1 is False if + -- X is the largest number). - begin - Compare_Decompose (L, Lnode, Loffs); - Compare_Decompose (R, Rnode, Roffs); + if not Is_Modular_Integer_Type (Ltyp) + and then not Is_Modular_Integer_Type (Rtyp) + then + declare + Lnode : Node_Id; + Loffs : Uint; + Rnode : Node_Id; + Roffs : Uint; - if Is_Same_Value (Lnode, Rnode) then - if Loffs = Roffs then - return EQ; - elsif Loffs < Roffs then - Diff.all := Roffs - Loffs; - return LT; - else - Diff.all := Loffs - Roffs; - return GT; + begin + Compare_Decompose (L, Lnode, Loffs); + Compare_Decompose (R, Rnode, Roffs); + + if Is_Same_Value (Lnode, Rnode) then + if Loffs = Roffs then + return EQ; + elsif Loffs < Roffs then + Diff.all := Roffs - Loffs; + return LT; + else + Diff.all := Loffs - Roffs; + return GT; + end if; end if; - end if; - end; + end; + end if; -- Next, try range analysis and see if operand ranges are disjoint |