From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26308 invoked by alias); 4 Jan 2015 21:56:32 -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 26255 invoked by uid 48); 4 Jan 2015 21:56:26 -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: Sun, 04 Jan 2015 21:56: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: P3 X-Bugzilla-Assigned-To: fxcoudert at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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-01/txt/msg00182.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64432 --- Comment #11 from Harald Anlauf --- (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 :-)