Bug#740286: gnat-4.9: s-osinte-posix.adb is wrong about timespec.tv_nsec compared to gnat-4.8

2014-03-24 Thread Ludovic Brenta

The reasons for the upstream change are explained in the bug report I
referenced: http://gcc.gnu.org/PR54040, and discussed in detail in
the thread referenced there, viz.:

http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01504.html

Since the decision to use time_t instead of long has been discussed
and approved upstream, I think you should take your objections there,
i.e. by following up to that thread.

I will not change s-osinte-posix.adb without approval from upstream
but I will take your suggestion to change ada-kfreebsd.diff to use
s-osinte-posix.adb, introducing time_t in the private part of
s-osinte-kfreebsd-gnu.ads.

--
Ludovic Brenta.


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#740286: gnat-4.9: s-osinte-posix.adb is wrong about timespec.tv_nsec compared to gnat-4.8

2014-03-24 Thread Ludovic Brenta

The thread I referenced ends here:

http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02069.html

So it seems upstream is aware of the issue but has been unable to find
the time to fix it properly.  If you send a proper patch to them, I
think they'd be delighted.  Note that x32 seems *not* to adhere to
POSIX in this respect as it defines long to be 32-bit but uses a
64-bit value for timespec.tv_nsec.  You cannot change that but you can
try to support all architectures in a clean way as Arno suggested.

--
Ludovic Brenta.


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#740286: gnat-4.9: s-osinte-posix.adb is wrong about timespec.tv_nsec compared to gnat-4.8

2014-03-23 Thread Ludovic Brenta
Ludovic Brenta writes:
 Svante Signell svante.sign...@gmail.com writes:
 Ping, adding this bug report to debian-ada too. Who is Ada upstream?

 Patience.  I'm waiting for Matthias to upload a newer gcc-4.9-source
 containing the fix for your bug #740153, then I will upload a gnat-4.9
 incorporating this and your patch.

Now that the newer gcc-4.9 has been uploaded, I am reviewing this issue
and I discovered that the change you complain about was in fact made
upstream (that was not clear to me from your bug report):

commit e3a1f6b50495473f677f413d8740808a3fde5a9a
Author: hjl hjl@138bc75d-0d04-0410-961f-82ee72b054a4
Date:   Fri Nov 15 12:06:25 2013 +

Add and use System.Linux.time_t for time_t

PR ada/54040
* s-linux-x32.ads: New file.
* s-osprim-x32.adb: Likewise.
* s-linux.ads (time_t): New type.
* s-linux-alpha.ads (time_t):  Likewise.
* s-linux-hppa.ads (time_t):  Likewise.
* s-linux-mipsel.ads (time_t):  Likewise.
* s-linux-sparc.ads (time_t):  Likewise.
* s-osinte-linux.ads (time_t): Mark it private.  Replace long
with System.Linux.time_t.
(timespec): Replace long with time_t.
* s-osinte-posix.adb (To_Timespec): Likewise.
* s-taprop-linux.adb (timeval): Replace C.long with
System.OS_Interface.time_t.
* gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS): Replace
s-linux.ads with s-linux-x32.ads, s-osprim-posix.adb with
s-osprim-x32.adb for x32.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204840 
138bc75d-0d04-0410-961f-82ee72b054a4


I also see that s-osinte-gnu.ads, which is used solely by hurd-i386 and
added by the Debian patch ada-hurd.diff, has this to say about the
matter:

   type time_t is new long;

   type timespec is record
  tv_sec  : time_t;
  tv_nsec : long;
   end record;
   pragma Convention (C, timespec);

I propose to make time_t a subtype, rather than a derived type, of
long.  This should keep everyone happy.  Comments?

-- 
Ludovic Brenta.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#740286: gnat-4.9: s-osinte-posix.adb is wrong about timespec.tv_nsec compared to gnat-4.8

2014-03-23 Thread Svante Signell
On Sun, 2014-03-23 at 19:13 +0100, Ludovic Brenta wrote:
 Ludovic Brenta writes:
  Svante Signell svante.sign...@gmail.com writes:
  Ping, adding this bug report to debian-ada too. Who is Ada upstream?
 
  Patience.  I'm waiting for Matthias to upload a newer gcc-4.9-source
  containing the fix for your bug #740153, then I will upload a gnat-4.9
  incorporating this and your patch.
 
 Now that the newer gcc-4.9 has been uploaded, I am reviewing this issue
 and I discovered that the change you complain about was in fact made
 upstream (that was not clear to me from your bug report):
 
 commit e3a1f6b50495473f677f413d8740808a3fde5a9a
 Author: hjl hjl@138bc75d-0d04-0410-961f-82ee72b054a4
 Date:   Fri Nov 15 12:06:25 2013 +
 
 Add and use System.Linux.time_t for time_t
 
   PR ada/54040

   * s-osinte-linux.ads (time_t): Mark it private.  Replace long
   with System.Linux.time_t.
   (timespec): Replace long with time_t.
   * s-osinte-posix.adb (To_Timespec): Likewise.
   * s-taprop-linux.adb (timeval): Replace C.long with
   System.OS_Interface.time_t.

 I also see that s-osinte-gnu.ads, which is used solely by hurd-i386 and
 added by the Debian patch ada-hurd.diff, has this to say about the
 matter:
 
type time_t is new long;
 
type timespec is record
   tv_sec  : time_t;
   tv_nsec : long;
end record;
pragma Convention (C, timespec);
 
 I propose to make time_t a subtype, rather than a derived type, of
 long.  This should keep everyone happy.  Comments?

I don't see the reason for upstream to change tv_nsec to time_t at all
in s-osinte-posix.adb., see the POSIX spec and Linux/etc header files
referred to earlier! Independent on if it is a private or not.

s-osinte-linux-ads:
type time_t is private;

   type time_t is new System.Linux.time_t;

   type timespec is record
  tv_sec  : time_t;
  tv_nsec : time_t;
   end record;
   pragma Convention (C, timespec);

s-osinte-kfreebsd-gnu.ads:
type time_t is new long;

   type timespec is record
  tv_sec  : time_t;
  tv_nsec : time_t;
   end record;
   pragma Convention (C, timespec);

(same problems with kFreeBSD as for Hurd. Therefore s-osinte-posix.adb
was modified to s-osinte-kfreebsd-gnu.adb in ada-kfreebsd.diff (this
part of the patch is not necessary, it should be possible to use the
posix (.adb) version))


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#740286: gnat-4.9: s-osinte-posix.adb is wrong about timespec.tv_nsec compared to gnat-4.8

2014-03-17 Thread Svante Signell
Ping, adding this bug report to debian-ada too. Who is Ada upstream?

Thanks!

On Thu, 2014-02-27 at 22:09 +0100, Svante Signell wrote:
 Source: gnat-4.9
 Version: 4.9-20140218-2
 Severity: important
 Tags: patch experimental upstream
 User: debian-h...@lists.debian.org
 Usertags: hurd kfreebsd
 
 Hi,
 
 I'm not so sure there is a need to move from s-osinte-posix.adb to the
 patched version s-osinte-kfreebsd-gnu.adb for kfreebsd. I see the same
 build problem as before when building gnat-4.9 on GNU/Hurd. I think the
 change from gnat-4.8 to gnat-4.9 in s-osinte-posix.adb is wrong
 (edited):
 
 --- gnat-4.8/gnat-4.8-4.8.2-5/src/gcc/ada/s-osinte-posix.adb
 2011-08-01 17:05:02.0 +0200
 +++ gnat-4.9/gnat-4.9-4.9-20140218/src/gcc/ada/s-osinte-posix.adb
 2013-11-16 20:23:13.0 +0100
 
 return timespec'(tv_sec = S,
 -  tv_nsec = long (Long_Long_Integer (F * 10#1#E9)));
 +  tv_nsec = time_t (Long_Long_Integer (F * 10#1#E9)));
 end To_Timespec;
 
  end System.OS_Interface;
 
 According to Posix the tv_nsec should be long:
 http://pubs.opengroup.org/onlinepubs/009695299/basedefs/time.h.html
 
 The time.h header shall declare the structure timespec, which has at
 least the following members:
 
 time_t  tv_secSeconds. 
 longtv_nsec   Nanoseconds. 
 
 Linux/kFreeBSD/Hurd all defines struct timespec in time.h as follows:
 /* POSIX.1b structure for a time value.  This is like a `struct timeval'
 but
has nanoseconds instead of microseconds.  */
 struct timespec
   {
 __time_t tv_sec;/* Seconds.  */
 __syscall_slong_t tv_nsec;  /* Nanoseconds.  */
   };
 
 


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#740286: gnat-4.9: s-osinte-posix.adb is wrong about timespec.tv_nsec compared to gnat-4.8

2014-03-17 Thread Ludovic Brenta
Svante Signell svante.sign...@gmail.com writes:
 Ping, adding this bug report to debian-ada too. Who is Ada upstream?

Patience.  I'm waiting for Matthias to upload a newer gcc-4.9-source
containing the fix for your bug #740153, then I will upload a gnat-4.9
incorporating this and your patch.

In the mean time, Xavier, do you have any comments on this specific bug?
In particular, how do you think Svante's change might affect
GNU/kFreeBSD?

-- 
Ludovic Brenta.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#740286: gnat-4.9: s-osinte-posix.adb is wrong about timespec.tv_nsec compared to gnat-4.8

2014-02-27 Thread Svante Signell
Source: gnat-4.9
Version: 4.9-20140218-2
Severity: important
Tags: patch experimental upstream
User: debian-h...@lists.debian.org
Usertags: hurd kfreebsd

Hi,

I'm not so sure there is a need to move from s-osinte-posix.adb to the
patched version s-osinte-kfreebsd-gnu.adb for kfreebsd. I see the same
build problem as before when building gnat-4.9 on GNU/Hurd. I think the
change from gnat-4.8 to gnat-4.9 in s-osinte-posix.adb is wrong
(edited):

--- gnat-4.8/gnat-4.8-4.8.2-5/src/gcc/ada/s-osinte-posix.adb
2011-08-01 17:05:02.0 +0200
+++ gnat-4.9/gnat-4.9-4.9-20140218/src/gcc/ada/s-osinte-posix.adb
2013-11-16 20:23:13.0 +0100

return timespec'(tv_sec = S,
-  tv_nsec = long (Long_Long_Integer (F * 10#1#E9)));
+  tv_nsec = time_t (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;

 end System.OS_Interface;

According to Posix the tv_nsec should be long:
http://pubs.opengroup.org/onlinepubs/009695299/basedefs/time.h.html

The time.h header shall declare the structure timespec, which has at
least the following members:

time_t  tv_secSeconds. 
longtv_nsec   Nanoseconds. 

Linux/kFreeBSD/Hurd all defines struct timespec in time.h as follows:
/* POSIX.1b structure for a time value.  This is like a `struct timeval'
but
   has nanoseconds instead of microseconds.  */
struct timespec
  {
__time_t tv_sec;/* Seconds.  */
__syscall_slong_t tv_nsec;  /* Nanoseconds.  */
  };


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org