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

            Bug ID: 98577
           Summary: Wrong "count_rate" values with int32 and real32 if the
                    "count" argument is int64.
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mehdi.chinoune at hotmail dot com
  Target Milestone: ---

program main
  use iso_fortran_env
  implicit none
  integer(int32) :: count_32, count_rate_i32
  integer(int64) :: count_64, count_rate_i64
  real(real32) :: count_rate_r32
  real(real64) :: count_rate_r64
  print*, "count(int_32):"
  call system_clock( count_32, count_rate_i32 )
  print*, "count_rate(int32) = ", count_rate_i32
  call system_clock( count_32, count_rate_i64 )
  print*, "count_rate(int64) = ", count_rate_i64
  call system_clock( count_32, count_rate_r32 )
  print*, "count_rate(real32) = ", count_rate_r32
  call system_clock( count_32, count_rate_r64 )
  print*, "count_rate(real64) = ", count_rate_r64
  print*, "count(int_64):"
  call system_clock( count_64, count_rate_i32 )
  print*, "count_rate(int32) = ", count_rate_i32
  call system_clock( count_64, count_rate_i64 )
  print*, "count_rate(int64) = ", count_rate_i64
  call system_clock( count_64, count_rate_r32 )
  print*, "count_rate(real32) = ", count_rate_r32
  call system_clock( count_64, count_rate_r64 )
  print*, "count_rate(real64) = ", count_rate_r64
end program main

$ gfortran bug_gcc_tic.f90 -o test.x
count(int_32):                                                                 
                                                                               
     count_rate(int32) =         1000                                          
                                                                               
          count_rate(int64) =                  1000                            
                                                                               
               count_rate(real32) =    1000.00000                              
                                                                               
                    count_rate(real64) =    1000.0000000000000                 
                                                                               
                         count(int_64):                                        
                                                                               
                              count_rate(int32) =         1000                 
                                                                               
                                   count_rate(int64) =            1000000000   
                                                                               
                                        count_rate(real32) =    1000.00000     
                                                                               
                                             count_rate(real64) =   
1000000000.0000000

$ ifort bug_gcc_tic.f90 -o test.x
 count(int_32):                                                                
                                                                               
      count_rate(int32) =        10000                                         
                                                                               
           count_rate(int64) =                  10000                          
                                                                               
                count_rate(real32) =    10000.00                               
                                                                               
                     count_rate(real64) =    10000.0000000000                  
                                                                               
                          count(int_64):                                       
                                                                               
                               count_rate(int32) =      1000000                
                                                                               
                                    count_rate(int64) =                1000000 
                                                                               
                                         count_rate(real32) =    1000000.      
                                                                               
                                              count_rate(real64) =   
1000000.00000000

I am reporting this because I got wrong time intervals with
system_clock(int64,real32).

Reply via email to