From patchwork Sat Mar 23 14:00:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 230336 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id EE2B42C00B2 for ; Sun, 24 Mar 2013 01:01:22 +1100 (EST) 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=aoU/YSTYjPZbrK4PAW4OQCfmBllVMBCNvveNAlhcP4/8rh ImQ4+zFR0qXDtZmdbCCJnql5O0gypeO8/CJk0PoInGUFvdCfyJ8+MvLiKBbL94bG Gr3xuBiIb/WnM8L4ndHuKEs16OUVS77TIqVjInVJm0MPMMuI5s229188qiNdY= 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=9fynEI2shK3wUEH/ZlbM01Wo4Yo=; b=ZMgwMZitUU5RLE518ZW2 G6fq0zDKwntYO4nWf69WOKl04pKXe0gRb4Vs59RnFBQB+gFzOm3fHAYkJXxSS34r uJNaXO3RJHoeEvMcW+qsh84qYP+R7CiHLNHHQDMW7/Ta0SuN7FykszEWB6M03+yi 1DDB+5vixeIwHljEttssXJ4= Received: (qmail 23022 invoked by alias); 23 Mar 2013 14:01:09 -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 22972 invoked by uid 89); 23 Mar 2013 14:00:57 -0000 X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 23 Mar 2013 14:00:54 +0000 Received: from archimedes.net-b.de (port-92-195-211-180.dynamic.qsc.de [92.195.211.180]) by mx02.qsc.de (Postfix) with ESMTP id B48E024AAE; Sat, 23 Mar 2013 15:00:51 +0100 (CET) Message-ID: <514DB593.5050401@net-b.de> Date: Sat, 23 Mar 2013 15:00:51 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR56696 - Fix EOF detection for listed-directed real_read X-Virus-Found: No This patch fixes the 4.8/4.9 regression, reported by Keith Refson. The patch which caused the regression (PR55818, Rev. 194809) allowed to list-direct read "1" as real variable. Seemingly, the handling went to far to also affect reading a real from "". I am not completely sure whether the patch is correct, but I think it is. I tried character, complex and integer, but those are seemingly not affected from the regression. OK for the trunk and the 4.8 branch? Tobias 2013-03-23 Tobias Burnus PR fortran/56696 * io/list_read.c (read_real): Fix EOF diagnostic. 2013-03-23 Tobias Burnus PR fortran/56696 * gfortran.dg/eof_5.f90: New. diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index aa7c8c0..ec45570 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1423,27 +1423,26 @@ read_real (st_parameter_dt *dtp, void * dest, int length) push_char (dtp, c); break; case '.': push_char (dtp, c); seen_dp = 1; break; case '+': case '-': goto got_sign; CASE_SEPARATORS: - case EOF: unget_char (dtp, c); /* Single null. */ eat_separator (dtp); return; case 'i': case 'I': case 'n': case 'N': goto inf_nan; default: goto bad_real; } --- /dev/null 2013-03-23 13:45:03.324112203 +0100 +++ gcc/gcc/testsuite/gfortran.dg/eof_5.f90 2013-03-23 14:55:47.783990895 +0100 @@ -0,0 +1,21 @@ +! { dg-do run } +! +! PR fortran/56696 +! +! Contributed by Keith Refson +! + +program iotest + character(len=258) :: inp = ' 1.0 1.0 1.0' + character(len=7) :: inp2 = '1 2 3 4' + integer :: ios + real :: a1, a2, a3, a4 + + read(inp2,*,iostat=ios) a1, a2, a3, a4 + if (ios /= 0) call abort () + + read(inp,*,iostat=ios) a1, a2, a3, a4 + if (ios == 0) call abort () +! write(*,*) 'IOSTAT=',ios +end program iotest +