From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 96A533844062; Fri, 8 Jan 2021 16:59:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96A533844062 From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/98577] Wrong "count_rate" values with int32 and real32 if the "count" argument is int64. Date: Fri, 08 Jan 2021 16:59:58 +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: 10.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 16:59:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98577 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|WONTFIX |INVALID --- Comment #16 from kargl at gcc dot gnu.org --- (In reply to Chinoune from comment #15) > Bug is a bug! It's not a bug if the behavior is documented. What does Intel do with this standard conforming program? program foo use iso_fortran_env, only : int32, int64, real64 implicit none integer(int32) rate4, t1, t2 integer(int64) rate8, u1, u2 ! ! Both Intel and gfortran should give the same timings as ! COUNT and COUNT_RATE variables have the same kind type ! parameter. This is documented by both gfortran and Intel. ! print '(A)', 'Behavior documented to give valid timings with gfortran and Intel' call system_clock(count_rate=3Drate4) print '(A,I0)', 'rate4 =3D ', rate4 call system_clock(count_rate=3Drate8) print '(A,I0)', 'rate8 =3D ', rate8 call system_clock(count=3Dt1) call loop call system_clock(count=3Dt2) print '(A,F0.3,A)', 'time =3D ', real(t2-t1,real64)/rate4, ' seconds (int32/int32)' call system_clock(count=3Du1) call loop call system_clock(count=3Du2) print '(A,F0.3,A)', 'time =3D ', real(u2-u1,real64)/rate8, ' seconds (int64/int64)' ! ! gfortran gives an invalid time with the following, but gfortran ! also documents the behavior. What does Intel do? ! print * print '(A)', 'Behavior documented to give invalid timings with gfortran' call system_clock(count_rate=3Drate8) print '(A,I0)', 'rate8 =3D ', rate8 call system_clock(count=3Dt1) call loop call system_clock(count=3Dt2) print '(A,F0.3,A)', 'time =3D ', real(t2-t1,real64)/rate8, ' seconds (int32/int64)' call system_clock(count_rate=3Drate4) print '(A,I0)', 'rate4 =3D ', rate4 call system_clock(count=3Du1) call loop call system_clock(count=3Du2) print '(A,F0.3,A)', 'time =3D ', real(u2-u1,real64)/rate4, ' seconds (int64/int32)' contains subroutine loop implicit none real(real64) dx, x, y integer i integer, parameter :: n =3D 100000001 dx =3D 1._real64 / (n - 1) do i =3D 1, n x =3D 1000 + (i - 1) * dx y =3D cos(x) x =3D sin(x) if (x * y > 2) stop 1 end do end subroutine loop end program foo=