public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mehdi.chinoune at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/98577] Wrong "count_rate" values with int32 and real32 if the "count" argument is int64.
Date: Thu, 07 Jan 2021 13:03:21 +0000	[thread overview]
Message-ID: <bug-98577-4-zEDul7nPQu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98577-4@http.gcc.gnu.org/bugzilla/>

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?!

  parent reply	other threads:[~2021-01-07 13:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07  4:12 [Bug fortran/98577] New: " mehdi.chinoune at hotmail dot com
2021-01-07 11:36 ` [Bug fortran/98577] " anlauf at gcc dot gnu.org
2021-01-07 13:03 ` mehdi.chinoune at hotmail dot com [this message]
2021-01-07 16:32 ` kargl at gcc dot gnu.org
2021-01-07 17:28 ` mehdi.chinoune at hotmail dot com
2021-01-07 18:01 ` sgk at troutmask dot apl.washington.edu
2021-01-07 18:49 ` mehdi.chinoune at hotmail dot com
2021-01-07 18:56 ` mehdi.chinoune at hotmail dot com
2021-01-07 20:27 ` sgk at troutmask dot apl.washington.edu
2021-01-07 20:37 ` kargl at gcc dot gnu.org
2021-01-08  6:18 ` mehdi.chinoune at hotmail dot com
2021-01-08  7:21 ` kargl at gcc dot gnu.org
2021-01-08  8:04 ` mehdi.chinoune at hotmail dot com
2021-01-08  8:27 ` mehdi.chinoune at hotmail dot com
2021-01-08 16:12 ` kargl at gcc dot gnu.org
2021-01-08 16:42 ` mehdi.chinoune at hotmail dot com
2021-01-08 16:59 ` kargl at gcc dot gnu.org
2021-01-08 18:43 ` mehdi.chinoune at hotmail dot com
2021-01-08 18:55 ` sgk at troutmask dot apl.washington.edu
2021-01-08 19:19 ` sgk at troutmask dot apl.washington.edu
2021-01-09  2:34 ` mehdi.chinoune at hotmail dot com
2021-01-09  3:43 ` kargl at gcc dot gnu.org
2021-01-09  9:00 ` tkoenig at gcc dot gnu.org
2023-05-14 16:01 ` mehdi.chinoune at hotmail dot com
2023-05-14 16:37 ` tkoenig at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98577-4-zEDul7nPQu@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).