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

Chinoune <mehdi.chinoune at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #2 from Chinoune <mehdi.chinoune at hotmail dot com> ---
program main
  use iso_fortran_env
  implicit none
  !
  integer(int32) :: count_rate_i32
  integer(int64) :: t1, t2, t3, t4, t5, t6
  real(real32) :: count_rate_r32
  real(real64) :: count_rate_r64
  !
  integer(int32), parameter :: n = 2048
  real(real64), allocatable :: a(:,:), b(:,:), c(:,:)
  integer :: i, j, k
  !
  allocate( a(n,n), b(n,n), c(n,n) )
  call random_number( a )
  call random_number( b )
  !
  call system_clock( t1, count_rate_r32 )
  c = matmul( a, b )
  call system_clock( t2 )
  !
  call system_clock( t3, count_rate_i32 )
  b = matmul( c, a )
  call system_clock( t4 )
  !
  call system_clock( t5, count_rate_r64 )
  a = matmul( b, c )
  call system_clock( t6 )
  !
  print*, "count_rate_r32:", (t2-t1)/count_rate_r32
  print*, "count_rate_i32:", (t4-t3)/real(count_rate_i32,real64)
  print*, "count_rate_r64:", (t6-t5)/count_rate_r64
  !
end program main

$ gfortran-9 -O3 bug_gcc_98577_2.f90 -o test.x
$ ./test.x                                                                     
                                                 count_rate_r32:   478419744.  
                                                                               
                                                      count_rate_i32:  
479128968.57999998                                                             
                                                                  
count_rate_r64:  0.71684850000000000

$ gfortran-10 -O3 bug_gcc_98577_2.f90 -o test.x
$ ./test.x                                                                     
                                                 count_rate_r32:   568052096.  
                                                                               
                                                      count_rate_i32:  
568763156.84800005                                                             
                                                                  
count_rate_r64:  0.71658250000000001

Can you explain these results?!

Reply via email to