[Bug libfortran/29099] New: secnds intrinsic gives wrong result
jvdelisle at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Sep 15 15:47:00 GMT 2006
With little or no delay between calls to secnds the wrong result is given:
secnds.f:
character*20 dum1, dum2, dum3
real t1, t2
real dat1, dat2
real dt
integer i, j, values(8)
dt = 40e-3
t1 = secnds (0.0)
call date_and_time (dum1, dum2, dum3, values)
dat1 = 0.001*real (values(8)) + real (values(7)) +
& 60.0*real (values(6)) + 3600.0* real (values(5))
if (int ((dat1 - t1 + dt * 0.5) / dt) .ne. 0) call abort ()
call date_and_time (dum1, dum2, dum3, values)
dat2 = 0.001*real (values(8)) + real (values(7)) +
& 60.0*real (values(6)) + 3600.0* real (values(5))
t2 = secnds (t1)
write (*,*) dat1
write (*,*) dat2
write (*,*) t1
write (*,*) t2
if (int ((dat1-dat2 + t2 + dt * 0.5) / dt) .ne. 0.0) call abort ()
end
$ ./a.out
31366.23
31366.23
31366.23
86400.00 <This should be 0.0
Aborted
Confirmed with check against g77 which yields the correct 0.0.
--
Summary: secnds intrinsic gives wrong result
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: jvdelisle at gcc dot gnu dot org
ReportedBy: jvdelisle at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29099
More information about the Gcc-bugs
mailing list