From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60647 invoked by alias); 31 Jan 2019 01:30:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 60490 invoked by uid 89); 31 Jan 2019 01:30:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:ESMTPA X-HELO: impout008.msg.chrl.nc.charter.net Received: from impout008aa.msg.chrl.nc.charter.net (HELO impout008.msg.chrl.nc.charter.net) (47.43.20.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 Jan 2019 01:29:59 +0000 Received: from [192.168.1.6] ([66.191.41.128]) by cmsmtp with ESMTPA id p1AvgCp9kYOHFp1Avgor28; Thu, 31 Jan 2019 01:29:56 +0000 Authentication-Results: charter.net; none From: Jerry DeLisle Subject: [patch, fortran] PR52564 Accepts invalid: Missing I/O list after comma To: "fortran@gcc.gnu.org" Cc: GCC Patches Message-ID: <12de47dd-d8c7-bef3-573b-814a34222417@charter.net> Date: Thu, 31 Jan 2019 01:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------E5C225740BFFD06E51B978A1" X-SW-Source: 2019-01/txt/msg01766.txt.bz2 This is a multi-part message in MIME format. --------------E5C225740BFFD06E51B978A1 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 292 The attached patch is straight-forward and self explanatory. Regression tested on x86-64-pc-linux-gnu. Test case attached. OK for trunk? 2019-01-31 Jerry DeLisle PR fortran/52564 * io.c (match_io): Add check for comma after '*' without subsequent IO list. --------------E5C225740BFFD06E51B978A1 Content-Type: text/x-patch; name="pr52564.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr52564.diff" Content-length: 704 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index fce9228c302..95b30132203 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -4172,6 +4172,23 @@ match_io (io_kind k) else gfc_current_locus = where; } + + if (gfc_match_char ('*') == MATCH_YES + && gfc_match_char(',') == MATCH_YES) + { + locus where2 = gfc_current_locus; + if (gfc_match_eos () == MATCH_YES) + { + gfc_current_locus = where2; + gfc_error ("Comma after * at %C not allowed without I/O list"); + m = MATCH_ERROR; + goto cleanup; + } + else + gfc_current_locus = where; + } + else + gfc_current_locus = where; } if (gfc_current_form == FORM_FREE) --------------E5C225740BFFD06E51B978A1 Content-Type: text/x-fortran; name="print_2.f90" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="print_2.f90" Content-length: 213 ! { dg-do compile } ! PR52564 Accepts invalid: Missing I/O list after comma program printbug print *, 'hello world' ! the following line should not compile: print *, ! { dg-error "not allowed" } end program --------------E5C225740BFFD06E51B978A1--