OS_Time is use mainly in the interface to the "C" part of the GNAT RTL.
Change it to a 64-bit signed type on all targets.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * adaint.h (OS_Time): typedef as long long.
        * osint.adb (Underlying_OS_Time): Declare as 64-bit signed type.
        * libgnat/s-os_lib.adb ("<"): Compare OS_Time as
        Long_Long_Integer.
        ("<="): Likewise.
        (">"): Likewise.
        (">="): Likewise.
        * libgnat/s-os_lib.ads (OS_Time): Declare as 64-bit signed type.
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -101,11 +101,7 @@ extern "C" {
 #endif
 
 /* Type corresponding to GNAT.OS_Lib.OS_Time */
-#if defined (_WIN64)
 typedef long long OS_Time;
-#else
-typedef long OS_Time;
-#endif
 
 #define __int64 long long
 GNAT_STRUCT_STAT;


diff --git a/gcc/ada/libgnat/s-os_lib.adb b/gcc/ada/libgnat/s-os_lib.adb
--- a/gcc/ada/libgnat/s-os_lib.adb
+++ b/gcc/ada/libgnat/s-os_lib.adb
@@ -139,7 +139,7 @@ package body System.OS_Lib is
 
    function "<"  (X, Y : OS_Time) return Boolean is
    begin
-      return Long_Integer (X) < Long_Integer (Y);
+      return Long_Long_Integer (X) < Long_Long_Integer (Y);
    end "<";
 
    ----------
@@ -148,7 +148,7 @@ package body System.OS_Lib is
 
    function "<="  (X, Y : OS_Time) return Boolean is
    begin
-      return Long_Integer (X) <= Long_Integer (Y);
+      return Long_Long_Integer (X) <= Long_Long_Integer (Y);
    end "<=";
 
    ---------
@@ -157,7 +157,7 @@ package body System.OS_Lib is
 
    function ">"  (X, Y : OS_Time) return Boolean is
    begin
-      return Long_Integer (X) > Long_Integer (Y);
+      return Long_Long_Integer (X) > Long_Long_Integer (Y);
    end ">";
 
    ----------
@@ -166,7 +166,7 @@ package body System.OS_Lib is
 
    function ">="  (X, Y : OS_Time) return Boolean is
    begin
-      return Long_Integer (X) >= Long_Integer (Y);
+      return Long_Long_Integer (X) >= Long_Long_Integer (Y);
    end ">=";
 
    -----------------


diff --git a/gcc/ada/libgnat/s-os_lib.ads b/gcc/ada/libgnat/s-os_lib.ads
--- a/gcc/ada/libgnat/s-os_lib.ads
+++ b/gcc/ada/libgnat/s-os_lib.ads
@@ -1098,8 +1098,7 @@ private
    pragma Import (C, Current_Process_Id, "__gnat_current_process_id");
 
    type OS_Time is
-     range -(2 ** (Standard'Address_Size - Integer'(1))) ..
-           +(2 ** (Standard'Address_Size - Integer'(1)) - 1);
+     range -(2 ** 63) ..  +(2 ** 63 - 1);
    --  Type used for timestamps in the compiler. This type is used to hold
    --  time stamps, but may have a different representation than C's time_t.
    --  This type needs to match the declaration of OS_Time in adaint.h.


diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -2191,8 +2191,7 @@ package body Osint is
       GNAT_Time : Time_Stamp_Type;
 
       type Underlying_OS_Time is
-        range -(2 ** (Standard'Address_Size - Integer'(1))) ..
-              +(2 ** (Standard'Address_Size - Integer'(1)) - 1);
+        range -(2 ** 63) ..  +(2 ** 63 - 1);
       --  Underlying_OS_Time is a redeclaration of OS_Time to allow integer
       --  manipulation. Remove this in favor of To_Ada/To_C once newer
       --  GNAT releases are available with these functions.


Reply via email to