public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64432] [5 Regression] SYSTEM_CLOCK(COUNT_RATE=rate) wrong result for integer(4)::rate
Date: Wed, 18 Feb 2015 20:04:00 -0000	[thread overview]
Message-ID: <bug-64432-4-XuX74yGXi0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64432-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #22 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Jerry DeLisle from comment #21)
> Created attachment 34798 [details]
> Full Patch
> 
> This patch attempts to do it all. I have not tested the mingw/cygwin side of
> it.
> 
> Any testing/comments welcome

Jerry,

I did some simple test and found the following:

Cases with a single argument present:

% cat gfcbug128f.f90
program gfcbug128e
  integer(1) :: count_rate_i1, count_max_i1, count_i1
  integer(2) :: count_rate_i2, count_max_i2, count_i2
  integer(4) :: count_rate_i4, count_max_i4, count_i4
  integer(8) :: count_rate_i8, count_max_i8, count_i8
  real(4)    :: count_rate_r4 = 0
  real(8)    :: count_rate_r8 = 0

  print *, "KIND=1:"
  call system_clock (count=count_i1)
  print *, "count     =",count_i1
  call system_clock (count_max=count_max_i1)
  print *, "count_max =", count_max_i1
  call system_clock (count_rate=count_rate_i1)
  print *, "count_rate=", count_rate_i1
  print *
  print *, "KIND=2:"
  call system_clock (count=count_i2)
  print *, "count     =",count_i2
  call system_clock (count_max=count_max_i2)
  print *, "count_max =", count_max_i2
  call system_clock (count_rate=count_rate_i2)
  print *, "count_rate=", count_rate_i2
  print *
  print *, "KIND=4:"
  call system_clock (count=count_i4)
  print *, "count     =",count_i4
  call system_clock (count_max=count_max_i4)
  print *, "count_max =", count_max_i4
  call system_clock (count_rate=count_rate_i4)
  print *, "count_rate=", count_rate_i4
  call system_clock (count_rate=count_rate_r4)
  print *, "count_rate_real=", count_rate_r4
  print *
  print *, "KIND=8:"
  call system_clock (count=count_i8)
  print *, "count     =",count_i8
  call system_clock (count_max=count_max_i8)
  print *, "count_max =", count_max_i8
  call system_clock (count_rate=count_rate_i8)
  print *, "count_rate=", count_rate_i8
  call system_clock (count_rate=count_rate_r8)
  print *, "count_rate_real=", count_rate_r8
end

Test output:
 KIND=1:
 count     =  116
 count_max =  127
 count_rate=    1

 KIND=2:
 count     =  27083
 count_max =  32767
 count_rate=   1000

 KIND=4:
 count     =   507374028
 count_max =  2147483647
 count_rate=        1000
 count_rate_real=   1000.00000    

 KIND=8:
 count     =     1424289032652253
 count_max =  9223372036854775807
 count_rate=              1000000
 count_rate_real=   1000000.0000000000     

Looks reasonable so far, assuming it behaves as (to be) documented.

Further tests with two arguments:

% cat gfcbug128g.f90
program gfcbug128g
  integer(1) :: count_rate_i1, count_max_i1, count_i1
  integer(2) :: count_rate_i2, count_max_i2, count_i2
  integer(4) :: count_rate_i4, count_max_i4, count_i4
  integer(8) :: count_rate_i8, count_max_i8, count_i8
  real(4)    :: count_rate_r4 = 0
  real(8)    :: count_rate_r8 = 0

  call system_clock (count=count_i1,count_max=count_max_i2)
  print *, "count(1),count_max(2) =",count_i1, count_max_i2
  call system_clock (count=count_i2,count_max=count_max_i1)
  print *, "count(2),count_max(1) =",count_i2, count_max_i1
  call system_clock (count=count_i4,count_max=count_max_i2)
  print *, "count(4),count_max(2) =",count_i4, count_max_i2
  call system_clock (count=count_i2,count_max=count_max_i4)
  print *, "count(2),count_max(4) =",count_i2, count_max_i4
  call system_clock (count=count_i4,count_max=count_max_i8)
  print *, "count(4),count_max(8) =",count_i4, count_max_i8
  call system_clock (count=count_i8,count_max=count_max_i4)
  print *, "count(8),count_max(4) =",count_i8, count_max_i4
  call system_clock (count=count_i1,count_max=count_max_i8)
  print *, "count(1),count_max(8) =",count_i1, count_max_i8
  call system_clock (count=count_i8,count_max=count_max_i1)
  print *, "count(8),count_max(1) =",count_i8, count_max_i1

  call system_clock (count_rate=count_rate_i1,count_max=count_max_i2)
  print *, "count_rate(1),count_max(2) =",count_rate_i1, count_max_i2
  call system_clock (count_rate=count_rate_i2,count_max=count_max_i1)
  print *, "count_rate(2),count_max(1) =",count_rate_i2, count_max_i1
  call system_clock (count_rate=count_rate_i4,count_max=count_max_i2)
  print *, "count_rate(4),count_max(2) =",count_rate_i4, count_max_i2
  call system_clock (count_rate=count_rate_i2,count_max=count_max_i4)
  print *, "count_rate(2),count_max(4) =",count_rate_i2, count_max_i4
  call system_clock (count_rate=count_rate_i4,count_max=count_max_i8)
  print *, "count_rate(4),count_max(8) =",count_rate_i4, count_max_i8
  call system_clock (count_rate=count_rate_i8,count_max=count_max_i4)
  print *, "count_rate(8),count_max(4) =",count_rate_i8, count_max_i4
  call system_clock (count_rate=count_rate_i1,count_max=count_max_i8)
  print *, "count_rate(1),count_max(8) =",count_rate_i1, count_max_i8
  call system_clock (count_rate=count_rate_i8,count_max=count_max_i1)
  print *, "count_rate(8),count_max(1) =",count_rate_i8, count_max_i1
end

Test output:

 count(1),count_max(2) =   11    127
 count(2),count_max(1) =     11  127
 count(4),count_max(2) =        5991  32767
 count(2),count_max(4) =   5991       32767
 count(4),count_max(8) =   507909991           2147483647
 count(8),count_max(4) =            507909991  2147483647
 count(1),count_max(8) =   11                  127
 count(8),count_max(1) =                   11  127
 count_rate(1),count_max(2) =    1    127
 count_rate(2),count_max(1) =      1  127
 count_rate(4),count_max(2) =        1000  32767
 count_rate(2),count_max(4) =   1000       32767
 count_rate(4),count_max(8) =        1000           2147483647
 count_rate(8),count_max(4) =                 1000  2147483647
 count_rate(1),count_max(8) =    1                  127
 count_rate(8),count_max(1) =                    0  127

OK, but the last line looks strange: lacking documentation,
I'd expect the rate to be 1, not 0.  (Not that I'd use that
in real code...).

Cheers,
Harald


  parent reply	other threads:[~2015-02-18 20:04 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29 10:44 [Bug fortran/64432] New: " anlauf at gmx dot de
2014-12-29 11:14 ` [Bug fortran/64432] " anlauf at gmx dot de
2014-12-29 11:18 ` anlauf at gmx dot de
2014-12-29 11:20 ` janus at gcc dot gnu.org
2014-12-29 11:21 ` janus at gcc dot gnu.org
2014-12-29 14:13 ` fxcoudert at gcc dot gnu.org
2014-12-29 15:04 ` anlauf at gmx dot de
2014-12-29 15:23 ` anlauf at gmx dot de
2014-12-30  9:48 ` Joost.VandeVondele at mat dot ethz.ch
2014-12-30 10:05 ` Joost.VandeVondele at mat dot ethz.ch
2015-01-04 21:47 ` anlauf at gmx dot de
2015-01-04 21:56 ` anlauf at gmx dot de
2015-01-04 22:04 ` fxcoudert at gcc dot gnu.org
2015-01-04 22:53 ` anlauf at gmx dot de
2015-01-09 11:20 ` rguenth at gcc dot gnu.org
2015-01-09 14:12 ` jakub at gcc dot gnu.org
2015-01-19 20:49 ` anlauf at gmx dot de
2015-02-11 21:20 ` jvdelisle at gcc dot gnu.org
2015-02-13 22:31 ` anlauf at gmx dot de
2015-02-15  4:59 ` jvdelisle at gcc dot gnu.org
2015-02-16  3:14 ` jvdelisle at gcc dot gnu.org
2015-02-16 12:04 ` anlauf at gmx dot de
2015-02-16 20:04 ` jvdelisle at gcc dot gnu.org
2015-02-18  4:21 ` jvdelisle at gcc dot gnu.org
2015-02-18 20:04 ` anlauf at gmx dot de [this message]
2015-02-18 20:12 ` anlauf at gmx dot de
2015-02-19 16:32 ` jvdelisle at gcc dot gnu.org
2015-02-20 17:11 ` jvdelisle at gcc dot gnu.org
2015-02-20 22:14 ` anlauf at gmx dot de
2015-02-22 12:06 ` dominiq at lps dot ens.fr
2015-02-22 12:56 ` dominiq at lps dot ens.fr
2015-02-22 17:11 ` jvdelisle at gcc dot gnu.org
2015-02-26 17:44 ` jvdelisle at gcc dot gnu.org
2015-03-15 21:29 ` anlauf at gmx dot de
2015-03-17  1:02 ` jvdelisle at gcc dot gnu.org
2015-03-17  1:05 ` jvdelisle at gcc dot gnu.org
2015-03-17  1:22 ` jvdelisle at gcc dot gnu.org
2015-03-17 21:16 ` anlauf at gmx dot de
2015-03-17 22:33 ` jvdelisle at gcc dot gnu.org
2015-03-18  1:47 ` jvdelisle at gcc dot gnu.org
2015-03-20  7:38 ` jvdelisle 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-64432-4-XuX74yGXi0@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).