From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26082 invoked by alias); 29 Dec 2014 14:13: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 26031 invoked by uid 48); 29 Dec 2014 14:13:08 -0000 From: "fxcoudert at gcc dot 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: Mon, 29 Dec 2014 14:13: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: fxcoudert at gcc dot gnu.org 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: assigned_to 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: 2014-12/txt/msg02858.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64432 Francois-Xavier Coudert changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |fxcoudert at gcc dot gnu.org --- Comment #4 from Francois-Xavier Coudert --- I'm not sure this is a bug, but this was definitely by design (as the comment indicates). I think this is allowed by the successive standards (which are, in any case, very weakly worded). The root of the problem is that we want to allow for SYSTEM_CLOCK to return high-precision values for large integer kinds, and fall back to lower-precision results that fit in fewer bytes for smaller integer kinds. Thus, one should call SYSTEM_CLOCK once with all the necessary arguments, and not multiple times with varying argument types. The only other consistent option I can see would be to simply go for high-resolution results in all cases, but that would mean that SYSTEM_CLOCK with 32-bit integers would wrap around in less than an hour. If you have another idea, please post a list of what you think should happen in all various cases (all possible combinations of arguments have to be allowed).