From patchwork Mon Feb 9 01:10:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 437769 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C10BB14012F for ; Mon, 9 Feb 2015 12:12:10 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=eLKMByJgVVPFotUvTRzazdUQZzXbErcnHzIlWcV9V8ZTlU 9ObqKW1MWGlivGJ2DKU9xNatUSe4TSrPRv0z+KePuz8i89HVQ9TMPOglf/VvONEO qyqe86NWO0tZmgiePo34JzJ7/Wjg4jEqViVxuuY4IkfBdP/qsNo41LinPlil4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=fSitFk1owdbhp8d4jaoA9yCmzz8=; b=WRzejAIUm+ysErBKJQIl BrbH7kbMcar9TKzM2iVgj/Z2CoAb4YSSOiEcvz4Cji0itf0FthmneoQi0MHMSaDu YB8qZeQXz/iu59eMwKvyf6ywcVP0ew7/ejV9PUFgIoF/7M/AgdZbx7xEuoChOfX+ azPSwuDVSm/1WNz6rl6iVOY= Received: (qmail 19757 invoked by alias); 9 Feb 2015 01:10:50 -0000 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 Received: (qmail 19716 invoked by uid 89); 9 Feb 2015 01:10:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mta11.charter.net Received: from mta11.charter.net (HELO mta11.charter.net) (216.33.127.80) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Feb 2015 01:10:48 +0000 Received: from imp09 ([10.20.200.9]) by mta11.charter.net (InterMail vM.8.01.05.09 201-2260-151-124-20120717) with ESMTP id <20150209011046.LUZO5815.mta11.charter.net@imp09>; Sun, 8 Feb 2015 20:10:46 -0500 Received: from mtaout006.msg.strl.va.charter.net ([68.114.190.31]) by imp09 with smtp.charter.net id q1Am1p0070h5dSU051Amhd; Sun, 08 Feb 2015 20:10:46 -0500 Received: from impout002 ([68.114.189.17]) by mtaout006.msg.strl.va.charter.net (InterMail vM.9.00.015.01 201-2473-143-101) with ESMTP id <20150209011046.ZUAP1734.mtaout006.msg.strl.va.charter.net@impout002>; Sun, 8 Feb 2015 19:10:46 -0600 Received: from pavi.localdomain ([70.209.206.0]) by impout002 with charter.net id q1Al1p00F012kzq011AlSU; Sun, 08 Feb 2015 19:10:46 -0600 X-Authority-Analysis: v=2.1 cv=NrdfcqtJ c=1 sm=1 tr=0 a=yz3tXx8l/krEA6f7bE+R3w==:117 a=yz3tXx8l/krEA6f7bE+R3w==:17 a=hOpmn2quAAAA:8 a=cmpKiNEfRqcA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=9iDbn-4jx3cA:10 a=cKsnjEOsciEA:10 a=gZbpxnkM3yUA:10 a=mDV3o1hIAAAA:8 a=tP8Ol5fg966C4-bs2aEA:9 a=QEXdDO2ut3YA:10 a=t5UGljqCR4bWCQfgXW8A:9 a=FDW1gxlmBmEA:10 a=vdyBFSoeHNQA:10 a=LSW1mi3CKqAA:10 a=sjFOEQHBqbRQdRkFFyQA:9 X-Auth-id: anZkZWxpc2xlQGNoYXJ0ZXIubmV0 Message-ID: <54D80914.80500@charter.net> Date: Sun, 08 Feb 2015 17:10:44 -0800 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: gfortran , gcc patches Subject: [patch, libgfortran] Bug 57822 - I/O: "(g0)" wrongly prints "E+0000" The attached patch fixes this by checking for the case when we are doing g0 editing and the exponent is 0. Regression tested on X86-64. For the larger kinds, we are on a different code path out of necessity, so we need to address this corner case. I will commit in a day or two as simple/obvious, with a Changelog for the testsuite as well. Regards, Jerry 2015-02-09 Jerry DeLisle PR libgfortran/57822 * io/write_float.def (output_float): If doing g0 editing and exponent is zero, do not emit exponent. ! { dg-do run } ! PR58722 program testit character(50) :: astring write(astring, '(g0)') 0.1_4 if (test(astring)) call abort write(astring, '(g0)') 0.1_8 if (test(astring)) call abort write(astring, '(g0)') 0.1_10 if (test(astring)) call abort write(astring, '(g0)') 0.1_16 if (test(astring)) call abort contains function test (string1) result(res) character(len=*) :: string1 logical :: res res = .true. do i = 1, len(string1) if (string1(i:i) == 'E') return end do res = .false. end function end program Index: write_float.def =================================================================== --- write_float.def (revision 220505) +++ write_float.def (working copy) @@ -724,7 +724,7 @@ } /* Output the exponent. */ - if (expchar) + if (expchar && !(dtp->u.p.g0_no_blanks && e == 0)) { if (expchar != ' ') {