From patchwork Mon Apr 4 10:33:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 605835 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 3qdpHn2ZgXz9s9Y for ; Mon, 4 Apr 2016 20:33:57 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=vdlJ3QJR; 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:date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=JmUkvJzNAoQcYg4o uSluu5hEUKyboj+Z4H+ZdfqMAI4P7vRrgabpFqg3Y1FjE//v55PxvcmLHNJCnliA PIfQdbYPFD2iCKz/sI2qgM+gZHBUdDhi1Fc/IcutkPyl1uKUxC0PvqtBP7JqCDaG pqw/p75c5ZiDyktGlLXN+L7SI9A= 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=FmMYlldplfC+5U/LZomCxk y9hYI=; b=vdlJ3QJRUJUNJ+si/EettCYHyjhKvDFvNTzTUn4JGv57tYEutv7hWn wgoUQQ4IL6CHCPMaAD7qF4tT8RRVxvpLfTrwSyKwecQF7PNEGhvGDGEJZXcLssmG 7HezedBXFR1PF1K+tYATXB3GHjUhbscY2JUqej+q1XYQHWioNlOJs= Received: (qmail 13447 invoked by alias); 4 Apr 2016 10:33:48 -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 13422 invoked by uid 89); 4 Apr 2016 10:33:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=AWL, BAYES_40, FREEMAIL_FROM, FREEMAIL_REPLY, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=existent, arbeitskopie, Arbeitskopie, sk:mrestel X-Spam-User: qpsmtpd, 2 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.17.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 04 Apr 2016 10:33:37 +0000 Received: from vepi2 ([88.77.160.134]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0Mh9cj-1b9FdK47ov-00MLMM; Mon, 04 Apr 2016 12:33:32 +0200 Date: Mon, 4 Apr 2016 12:33:30 +0200 From: Andre Vehreschild To: Jerry DeLisle Cc: GCC-Patches-ML , GCC-Fortran-ML Subject: Re: [Fortran, Patch, pr67538, v1] ICE with invalid source allocation Message-ID: <20160404123330.41a51bac@vepi2> In-Reply-To: <57016D9C.9030402@charter.net> References: <20160403181326.16103d56@vepi2> <57016D9C.9030402@charter.net> MIME-Version: 1.0 X-UI-Out-Filterresults: notjunk:1; V01:K0:Ufi6kLqalDI=:ph1bcWcxt4c+xWcFgK/Iw/ lt/TGt8pYUB+SbNq50B3mWGpSUlt6YbvBUuCAnjEAWzDVE8nAJAYvBMI2s7JCunhEFGUhGjR4 zym9T0476IEbW3o9GpYrhEofYyv1HD9pDS0o0+UKLBrk8O1sAHB4c1eJW30mUEgKX+a/qdktQ U08gGNu/C8pzGhfIvDBIiYdxUWtxpr7zelh8yd19gvbA80BoNvLfKD5EjeUuR+QLc5xzgiL6i qp641NkU4V7VvubZbnQQFYwLLIlGA1QVOdu+2vbBbMaUl3+CJVBXX5CK3NpyiivTBnjDvnVq/ 8vgVwe9ec/92wU7v7zRlKYbwJgXyuDnyp1VEdi3s4OzJDog+IXEs7XqQagVMNZUWfVT6KRlHd f9z+5N3A1togwK0O2ASHjOz6Jsy2c3m/2xHnWhkTn2y1hL4zocSB1ulKafeAT2oR9WHhxk+HG rphOp6gMz+EN2WhH9xRqfbHktEpuXZf/XjnPm4IXtxcCnZyyEtYmtynhPsxowSH7MGxZq73XE hrUh72BPKAA99FIAUfgVNhk81tk9JwOXYPE8cvrTJqQPgCXwGzWoCbIi6K+ioubgoYs8W/77K 2sOE0mHheB6qGw+izvRijhTFVCYqKxpwmWfUg82cMQHgXieD/673z03zRC2Gzi8StbNDCzP0g 7C64I+QI/Ur1fFmShExGIdb1xYAsGh+s6e73xISFfIRPSdDX8tZ/aQZNXql/lk2ivR25JSGYZ w1/cPLTlqXXkYWWXKZCQefiBBa6KZCxu69ZFBd1pc6IFX9x7IjWz+EZsKlQ= Hi Jerry, thanks for the review. Committed as r234714. Regards, Andre On Sun, 3 Apr 2016 12:23:08 -0700 Jerry DeLisle wrote: > On 04/03/2016 09:13 AM, Andre Vehreschild wrote: > > Hi all, > > > > the attached patch checks that for F2008-style allocate(arr1, source=s) > > the expression in s is array valued, when arr1 has no array spec and > > emits an error message saying: > > > > Array specification or array-valued SOURCE= expression required in ALLOCATE statement at (1) > > > > This fixes the ICE. > > > > Bootstrapped and regtests ok on x86_64-linux-gnu/F23. Ok for trunk? > > > > Regards, > > Andre > > > > Yes, OK, thanks for patches. > > Jerry Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (Revision 234712) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,5 +1,12 @@ 2016-04-04 Andre Vehreschild + PR fortran/67538 + * resolve.c (resolve_allocate_expr): Emit error message when no + array spec and no array valued source= expression is given in an + F2008 allocate() for an array to allocate. + +2016-04-04 Andre Vehreschild + PR fortran/65795 * trans-array.c (gfc_array_allocate): When the array is a coarray, do not nullyfing its allocatable components in array_allocate, because Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (Revision 234712) +++ gcc/fortran/resolve.c (Arbeitskopie) @@ -7217,7 +7217,15 @@ if (!gfc_notify_std (GFC_STD_F2008, "Array specification required " "in ALLOCATE statement at %L", &e->where)) goto failure; - *array_alloc_wo_spec = true; + if (code->expr3->rank != 0) + *array_alloc_wo_spec = true; + else + { + gfc_error ("Array specification or array-valued SOURCE= " + "expression required in ALLOCATE statement at %L", + &e->where); + goto failure; + } } else { Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (Revision 234712) +++ gcc/testsuite/ChangeLog (Arbeitskopie) @@ -1,5 +1,10 @@ 2016-04-04 Andre Vehreschild + PR fortran/67538 + * gfortran.dg/allocate_with_source_19.f08: New test. + +2016-04-04 Andre Vehreschild + PR fortran/65795 * gfortran.dg/coarray_allocate_6.f08: New test. Index: gcc/testsuite/gfortran.dg/allocate_with_source_19.f08 =================================================================== --- gcc/testsuite/gfortran.dg/allocate_with_source_19.f08 (nicht existent) +++ gcc/testsuite/gfortran.dg/allocate_with_source_19.f08 (Arbeitskopie) @@ -0,0 +1,22 @@ +! { dg-do compile } +! { dg-options -std=f2008 } + +! Contributed by mrestelli@gmail.com +! Check that instead of an ICE the error message is emitted. + +module m + implicit none +contains + + subroutine s() + real, allocatable :: x(:) + real :: y + + y = 5.0 + ! x either needs an array spec, or y needs to be an array. + allocate( x , source=y ) ! { dg-error "Array specification or array-valued SOURCE= expression required in ALLOCATE statement" } + + end subroutine s + +end module m +