From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5520 invoked by alias); 18 Feb 2015 20:04:18 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 5431 invoked by uid 48); 18 Feb 2015 20:04:13 -0000 From: "anlauf at gmx dot de" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gmx dot de X-Bugzilla-Status: NEW X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: fxcoudert at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg02047.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64432 --- Comment #22 from Harald Anlauf --- (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