aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-reatim.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-05-12 17:00:49 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2015-05-12 17:00:49 +0200
commitc8d3b4ff3f469a3553c0e5d27b5d25dd03bf34e0 (patch)
treeaaa9b028bcb542cb164ac3d9379d1b02616ca275 /gcc/ada/a-reatim.adb
parent98b5dc6118b9298790e842075a86a9be832e79a4 (diff)
downloadgcc-c8d3b4ff3f469a3553c0e5d27b5d25dd03bf34e0.zip
gcc-c8d3b4ff3f469a3553c0e5d27b5d25dd03bf34e0.tar.gz
gcc-c8d3b4ff3f469a3553c0e5d27b5d25dd03bf34e0.tar.bz2
[multiple changes]
2015-05-12 Pierre-Marie de Rodat <derodat@adacore.com> * sem_ch10.adb (Sem_Ch10.Analyze_Proper_Body): Generate SCOs for subunit in generic units. 2015-05-12 Robert Dewar <dewar@adacore.com> * sem_elab.adb (Check_A_Call): Avoid checking internal call from Valid_Scalars 2015-05-12 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Process_Formals): An untagged incomplete type is legal in the profile of a null procedure. 2015-05-12 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Validate_Derived_Type_Instance): Handle properly the checks on a derived formal whose parent type is a previous formal that is not a derived type. 2015-05-12 Robert Dewar <dewar@adacore.com> * aspects.ads, aspects.adb: Add entries for aspect Volatile_Full_Access * einfo.adb (Has_Volatile_Full_Access): New flag. (Has_Volatile_Full_Access): New flag. * einfo.ads (Has_Volatile_Full_Access): New flag. * par-prag.adb: Add dummy entry for Volatile_Full_Access. * sem_prag.adb (Analyze_Pragma, case Volatile_Full_Access): Implement new pragma. * snames.ads-tmpl: Add entries for pragma Volatile_Full_Access. 2015-05-12 Robert Dewar <dewar@adacore.com> * targparm.ads: Minor reformatting. 2015-05-12 Robert Dewar <dewar@adacore.com> * a-reatim.adb (Time_Of): Properly detect overflow when TS = 0.0. * a-reatim.ads: Minor reformatting. From-SVN: r223074
Diffstat (limited to 'gcc/ada/a-reatim.adb')
-rw-r--r--gcc/ada/a-reatim.adb22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ada/a-reatim.adb b/gcc/ada/a-reatim.adb
index 52aa9f3..c313d50 100644
--- a/gcc/ada/a-reatim.adb
+++ b/gcc/ada/a-reatim.adb
@@ -228,6 +228,28 @@ package body Ada.Real_Time is
function Time_Of (SC : Seconds_Count; TS : Time_Span) return Time is
begin
+ -- Simple case first, TS = 0.0, we need to make sure SC is in range
+
+ if TS = 0.0 then
+ if SC >= Seconds_Count (Duration (Time_Span_First) + Duration'(0.5))
+ and then
+ SC <= Seconds_Count (Duration (Time_Span_Last) - Duration'(0.5))
+ then
+ -- Don't need any further checks after that manual check
+
+ declare
+ pragma Suppress (All_Checks);
+ begin
+ return Time (SC);
+ end;
+
+ -- Here we have a Seconds_Count value that is out of range
+
+ else
+ raise Constraint_Error;
+ end if;
+ end if;
+
-- We want to return Time (SC) + TS. To avoid spurious overflows in
-- the intermediate result Time (SC) we take advantage of the different
-- signs in SC and TS (when that is the case).