From patchwork Tue Dec 13 16:48:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 87909 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2303470qgi; Tue, 13 Dec 2016 08:49:19 -0800 (PST) X-Received: by 10.99.173.68 with SMTP id y4mr177044731pgo.54.1481647759461; Tue, 13 Dec 2016 08:49:19 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id f14si48593332plm.266.2016.12.13.08.49.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Dec 2016 08:49:19 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444315-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-444315-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444315-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:date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=xkLYWi/p/wd8yIiu G6i9GiRPyKIInSiJLBMw+q552FF6S0ZSB9XDdzaZBnev0qXU27r0FqPuwecyipZj PABliJ68wIhHht0jTml/RQGWHuoeeRcbvTLsOJncuTeYoJSirhxTT9tUWUh8xs6j ae5gQtCYQUXXVYvi70AHZXSB/Ac= 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:date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=Vk8uafvz441P6TZRqTzA2B Tg4uc=; b=CChSKk16uhg23dfmgn2gYDeU+RKKsOSY/ZL/Y0vruPFqe31/PsbNbr cFHuhS3lBZ14pSSPzlH5hEnet7+fE1Qf29+pONvupP0C15MEUGUcaK/6h/7Af1Od /HVV+159qcy/mJSKVlCXlFdvzT1RoP14mjPpbUEggcN4BfUUZ3AvQ= Received: (qmail 85383 invoked by alias); 13 Dec 2016 16:48:57 -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 85338 invoked by uid 89); 13 Dec 2016 16:48:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=nicht, H*f:sk:jp-83Tj, H*i:CAKwh3qhi, H*MI:CAKwh3qhi X-Spam-User: qpsmtpd, 3 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.17.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Dec 2016 16:48:54 +0000 Received: from vepi2 ([92.76.205.227]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0Lpgew-1cnRFU1uFS-00fO1m; Tue, 13 Dec 2016 17:48:50 +0100 Date: Tue, 13 Dec 2016 17:48:49 +0100 From: Andre Vehreschild To: Janus Weil Cc: GCC-Patches-ML , GCC-Fortran-ML Subject: Re: [PATCH, fortran, pr77785, v3] [Coarray] ICE in gfc_get_caf_token_offset, at fortran/trans-expr.c:1990 Message-ID: <20161213174849.5635fe1e@vepi2> In-Reply-To: References: <20161212125614.24ca3ca5@vepi2> <20161212184436.212a7185@vepi2> <20161213145436.5d293776@vepi2> MIME-Version: 1.0 X-UI-Out-Filterresults: notjunk:1; V01:K0:dA/PKrovo5E=:XjmAqElL0GZn9zAFRWlxTe Q9TVg4Xg4GHI+CkmacyAY0s6/bSuzBs/f+bTVS+Gd6tTVtX4IYLt7UUf3YIjJdf5JmEGLRL7v SHgadHuMhy432l2Ov5ElQeXtP8yc9fIuqiHwGDhiaYHf9H/q2K+ydsQOMbjLGGifrTxHF5pY/ m1xA5aCWscBbp88SoFCBGMJEHjWU6uS5JdnWnROP4qynN9wmcuLa4XmNcXzmCGnsU+kPHX6RW aPG3VadLcz00EVnhXtSwBZp+1QjBQ2qbR4tGe0qQIEXDVZaTmQ5wR8KqAg+lo+G4tI6/o5wZf 0nkZGm5nZN/tySH3HrnjhO29Sa+EXK2hBYUQLB6BQMIB6KapiFlrJMW/UTyhcpwWWgEuobsfX 665xXX2wPiMwUQlBMd+wiJ3+uEtVQrmJYD+sPFzr1zGK4WWJKR3l1KLGOyZ7PG/f7OHaTNOo/ B4zfYR0ZN1WtUAY8vbumAHEnfY9kYYuIjhH/ASIFukZ7l9McNYZtUg0QwKigJu2vvtB1wUNJN KyQ0HQqClpiTNmAOVK2jNAa1Ue/njfTGW71Xzmf/god627LXOth1kEiqwqppHOtZTy5ajglR9 aTw3If+UPe9b28DaPps+Q2Ro8R/FYtuBic5ks+Fk4CM5ByGXrTN0csp2CSfMLPz6hbpOnLBcD 0W1kQ+ZiRFMXXOkTDmxz1foiT4Ap8LsPWrtKTZ1j5jw86iHm48tN0x19IPoyeF2Rc1yPJNxxT salKMzaT0Jlycz/VcoT9WkvbzasiKLBXCnHm5NyG6uws2uIKhck3ivP8So0= Hi Janus, thanks for the review. Committed as r243614. - Andre On Tue, 13 Dec 2016 16:08:59 +0100 Janus Weil wrote: > Hi Andre, > > > thanks for the input on the missing testcase, Janus (btw, when you know > > where to get a new crystal ball, let me know; I am missing mine, too). The > > new version of the patch adds a new testcase coarray_41.f90 to test that > > the compiler compiles correctly and the test runs ok. > > > > Bootstrapped and regtested on x86_64-linux/f23. Ok for trunk? > > yes, good for trunk then. > > Cheers, > Janus > > > > > On Tue, 13 Dec 2016 12:11:50 +0100 > > Janus Weil wrote: > > > >> Hi Andre, > >> > >> > all the sanitizer issues I fixed occur during compiling the testsuite. > >> > So I would say, that when with the patch these errors do not occur > >> > anymore while processing the testsuite, then those are tested for, > >> > right? > >> > >> aah, so you're saying that hunk is not actually related to the PR in > >> the subject line, but instead fixes a testsuite failure seen with a > >> sanitized compiler? That wasn't mentioned anywhere and sadly I forgot > >> to bring my crystal ball ... > >> > >> Cheers, > >> Janus > >> > >> > >> > >> > On Mon, 12 Dec 2016 13:37:43 +0100 > >> > Janus Weil wrote: > >> > > >> >> Hi Andre, > >> >> > >> >> > the attached patch corrects reporting of "Sorry, unimplemented yet" > >> >> > for allocatable and pointer components in polymorphic objects > >> >> > (BT_CLASS) thus fixing two ICEs reported in the PR. > >> >> > > >> >> > The next chunk fixes an ICE when the declaration containing the token > >> >> > information is of type POINTER or REFERENCE. > >> >> > > >> >> > Bootstraps and regtests ok on x86_64-linux/f23. Ok for trunk? > >> >> > >> >> the resolve.c hunk is certainly ok. The trans-array.c part looks > >> >> reasonable as well, but I wonder if it is actually covered by any of > >> >> your test cases? Since they are all compile-only, with errors being > >> >> thrown at resolution stage, do they even get to the translation stage? > >> >> > >> >> Cheers, > >> >> Janus > >> > > >> > > >> > -- > >> > Andre Vehreschild * Email: vehre ad gmx dot de > > > > > > -- > > Andre Vehreschild * Email: vehre ad gmx dot de -- Andre Vehreschild * Email: vehre ad gmx dot de Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (Revision 243613) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,3 +1,11 @@ +2016-12-13 Andre Vehreschild + + PR fortran/77785 + * resolve.c (resolve_symbol): Correct attr lookup to the _data + component. + * trans-array.c (gfc_alloc_allocatable_for_assignment): Indirect ref + pointers and references before retrieving the caf-token. + 2016-12-13 Janus Weil Paul Thomas Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (Revision 243613) +++ gcc/fortran/resolve.c (Arbeitskopie) @@ -14044,8 +14044,8 @@ if (flag_coarray == GFC_FCOARRAY_LIB && sym->ts.type == BT_CLASS && sym->ts.u.derived && CLASS_DATA (sym) && CLASS_DATA (sym)->attr.codimension - && (sym->ts.u.derived->attr.alloc_comp - || sym->ts.u.derived->attr.pointer_comp)) + && (CLASS_DATA (sym)->ts.u.derived->attr.alloc_comp + || CLASS_DATA (sym)->ts.u.derived->attr.pointer_comp)) { gfc_error ("Sorry, allocatable/pointer components in polymorphic (CLASS) " "type coarrays at %L are unsupported", &sym->declared_at); Index: gcc/fortran/trans-array.c =================================================================== --- gcc/fortran/trans-array.c (Revision 243613) +++ gcc/fortran/trans-array.c (Arbeitskopie) @@ -9337,6 +9337,8 @@ if (token == NULL_TREE) { tmp = gfc_get_tree_for_caf_expr (expr1); + if (POINTER_TYPE_P (TREE_TYPE (tmp))) + tmp = build_fold_indirect_ref (tmp); gfc_get_caf_token_offset (&caf_se, &token, NULL, tmp, NULL_TREE, expr1); token = gfc_build_addr_expr (NULL_TREE, token); Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (Revision 243613) +++ gcc/testsuite/ChangeLog (Arbeitskopie) @@ -1,3 +1,10 @@ +2016-12-13 Andre Vehreschild + + PR fortran/77785 + * gfortran.dg/coarray_38.f90: Added expecting error message. + * gfortran.dg/coarray_41.f90: New test. + * gfortran.dg/coarray_class_2.f90: New test. + 2016-12-13 Carl Love * gcc.target/powerpc/builtins-3.c: Add new test of the test suite Index: gcc/testsuite/gfortran.dg/coarray_38.f90 =================================================================== --- gcc/testsuite/gfortran.dg/coarray_38.f90 (Revision 243613) +++ gcc/testsuite/gfortran.dg/coarray_38.f90 (Arbeitskopie) @@ -92,7 +92,7 @@ type t2 class(t), allocatable :: caf2[:] end type t2 -class(t), save, allocatable :: caf[:] +class(t), save, allocatable :: caf[:] ! { dg-error "Sorry, allocatable/pointer components in polymorphic" } type(t) :: x type(t2) :: y Index: gcc/testsuite/gfortran.dg/coarray_41.f90 =================================================================== --- gcc/testsuite/gfortran.dg/coarray_41.f90 (nicht existent) +++ gcc/testsuite/gfortran.dg/coarray_41.f90 (Arbeitskopie) @@ -0,0 +1,29 @@ +! { dg-do run } +! { dg-options "-fcoarray=lib -lcaf_single" } + +program coarray_41 + + integer, allocatable :: vec(:)[:,:] + + allocate(vec(10)[2,*], source= 37) + + if (.not. allocated(vec)) error stop + + call foo(vec) + + if (any(vec /= 42)) error stop + + deallocate(vec) +contains + + subroutine foo(gv) + + integer, allocatable, intent(inout) :: gv(:)[:,:] + integer, allocatable :: gvin(:) + + allocate(gvin, mold=gv) + gvin = 5 + gv = gv + gvin + end subroutine foo + +end program coarray_41 Index: gcc/testsuite/gfortran.dg/coarray_class_2.f90 =================================================================== --- gcc/testsuite/gfortran.dg/coarray_class_2.f90 (nicht existent) +++ gcc/testsuite/gfortran.dg/coarray_class_2.f90 (Arbeitskopie) @@ -0,0 +1,45 @@ +! { dg-do compile } +! { dg-options "-fcoarray=lib" } +! Check that error message is presented as long as polymorphic coarrays are +! not implemented. + +module maccscal + type t + real, allocatable :: a + end type +contains + subroutine s(x) ! { dg-error "Sorry, allocatable/pointer components in polymorphic \\(CLASS\\)" } + class(t) :: x[*] + allocate (x%a) + end +end +module mptrscal + type t + real, pointer :: a + end type +contains + subroutine s(x) ! { dg-error "Sorry, allocatable/pointer components in polymorphic \\(CLASS\\)" } + class(t) :: x[*] + allocate (x%a) + end +end +module mallarr + type t + real, allocatable :: a(:) + end type +contains + subroutine s(x) ! { dg-error "Sorry, allocatable/pointer components in polymorphic \\(CLASS\\)" } + class(t) :: x[*] + allocate (x%a(2)) + end +end +module mptrarr + type t + real, pointer :: a(:) + end type +contains + subroutine s(x) ! { dg-error "Sorry, allocatable/pointer components in polymorphic \\(CLASS\\)" } + class(t) :: x[*] + allocate (x%a(2)) + end +end