https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98577

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WONTFIX                     |INVALID

--- Comment #16 from kargl at gcc dot gnu.org ---
(In reply to Chinoune from comment #15)
> Bug is a bug!

It's not a bug if the behavior is documented.

What does Intel do with this standard conforming program?

program foo

   use iso_fortran_env, only : int32, int64, real64

   implicit none

   integer(int32) rate4, t1, t2
   integer(int64) rate8, u1, u2
   !
   ! Both Intel and gfortran should give the same timings as
   ! COUNT and COUNT_RATE variables have the same kind type
   ! parameter.  This is documented by both gfortran and Intel.
   !
   print '(A)', 'Behavior documented to give valid timings with gfortran and
Intel'
   call system_clock(count_rate=rate4)
   print '(A,I0)', 'rate4 = ', rate4
   call system_clock(count_rate=rate8)
   print '(A,I0)', 'rate8 = ', rate8

   call system_clock(count=t1)
   call loop
   call system_clock(count=t2)
   print '(A,F0.3,A)', 'time = ', real(t2-t1,real64)/rate4, ' seconds
(int32/int32)'

   call system_clock(count=u1)
   call loop
   call system_clock(count=u2)
   print '(A,F0.3,A)', 'time = ', real(u2-u1,real64)/rate8, ' seconds
(int64/int64)'
   !
   ! gfortran gives an invalid time with the following, but gfortran
   ! also documents the behavior.  What does Intel do?
   !
   print *
   print '(A)', 'Behavior documented to give invalid timings with gfortran'
   call system_clock(count_rate=rate8)
   print '(A,I0)', 'rate8 = ', rate8
   call system_clock(count=t1)
   call loop
   call system_clock(count=t2)
   print '(A,F0.3,A)', 'time = ', real(t2-t1,real64)/rate8, ' seconds
(int32/int64)'

   call system_clock(count_rate=rate4)
   print '(A,I0)', 'rate4 = ', rate4
   call system_clock(count=u1)
   call loop
   call system_clock(count=u2)
   print '(A,F0.3,A)', 'time = ', real(u2-u1,real64)/rate4, ' seconds
(int64/int32)'

   contains

      subroutine loop
         implicit none
         real(real64) dx, x, y
         integer i
         integer, parameter :: n = 100000001
         dx = 1._real64 / (n - 1)
         do i = 1, n
            x = 1000 + (i - 1) * dx
            y = cos(x)
            x = sin(x)
            if (x * y > 2) stop 1
         end do
      end subroutine loop

end program foo

Reply via email to