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: Sun, 04 Jan 2015 21:56:00 -0000	[thread overview]
Message-ID: <bug-64432-4-p0s8RPqdQP@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 #11 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Harald Anlauf from comment #10)
> Created attachment 34374 [details]
> Partial patch to handle proposed behavior of system_clock

The patch in comment #10 is a way to produce behavior similar
to Intel:

- every argument to SYSTEM_CLOCK is treated separately and independently
- tested with integer(4), integer(8) and also real(4/8) for count_rate

Note that:
- it is imcomplete, ugly
- inefficient (calls _gfortran_system_clock_ for each present argument)
- does not handle integer(1) and integer(2) properly
- needs cleanup

It works for me.  I.e., for

% cat gfcbug128d.f90
program gfcbug128d
  integer(4) :: count_rate_i4, count_max_i4
  integer(8) :: count_rate_i8, count_max_i8
  real(4)    :: count_rate_r4 = 0
  real(8)    :: count_rate_r8 = 0

  call system_clock (count_max=count_max_i4)
  call system_clock (count_rate=count_rate_i4)
  call system_clock (count_rate=count_rate_r4)
  print *, count_max_i4, count_rate_i4, count_rate_r4
  call system_clock (count_rate=count_rate_i4,count_max=count_max_i4)
  print *, count_max_i4, count_rate_i4
  call system_clock (count_rate=count_rate_r4,count_max=count_max_i4)
  print *, count_max_i4, count_rate_r4
  print *
  call system_clock (count_max=count_max_i8)
  call system_clock (count_rate=count_rate_i8)
  call system_clock (count_rate=count_rate_r8)
  print *, count_max_i8, count_rate_i8, count_rate_r8
  call system_clock (count_rate=count_rate_i8,count_max=count_max_i8)
  print *, count_max_i8, count_rate_i8
  call system_clock (count_rate=count_rate_r8,count_max=count_max_i8)
  print *, count_max_i8, count_rate_r8
  print *
  call system_clock (count_rate=count_rate_i4,count_max=count_max_i8)
  print *, count_max_i8, count_rate_i4
  call system_clock (count_rate=count_rate_r4,count_max=count_max_i8)
  print *, count_max_i8, count_rate_r4
  print *
  call system_clock (count_rate=count_rate_i8,count_max=count_max_i4)
  print *, count_max_i4, count_rate_i8
  call system_clock (count_rate=count_rate_r8,count_max=count_max_i4)
  print *, count_max_i4, count_rate_r8
end

it produces:
  2147483647        1000   1000.00000    
  2147483647        1000
  2147483647   1000.00000    

  9223372036854775807              1000000   1000000.0000000000     
  9223372036854775807              1000000
  9223372036854775807   1000000.0000000000     

  9223372036854775807        1000
  9223372036854775807   1000.00000    

  2147483647              1000000
  2147483647   1000000.0000000000     

:-)


  parent reply	other threads:[~2015-01-04 21:56 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 [this message]
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
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-p0s8RPqdQP@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).