This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [testsuite gfortran] partial fix for secnds*.f


Why is it so difficult to see the obvious?

The following patch seems to fix most of the failures except near midnight
and clock synchronization:

--- gcc-4.3-20070526/gcc/testsuite/gfortran.dg/secnds-1.f       Sat Apr 28 04:10:46 2007
+++ gcc-4.3-20070525/gcc/testsuite/gfortran.dg/secnds-1.f       Mon May 28 15:08:55 2007
@@ -11,13 +11,13 @@
       t1 = secnds (0.0)
       call date_and_time (dum1, dum2, dum3, values)
       t1a = secnds (0.0)
-      dat1 = 0.001*real (values(8)) + real (values(7)) +
-     &        60.0*real (values(6)) + 3600.0* real (values(5))
+      dat1 = 3600.0* real (values(5)) + 60.0*real (values(6)) +
+     &       real (values(7)) + 0.001*real (values(8))
       if (((dat1 - t1) < 0.) .or. ((dat1 - t1) > (t1a - t1))) call abort ()
       t2a = secnds (t1a)
       call date_and_time (dum1, dum2, dum3, values)
       t2 = secnds (t1)
-      dat2 = 0.001*real (values(8)) + real (values(7)) +
-     &        60.0*real (values(6)) + 3600.0* real (values(5))
+      dat2 = 3600.0* real (values(5)) + 60.0*real (values(6)) +
+     &       real (values(7)) + 0.001*real (values(8))
       if (((dat2 - dat1) < t2a) .or. ((dat2 - dat1) > t2)) call abort ()
       end
diff -r -u gcc-4.3-20070526/gcc/testsuite/gfortran.dg/secnds.f gcc-4.3-20070525/gcc/testsuite/gfortran.dg/secnds.f
--- gcc-4.3-20070526/gcc/testsuite/gfortran.dg/secnds.f Sat Apr 28 04:10:46 2007
+++ gcc-4.3-20070525/gcc/testsuite/gfortran.dg/secnds.f Mon May 28 15:07:34 2007
@@ -11,8 +11,8 @@
       t1 = secnds (0.0)
       call date_and_time (dum1, dum2, dum3, values)
       t1a = secnds (0.0)
-      dat1 = 0.001*real (values(8)) + real (values(7)) +
-     &        60.0*real (values(6)) + 3600.0* real (values(5))
+      dat1 = 3600.0* real (values(5)) + 60.0*real (values(6)) +
+     &       real (values(7)) + 0.001*real (values(8))
       if (((dat1 - t1) < 0.) .or. ((dat1 - t1) > (t1a - t1))) call abort ()
       do j=1,10000
         do i=1,10000
@@ -21,7 +21,7 @@
       t2a = secnds (t1a)
       call date_and_time (dum1, dum2, dum3, values)
       t2 = secnds (t1)
-      dat2 = 0.001*real (values(8)) + real (values(7)) +
-     &        60.0*real (values(6)) + 3600.0* real (values(5))
+      dat2 = 3600.0* real (values(5)) + 60.0*real (values(6)) +
+     &       real (values(7)) + 0.001*real (values(8))
       if (((dat2 - dat1) < t2a) .or. ((dat2 - dat1) > t2)) call abort ()
       end

The changes allow to compute dat1 and dat2 as in the libgfortran/intrinsics/date_and_time.c

I'll try to see if I can get a full patch to handle tests around midnight and clock
synchronization without adding any tolerance for the tests.

There is now PR32057 dealing with the failures of these tests.  I'd like to move
the discussion to it. Is there any objection? What level of cross-posting is
suitable?

Dominique


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]