From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19133 invoked by alias); 29 Dec 2014 11:14:09 -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 19087 invoked by uid 48); 29 Dec 2014 11:14:04 -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: Mon, 29 Dec 2014 11:14: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: X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gmx dot de X-Bugzilla-Status: UNCONFIRMED 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: 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/msg02846.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64432 --- Comment #1 from Harald Anlauf --- Modifying the test code as follows: % cat gfcbug128b.f90 program gfcbug128b integer(4) :: count_rate, count_max call system_clock (count_rate=count_rate,count_max=count_max) call system_clock (count_rate=count_rate) call system_clock (count_max=count_max) end % head -12 gfcbug128b.f90.003t.original gfcbug128b () { integer(kind=4) count_max; integer(kind=4) count_rate; { integer(kind=8) count_rate.0; _gfortran_system_clock_4 (0B, &count_rate, &count_max); _gfortran_system_clock_8 (0B, &count_rate.0, 0B); count_rate = (integer(kind=4)) count_rate.0; _gfortran_system_clock_4 (0B, 0B, &count_max); shows that the logic in trans-intrinsic.c::conv_intrinsic_system_clock does not cover the case of single arguments: gfc_expr *count = code->ext.actual->expr; gfc_expr *count_rate = code->ext.actual->next->expr; gfc_expr *count_max = code->ext.actual->next->next->expr; /* The INTEGER(8) version has higher precision, it is used if both COUNT and COUNT_MAX can hold 64-bit values, or are absent. */ if ((!count || count->ts.kind >= 8) && (!count_max || count_max->ts.kind >= 8)) kind = 8; else kind = gfc_default_integer_kind; type = gfc_get_int_type (kind); /* Evaluate our arguments. */ This probably needs to be amended.