From patchwork Fri Dec 28 18:29:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 208514 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 CD0D12C00B5 for ; Sat, 29 Dec 2012 05:30:25 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1357324226; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=WFStdnviHahIjigMf5aGV/ILdNg=; b=SSCSoqRgjGWEQL3 gPXGf1rOyAmIlpzg0GyMOVooEssV6PGeWMAsjTZUJc5kFXtoxMp5NfyUBJYUYFb7 x913Nx2qs8Ehe5eYYMnY/AcprAxe+wT1B5bcu1jouvtUR22cWwDFHMSdk5Wykl6U OstJCJYZJHqjoy5GziNMTui1cuC0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:X-Authority-Analysis:X-Auth-id:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=K3KW4oRKzEwmlCf90nMxccFaTxHLbIN1jmL2MY2iIVEF4FqHa5AKaHmIfMjqSr iHCnbJBBnpqhW1q2w5EUZZIRw/KnI452IMiYCqOmCSXldULczk9cLhrBhZIAfael 6NdF4/m9d1UZX+kbs6b/D15ls/NW56cjH/iGtMtRYhZIg=; Received: (qmail 9188 invoked by alias); 28 Dec 2012 18:30:03 -0000 Received: (qmail 9105 invoked by uid 22791); 28 Dec 2012 18:30:00 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mta41.charter.net (HELO mta41.charter.net) (216.33.127.83) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Dec 2012 18:29:51 +0000 Received: from imp09 ([10.20.200.9]) by mta41.charter.net (InterMail vM.8.01.05.02 201-2260-151-103-20110920) with ESMTP id <20121228182950.KEKW10143.mta41.charter.net@imp09>; Fri, 28 Dec 2012 13:29:50 -0500 Received: from quava.localdomain ([71.80.154.83]) by imp09 with smtp.charter.net id h6Vo1k0011oDdDj056VpW8; Fri, 28 Dec 2012 13:29:50 -0500 X-Authority-Analysis: v=2.0 cv=Cp/n6QED c=1 sm=1 a=rAgDqpfJr0FWWJ6IzwxP7g==:17 a=uBsBa1gr-CYA:10 a=Sh6HmAv9I8UA:10 a=yUnIBFQkZM0A:10 a=hOpmn2quAAAA:8 a=lHtBJkU6CVwA:10 a=mDV3o1hIAAAA:8 a=y_AToRLBtrQN7WnQe5cA:9 a=wPNLvfGTeEIA:10 a=0geIil7pvg1LAjUoSyIA:9 a=y_C-3gJXL1Dyb9gK:21 a=hnX13RI2jdOw6TYp:21 a=rAgDqpfJr0FWWJ6IzwxP7g==:117 X-Auth-id: anZkZWxpc2xlQGNoYXJ0ZXIubmV0 Message-ID: <50DDE51B.5080902@charter.net> Date: Fri, 28 Dec 2012 10:29:47 -0800 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: gfortran CC: gcc patches Subject: Re: [patch, libgfortran] PR55818 Reading a REAL from a file which doesn't end in a new line fails References: <50DCFB22.1010509@charter.net> In-Reply-To: <50DCFB22.1010509@charter.net> 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 On 12/27/2012 05:51 PM, Jerry DeLisle wrote: > Hi, > > The attached patch fixes this problem by not calling hit_eof if EOF can be a > valid separator. > > Regression tested on x86-64. > > OK for trunk with test case from PR? > > Regards, > > Jerry > > 2012-12-27 Jerry DeLisle > > PR libfortran/55818 > * io/list_read.c (read_real): Do not call hit_eof when EOF can be > treated as a value separator Attached updated patch addresses the similar problem with complex and character variables (mentioned in subsequent PR comments). Regression tested on x86-64 linux. OK for trunk with updated ChangeLog and test cases from PR? Regards, Jerry Index: list_read.c =================================================================== --- list_read.c (revision 194731) +++ list_read.c (working copy) @@ -951,6 +951,7 @@ read_character (st_parameter_dt *dtp, int length _ break; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); /* NULL value. */ eat_separator (dtp); return; @@ -975,8 +976,7 @@ read_character (st_parameter_dt *dtp, int length _ for (;;) { - if ((c = next_char (dtp)) == EOF) - goto eof; + c = next_char (dtp); switch (c) { CASE_DIGITS: @@ -984,6 +984,7 @@ read_character (st_parameter_dt *dtp, int length _ break; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); goto done; /* String was only digits! */ @@ -1005,6 +1006,7 @@ read_character (st_parameter_dt *dtp, int length _ if ((c = next_char (dtp)) == EOF) goto eof; + switch (c) { CASE_SEPARATORS: @@ -1041,7 +1043,7 @@ read_character (st_parameter_dt *dtp, int length _ the string. */ if ((c = next_char (dtp)) == EOF) - goto eof; + goto done_eof; if (c == quote) { push_char (dtp, quote); @@ -1315,6 +1317,7 @@ read_complex (st_parameter_dt *dtp, void * dest, i break; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); eat_separator (dtp); return; @@ -1369,7 +1372,7 @@ eol_4: goto bad_complex; c = next_char (dtp); - if (!is_separator (c)) + if (!is_separator (c) && (c != EOF)) goto bad_complex; unget_char (dtp, c); @@ -1429,6 +1432,7 @@ read_real (st_parameter_dt *dtp, void * dest, int goto got_sign; CASE_SEPARATORS: + case EOF: unget_char (dtp, c); /* Single null. */ eat_separator (dtp); return; @@ -1484,6 +1488,7 @@ read_real (st_parameter_dt *dtp, void * dest, int goto got_repeat; CASE_SEPARATORS: + case EOF: if (c != '\n' && c != ',' && c != '\r' && c != ';') unget_char (dtp, c); goto done;