This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: New sanity test for cpu_time() intrinsic function


Hi Brooks,

> The usage of r1 in the second IF statement seems misleading to me, since 
> it's already been established that r1 is equal to zero.
> 
> Also, it appears that this code will "succeed" without really testing 
> anything if r1 is greater than zero.  Is this actually the desired behavior?

You are right, I missed that one. Thanks for pointing it out. So r2 should be greater than r1, r1 
and r2 >= 0 in any case to mark the result as valid. I'll submit the testsuite patch if following 
revised test look ok. I've removed the loop, which as Tobias pointed it out, is not really useful.

program test_cpu_time
   real r1, r2
   call cpu_time(r1)
   if (r1 .lt. 0) call abort()  ! then according to f95 standard, mean processor
                                ! cannot return meaningful value.
   call cpu_time(r2)            ! The real test is that, the time r2 should be atleast
                                ! same as r1 but can not be smaller than r1.
   if (r2 .lt. 0) call abort()  ! r2 must be > 0
   if (r2 .lt. r1) call abort() ! and r2 >= r1
end program test_cpu_time


- Uttam


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