This is the mail archive of the gcc-bugs@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]

[Bug fortran/34533] DTIME returns total process time and not since last invocation



------- Comment #2 from dominiq at lps dot ens dot fr  2007-12-20 15:57 -------
> Description:
> Subsequent invocations of DTIME return values accumulated since the previous
> invocation.
>
> Return value:
> Elapsed time in seconds since the start of program execution. 

This at best ambiguous and, with my nonnative English, I read it as
contradictory: how can the "return value" be different from the "return
values".  If it means, that the returned value for result in the subroutine
version is different from the one for the function, it is clearly user hostile
and IMO it does not make sense if these intrinsics are here for compatibility
with g77. With g77 the following code

        program test_dtime
            integer*8 i, j
            real tarray(2)
            real :: result
            result = dtime(tarray)
            print *, 'dtime= ', result
            print *, tarray(1), tarray(2)
            result = etime(tarray)
            print *, 'etime= ', result
            print *, tarray(1), tarray(2)
            do i=1,100000000    ! Just a delay
                j = i * i - i
            end do
            result = dtime(tarray)
            print *, 'dtime= ', result
            print *, tarray(1), tarray(2)
            result = dtime(tarray)
            print *, 'dtime= ', result
            print *, tarray(1), tarray(2)
            result = etime(tarray)
            print *, 'etime= ', result
            print *, tarray(1), tarray(2)
        end program test_dtime

gives

 dtime=   0.00142799993
  0.000438999996  0.000988999964
 etime=   0.00156200002
  0.000487999991  0.00107400003
 dtime=   1.02332103
  1.02199399  0.00132699998
 dtime=   4.59344592E-05
  2.19345093E-05  2.39999499E-05
 etime=   1.024827
  1.02246404  0.00236300007
1.022u 0.002s 0:01.02 100.0%    0+0k 0+0io 0pf+0w

where the third dtime returns the time difference from the previous call, while
gfortran gives

 dtime=   2.19899998E-03
  6.25999994E-04  1.57299999E-03
 etime=   2.37999996E-03
  7.40999996E-04  1.63900002E-03
 dtime=   0.92270601    
  0.92067999      2.02600006E-03
 dtime=   0.92281002    
  0.92073703      2.07299995E-03
 etime=   0.92285997    
  0.92076099      2.09899992E-03
0.920u 0.002s 0:00.92 100.0%    0+0k 0+0io 0pf+0w

In my opinion all the intrinsics introduced for compatibility with g77 should
behave as they do with g77 (and properly documented) or be removed (Note that I
found the problem while looking at PR30388 for which the gfortran timings were
inconsistent). 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34533


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