From patchwork Sat Feb 19 01:41:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 83672 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 87488B70FD for ; Sat, 19 Feb 2011 12:41:40 +1100 (EST) Received: (qmail 29314 invoked by alias); 19 Feb 2011 01:41:38 -0000 Received: (qmail 29299 invoked by uid 22791); 19 Feb 2011 01:41:37 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_NEUTRAL X-Spam-Check-By: sourceware.org Received: from out02.roch.ny.frontiernet.net (HELO out02.roch.ny.frontiernet.net) (66.133.183.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 19 Feb 2011 01:41:32 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAHquXk0yI+jm/2dsb2JhbAChWYRYvXyFXgSFC4pb Received: from relay01.roch.ny.frontiernet.net ([66.133.182.164]) by out02.roch.ny.frontiernet.net with ESMTP; 19 Feb 2011 01:41:30 +0000 X-Previous-IP: 50.35.232.230 Received: from quava.localdomain (unknown [50.35.232.230]) by relay01.roch.ny.frontiernet.net (Postfix) with ESMTPA id 5842C3FECB; Sat, 19 Feb 2011 01:41:29 +0000 (UTC) Message-ID: <4D5F1FE0.5000409@frontier.com> Date: Fri, 18 Feb 2011 17:41:52 -0800 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 MIME-Version: 1.0 To: gfortran CC: gcc patches Subject: [patch, libgfortran] PR47567 Wrong output for small absolute values with F editing Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This small patch adjusts the processor generated width for F0.d formatting to accommodate negative signs on zero. Regression tested on x86-64. Updated test case provided. OK for trunk? Regards, Jerry 2011-02-18 Jerry DeLisle PR libgfortran/47567 * io/write_float.def (output_float): Adjust width for F0.d to allow space for negative signs on zero. Index: write_float.def =================================================================== --- write_float.def (revision 170273) +++ write_float.def (working copy) @@ -116,7 +116,7 @@ output_float (st_parameter_dt *dtp, const fnode *f /* Handle special cases. */ if (w == 0) - w = d + 1; + w = d + (sign != S_NONE ? 2 : 1) + (d == 0 ? 1 : 0); /* For this one we choose to not output a decimal point. F95 10.5.1.2.1 */