summaryrefslogtreecommitdiff
path: root/gcc/ada/a-reatim.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-12 15:00:49 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-12 15:00:49 +0000
commita90c6b2024860cc31730b083fb97bf1ea91c9f71 (patch)
treeaaa9b028bcb542cb164ac3d9379d1b02616ca275 /gcc/ada/a-reatim.adb
parenta8a5046c0af561c4623625a0b6e25e49d6883116 (diff)
downloadgcc-a90c6b2024860cc31730b083fb97bf1ea91c9f71.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223074 138bc75d-0d04-0410-961f-82ee72b054a4
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 52aa9f3a372..c313d501427 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).