From patchwork Mon Jul 14 20:04:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 369752 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 99A55140086 for ; Tue, 15 Jul 2014 06:05:00 +1000 (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=Fl8lkmBnWbDagnSUMhex9elyNiHQTis1smRJSpOujCPjuM mob3shfc/N6FCqcsR8JjITGgr8GS3am1BDdpSGVymFcy64N7+lSFcXU7NgMWPMOh bF+D1tlFMODPWUSOjl7LdNYion2yzfCxBtrwhrFdBOGBkZ5vHCdRra1Lkeb9I= 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=lAaL+8XYuG2s7eAuvu1e51djHTY=; b=Fi1fWlauuikng+FZyE24 aseeiYY9wAQz3jHojCiboe3f72w50dgkmfh5MrsprzuZgXZonNOA5KB0DRU2qU8l oqa2lXFv0aXrdglUTB9aB04iomp9AL1RwojmarWTA3habjECcPlHwybk2JXxSUVL Ng6AIU6hFpC6ckuOopEIYxA= Received: (qmail 23923 invoked by alias); 14 Jul 2014 20:04:49 -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 23901 invoked by uid 89); 14 Jul 2014 20:04:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx02.qsc.de Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 14 Jul 2014 20:04:46 +0000 Received: from tux.net-b.de (port-92-194-213-151.dynamic.qsc.de [92.194.213.151]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPSA id 09605276AF; Mon, 14 Jul 2014 22:04:42 +0200 (CEST) Message-ID: <53C437DA.2050800@net-b.de> Date: Mon, 14 Jul 2014 22:04:42 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: gcc-patches , gfortran Subject: [Patch, Fortran] Add missing coarray check While checking whether gfortran already handles the new constraint at http://j3-fortran.org/doc/year/14/14-140r2.txt (it does), I found the following issues: a) Coarray variables with pointer attribute weren't rejected. b) There was a copy'n'paste error in symbol.c, having cray_pointer at places where one should have cray_pointee, such that the cray-pointer test had been done twice. Build and regtested on x86-64-gnu-linux. OK for the trunk? * * * Admittedly, I cannot find the constraint for (a), but I am certain that it is not intended to permit the POINTER attribute. Even using C526 plus C528 still seem to permit "integer, save, pointer :: caf[*]". I have now asked at the J3 mailing list for a pointer to the right constraint. At least Cray's compiler (correctly?!?) rejects coarrays with pointer attribute. Tobias 2014-06-14 Tobias Burnus gcc/fortran/ * symbol.c (check_conflict): Add codimension conflict with pointer; fix cray-pointee check. gcc/testsuite/ * gfortran.dg/coarray_34.f90: New. * gfortran.dg/coarray_6.f90: Update test case. diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index aee7510..2e04598 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -458,6 +458,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) conf (pointer, target); conf (pointer, intrinsic); conf (pointer, elemental); + conf (pointer, codimension); conf (allocatable, elemental); conf (target, external); @@ -534,8 +535,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) conf (cray_pointer, entry); conf (cray_pointee, allocatable); - conf (cray_pointer, contiguous); - conf (cray_pointer, codimension); + conf (cray_pointee, contiguous); + conf (cray_pointee, codimension); conf (cray_pointee, intent); conf (cray_pointee, optional); conf (cray_pointee, dummy); diff --git a/gcc/testsuite/gfortran.dg/coarray_34.f90 b/gcc/testsuite/gfortran.dg/coarray_34.f90 new file mode 100644 index 0000000..f2bc910 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_34.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! { dg-options "-fcoarray=single" } +! +use iso_fortran_env +implicit none + +type t + integer, pointer :: caf2[:] ! { dg-error "must be allocatable with deferred shape" } +end type t + +integer, pointer :: caf[*] ! { dg-error "POINTER attribute conflicts with CODIMENSION attribute" } + +type t2 + type(lock_type), pointer :: lock_it ! { dg-error "Component lock_it at .1. of type LOCK_TYPE must have a codimension or be a subcomponent of a coarray, which is not possible as the component has the pointer attribute" } +end type t2 +type(t2) :: caf3[*] + +type t3 + type(lock_type) :: x +end type t3 + +type t4 + type(t3), pointer :: y ! { dg-error "Pointer component y at .1. has a noncoarray subcomponent of type LOCK_TYPE, which must have a codimension or be a subcomponent of a coarray" } +end type t4 + +end diff --git a/gcc/testsuite/gfortran.dg/coarray_6.f90 b/gcc/testsuite/gfortran.dg/coarray_6.f90 index f44ac01..d30567a 100644 --- a/gcc/testsuite/gfortran.dg/coarray_6.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_6.f90 @@ -32,7 +32,7 @@ end module m subroutine bar() integer, parameter :: a[*] = 4 ! { dg-error "PARAMETER attribute conflicts with CODIMENSION" } - integer, pointer :: b[:] ! { dg-error "is not ALLOCATABLE, SAVE nor a dummy" } + integer :: b[*] ! { dg-error "is not ALLOCATABLE, SAVE nor a dummy" } end subroutine bar subroutine vol()