From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 66E673857C41; Fri, 11 Sep 2020 03:13:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66E673857C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1599794010; bh=DdNS9ehvh7eKZcZ4EjPIbKJXdCthjdXJNxkxm01/roA=; h=From:To:Subject:Date:From; b=SbvWqn0kykq73QsZAoDYG5li3iUhFMI120/RYKUgLo0mZP1ZQMbBzTUzaysHElELR kixDupmuo6cRz3lajLVYbR27RAd7FG+B5nWwCPUIxWTEpzWDJoyt+MQtmNFSVNh97h Bpwexh8v8berSCR1j9VlmYEXj1s75dShyc1rQJlk= From: "jvdelisle at charter dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/97017] New: The function determine_precision is called twice for each formatted real write Date: Fri, 11 Sep 2020 03:13:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jvdelisle at charter dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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, 11 Sep 2020 03:13:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97017 Bug ID: 97017 Summary: The function determine_precision is called twice for each formatted real write Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran Assignee: unassigned at gcc dot gnu.org Reporter: jvdelisle at charter dot net Target Milestone: --- I discovered this while working on the EX formattting feature. The determine_precision function is called by both get_precision and inside the macro FORMAT_FLOAT used by get_float_string. To me this implies we have something factored wrong as we should not have to call it twice to get things done. (a small performance issue as well as obscure) A simple test case will show the issue in a debugger: ! pr93727 EX Format Specifiers program main implicit none real(4) :: r4 real(8) :: r8 r4 =3D 3.14158_4 r8 =3D 12.3456789_8 print *, r4, r8 end program main=