This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/64432] [5 Regression] SYSTEM_CLOCK(COUNT_RATE=rate) wrong result for integer(4)::rate
- From: "anlauf at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 04 Jan 2015 21:56:18 +0000
- Subject: [Bug fortran/64432] [5 Regression] SYSTEM_CLOCK(COUNT_RATE=rate) wrong result for integer(4)::rate
- Auto-submitted: auto-generated
- References: <bug-64432-4 at http dot gcc dot gnu dot 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
:-)