Bug#740286: gnat-4.9: s-osinte-posix.adb is wrong about timespec.tv_nsec compared to gnat-4.8
Source: gnat-4.9
Version: 4.9-20140218-2
Severity: important
Tags: patch experimental upstream
User: debian-hurd@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.000000000 +0200
+++ gnat-4.9/gnat-4.9-4.9-20140218/src/gcc/ada/s-osinte-posix.adb
2013-11-16 20:23:13.000000000 +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_sec Seconds.
long tv_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. */
};
Reply to: