From patchwork Fri Mar 20 22:24:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 452825 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 C30CE140140 for ; Sat, 21 Mar 2015 09:24:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=fnTJEoss; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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:cc:subject:content-type; q=dns; s=default; b=DDiFCXJp6I5ZQV8NqTlXIu/RkX1Mi3BYYnEy0BvmwZQ 9zFVHru/iD+jrkey9obHvONlxeKZmtaS/O61dxTbtuzrPmtD8RgI8cyaSa5Cy8iX sT+UmE0UXvKmwZ9rkEDNi18aR6IVPyUlqP+alBy0Xla0j8fNun+1pTwXP35gQIVk = 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:cc:subject:content-type; s=default; bh=N/nD6Tq9Oy+/UA4uOz5EODCQNBQ=; b=fnTJEossiSSErxu47 N5nqU174s+bdMJeLfMTvGkp58pCJ67TamhG8/3UVGGJYl5Vp575eACLOhEIPKIje 1WDU+vK7nTEiZmqE/qfkLwv8HlrfYMqFQuRuy7xWfaj1N2vgdNWPpuTbdM0snFjg NUpSgD9UwHfI7qynA51pxzkED8= Received: (qmail 10304 invoked by alias); 20 Mar 2015 22:24:47 -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 10286 invoked by uid 89); 20 Mar 2015 22:24:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, 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: mta21.charter.net Received: from mta21.charter.net (HELO mta21.charter.net) (216.33.127.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Mar 2015 22:24:45 +0000 Received: from imp09 ([10.20.200.9]) by mta21.charter.net (InterMail vM.8.01.05.09 201-2260-151-124-20120717) with ESMTP id <20150320222444.YCPF23400.mta21.charter.net@imp09>; Fri, 20 Mar 2015 18:24:44 -0400 Received: from mtaout003.msg.strl.va.charter.net ([68.114.190.28]) by imp09 with smtp.charter.net id 5yQk1q0010dCcRg05yQkA1; Fri, 20 Mar 2015 18:24:44 -0400 Received: from impout006 ([68.114.189.21]) by mtaout003.msg.strl.va.charter.net (InterMail vM.9.00.015.01 201-2473-143-101) with ESMTP id <20150320222444.YWFI15216.mtaout003.msg.strl.va.charter.net@impout006>; Fri, 20 Mar 2015 17:24:44 -0500 Received: from pavi.localdomain ([70.209.193.198]) by impout006 with charter.net id 5yQj1q0094HHvDA01yQjVX; Fri, 20 Mar 2015 17:24:44 -0500 X-Authority-Analysis: v=2.1 cv=I7rrRbQg c=1 sm=1 tr=0 a=FWRKyMND++2OllgWUFhw3g==:117 a=FWRKyMND++2OllgWUFhw3g==:17 a=hOpmn2quAAAA:8 a=XuYyiiJQKFMA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=9iDbn-4jx3cA:10 a=cKsnjEOsciEA:10 a=gZbpxnkM3yUA:10 a=mDV3o1hIAAAA:8 a=uSXuvknF2n_iCMbvifIA:9 a=QEXdDO2ut3YA:10 a=8Tijp5klaw52bTJbXo0A:9 X-Auth-id: anZkZWxpc2xlQGNoYXJ0ZXIubmV0 Message-ID: <550C9E2A.2060501@charter.net> Date: Fri, 20 Mar 2015 15:24:42 -0700 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: gfortran CC: gcc patches Subject: [Patch, Fortran, 4.8/4.9/5 Regression] PR59513 READ or WRITE not allowed after EOF The attached patch allows the attempt to READ or WRITE after an EOF for legacy code. The runtime error is suppressed for -std=legacy and -std=gnu. For standard conformance the error is retained as is now. Regression tested on x86-64. Test case endfile_3.f90 is updated by the patch. OK for trunk and then 4.9, 4.8? Regards, Jerry 2015-03-20 Jerry DeLisle PR libgfortran/59513 * io/transfer.c (data_transfer_init): Only error if -std=f95 or higher. Index: libgfortran/io/transfer.c =================================================================== --- libgfortran/io/transfer.c (revision 221543) +++ libgfortran/io/transfer.c (working copy) @@ -2533,7 +2533,8 @@ data_transfer_init (st_parameter_dt *dtp, int read return; } - if (dtp->u.p.current_unit->endfile == AFTER_ENDFILE) + if (!(compile_options.allow_std & GFC_STD_GNU) && + dtp->u.p.current_unit->endfile == AFTER_ENDFILE) { generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT, "Sequential READ or WRITE not allowed after " Index: gcc/testsuite/gfortran.dg/endfile_3.f90 =================================================================== --- gcc/testsuite/gfortran.dg/endfile_3.f90 (revision 221473) +++ gcc/testsuite/gfortran.dg/endfile_3.f90 (working copy) @@ -1,9 +1,10 @@ ! { dg-do run { target fd_truncate } } +! { dg-options -std=f95 } ! pr44477 READ/WRITE not allowed after ENDFILE !------------------------------------------- open(10, form='formatted', & action='write', position='rewind', status="scratch") endfile(10) - write(10,'(a)') "aa" ! { dg-shouldfail "Cannot perform ENDFILE" } + write(10,'(a)')"aa"! { dg-shouldfail "not allowed after EOF marker" } end