From patchwork Tue Dec 6 02:24:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 86662 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1801903qgi; Mon, 5 Dec 2016 18:25:36 -0800 (PST) X-Received: by 10.84.179.67 with SMTP id a61mr128811524plc.98.1480991136848; Mon, 05 Dec 2016 18:25:36 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id s3si17057081pfe.68.2016.12.05.18.25.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Dec 2016 18:25:36 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443539-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443539-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443539-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=ncvGKZf2cc9uIHrVh+wzNOlzImJv+umdw+a7EsyIDxgXR9WK8A etV4eJ6zI9dacq+p5H3cmvTRKoIRrj7Qyh/4Iru7yG0nDxnHonP6yjHjpXKA7o65 Gd7jvJ2DXs/vCs9k4BLx0QiC10L6D6kDHHrwVLw5quALCioF7JnOF9Quo= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=wNw7ilV0zUx1Kqd0M8yNMRoK9jA=; b=FiOjensxWCOjHa+NPU8S IoT+VDzYEDgc8Sy4ozvZ62J//J+3vzvV9/Ec6DlrjMfvd9hOnblvqc6ZjNDZ392s kLAIsaZufSgosmWqD6vYuE8nh8Ii3h8QSnkFroqxQZRODlGTstpbPorJUH2nfFSW XlISl2pSk7vKrUD1oH7foCY= Received: (qmail 54172 invoked by alias); 6 Dec 2016 02:25:08 -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 54021 invoked by uid 89); 6 Dec 2016 02:25:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:InterMail, curve, jvdelisle@gcc.gnu.org, jvdelislegccgnuorg X-Spam-User: qpsmtpd, 2 recipients X-HELO: mtaout006-public.msg.strl.va.charter.net Received: from mtaout006-public.msg.strl.va.charter.net (HELO mtaout006-public.msg.strl.va.charter.net) (68.114.190.31) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Dec 2016 02:24:50 +0000 Received: from impout004 ([68.114.189.19]) by mtaout006.msg.strl.va.charter.net (InterMail vM.9.00.023.01 201-2473-194) with ESMTP id <20161206022447.HSIX7358.mtaout006.msg.strl.va.charter.net@impout004>; Mon, 5 Dec 2016 20:24:47 -0600 Received: from amda8.localdomain ([96.41.215.23]) by impout004 with charter.net id GSQm1u00Q0Wrkg001SQnVE; Mon, 05 Dec 2016 20:24:47 -0600 X-Authority-Analysis: v=2.1 cv=GIqGE49K c=1 sm=1 tr=0 a=salB9WdMPIDduBH7JsZfrA==:117 a=salB9WdMPIDduBH7JsZfrA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=mDV3o1hIAAAA:8 a=Ln8xZJhzvDi4LvYxpikA:9 a=QEXdDO2ut3YA:10 a=pGLkceISAAAA:8 a=YABnWcYfW4vUiLmOKXIA:9 a=_FVE-zBwftR9WsbkzFJk:22 a=6kGIvZw6iX1k4Y-7sg4_:22 X-Auth-id: anZkZWxpc2xlQGNoYXJ0ZXIubmV0 To: "fortran@gcc.gnu.org" Cc: GCC Patches From: Jerry DeLisle Subject: [patch, fortran] [F03] Spurious "requires DTIO" reported against namelist statement Message-ID: Date: Mon, 5 Dec 2016 18:24:46 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 The attached patch removes one error message and updates several test cases. I split alloc_comp_constraint_1.f90 into two cases with the addition of alloc_comp_constraint_7.f90. One gets different error messages depending on which standard is invoked, f95 or f2003. I will do an appropriate Changelog for testsuite. Regression tested on linux-x86_64, OK for trunk? Regards, Jerry 2016-12-05 Jerry DeLisle PR fortran/78659 * resolve.c (resolve_fl_namelist): Remove unneeded error. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 7bc9f5f5..e4ea10f2 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -13900,15 +13900,7 @@ resolve_fl_namelist (gfc_symbol *sym) "or POINTER components", nl->sym->name, sym->name, &sym->declared_at)) return false; - - if (!dtio) - { - gfc_error ("NAMELIST object %qs in namelist %qs at %L has " - "ALLOCATABLE or POINTER components and thus requires " - "a defined input/output procedure", nl->sym->name, - sym->name, &sym->declared_at); - return false; - } + return true; } } diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_constraint_1.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_constraint_1.f90 index eb1b1058..e1715256 100644 --- a/gcc/testsuite/gfortran.dg/alloc_comp_constraint_1.f90 +++ b/gcc/testsuite/gfortran.dg/alloc_comp_constraint_1.f90 @@ -1,5 +1,6 @@ ! { dg-do compile } -! Check that we don't allow IO or NAMELISTs with types with allocatable +! { dg-options -std=f2003 } +! Check that we don't allow IO of NAMELISTs with types with allocatable ! components (PR 20541) program main @@ -13,8 +14,8 @@ program main type(foo) :: a type(bar) :: b - namelist /blah/ a ! { dg-error "has ALLOCATABLE or POINTER components and thus requires a defined input/output" } - + namelist /blah/ a ! This is allowed under F2003, but not F95 + ! The following require User Defined Derived Type I/O procedures. write (*, *) a ! { dg-error "cannot have ALLOCATABLE components" } read (*, *) b ! { dg-error "cannot have ALLOCATABLE components" } diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_constraint_7.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_constraint_7.f90 new file mode 100644 index 00000000..35b8e1f0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_constraint_7.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! { dg-options -std=f95 } +! Check that we don't allow types with allocatable +program main + + type :: foo + integer :: k + integer, allocatable :: x(:) ! { dg-error "Fortran 2003: ALLOCATABLE" } + end type foo + + type :: bar + type(foo) :: x + end type bar + + type(foo) :: a + type(bar) :: b + namelist /blah/ a + +end program main diff --git a/gcc/testsuite/gfortran.dg/namelist_34.f90 b/gcc/testsuite/gfortran.dg/namelist_34.f90 index 94327710..be8f49f7 100644 --- a/gcc/testsuite/gfortran.dg/namelist_34.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_34.f90 @@ -1,7 +1,7 @@ ! { dg-do compile } -! +! { dg-options -std=f95 } ! PR fortran/32905 - accepts types with ultimate POINTER components -! +! updated for PR78659 MODULE types type :: tp3 real :: x @@ -22,7 +22,7 @@ MODULE nml USE types type(tp1) :: t1 type(tp3) :: t3 - - namelist /a/ t1 ! { dg-error "has ALLOCATABLE or POINTER components and thus requires a defined input/output" } - namelist /b/ t3 ! { dg-error "has ALLOCATABLE or POINTER components and thus requires a defined input/output" } +! The following are allowed under f2003. + namelist /a/ t1 ! { dg-error "with ALLOCATABLE or POINTER components" } + namelist /b/ t3 ! { dg-error "with ALLOCATABLE or POINTER components" } END MODULE diff --git a/gcc/testsuite/gfortran.dg/namelist_63.f90 b/gcc/testsuite/gfortran.dg/namelist_63.f90 index 02101740..de27b82d 100644 --- a/gcc/testsuite/gfortran.dg/namelist_63.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_63.f90 @@ -1,6 +1,6 @@ ! { dg-do compile } -! -! PR fortran/45530 +! { dg-options -std=f95 } +! PR fortran/45530, updated for PR78659 ! ! Contributed by david.sagan@gmail.com ! @@ -24,5 +24,6 @@ type region_struct end type type (c_struct) curve(10) -namelist / params / curve ! { dg-error "ALLOCATABLE or POINTER components and thus requires a defined input/output" } +! The following is allowed with f2003. +namelist / params / curve ! { dg-error "ALLOCATABLE or POINTER components" } end program