From patchwork Mon Apr 4 09:36:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 605785 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 3qdn1b3DGWz9s3T for ; Mon, 4 Apr 2016 19:36:34 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=EA81oXIb; 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=S7u4VAUjMCwi3ha0 t9eVg5xFrsKhnGvPzPlqp5WpUMX2kNf5qFMLnKjUYjXR2w3liG/G/1yZTO7cDtLy 2JeVesOAIOCHVAhstyFHIq4h3qtLS5OYK6BtsTuAHPqEvBAtdYqmyQNbhmfBIrJt lbxybJRbDoDnqiU6fyhsKZXOs8o= 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=NuaSbse9WmyLkj9CB5NAQ2 zLVuQ=; b=EA81oXIb60piiMdbL9WpXM7Tihw0R+mzFWmyK9BoTI1PN+UcFGyNmC 8WocIRb73/bICA496q0/YTVBqgz5dFsHaBG4xRId8FE2alaFRvAF4g1Fq6volOr3 gZc8X0fsiDVjQ96LO0eT8+f7qpIh3ivfEuu9NnS4wIkagYLd31xqE= Received: (qmail 121058 invoked by alias); 4 Apr 2016 09:36:21 -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 121036 invoked by uid 89); 4 Apr 2016 09:36:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 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=burnus@gcc.gnu.org, burnusgccgnuorg, nicht, H*c:HHH X-Spam-User: qpsmtpd, 2 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.15.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 04 Apr 2016 09:36:10 +0000 Received: from vepi2 ([88.77.160.134]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MTkNU-1bDRmF2xlY-00QWC1; Mon, 04 Apr 2016 11:36:03 +0200 Date: Mon, 4 Apr 2016 11:36:02 +0200 From: Andre Vehreschild To: Dominique =?UTF-8?B?ZCdIdW1pw6hyZXM=?= Cc: "jvdelisle@charter.net" , fortran@gcc.gnu.org, gcc-patches Subject: Re: [Fortran, Patch, pr65795, v1] Segfault (invalid write) for ALLOCATE statement involving COARRAYS Message-ID: <20160404113602.3ae80402@vepi2> In-Reply-To: <5C92C102-BD0C-4FC9-ADDE-0E2CBB000E2C@lps.ens.fr> References: <7DD7789A-5E9B-4CFF-B40B-D92665A5AB27@lps.ens.fr> <5C92C102-BD0C-4FC9-ADDE-0E2CBB000E2C@lps.ens.fr> MIME-Version: 1.0 X-UI-Out-Filterresults: notjunk:1; V01:K0:XaD9GybaITI=:VHz8aYPjU52v8ANkD9mP/1 PNiCi6gA7D3xIndt9oCC4hhZZ6jQBN1zLOr695LUdwsA4O2ByAfyoG0fm/yaOWBLdp9LYnUSA o5ZBDx6f7uJ6ma5bqRxR0jDRoDwR4k6rPfvYRpaNvKBIbl0RWLfgdaNrDbfOofsEzXPghiiuG 0RDKUpqWC8y1trCezf1Pc0BB9AJKyYKXi860K94mznD6sPnNjVOfoJHlNZE4YzWyxxcj0xsbU 4W924cKWvLtfJSUeIQj2v0Jw2MrbcLE+7v0upYCcXaiXtQgwA7Rjnoh0dMwGkz9oegdwYHk4T cSl/d4iUL52hmsQrkRm4EGv1RVCWJwcXlk3Dwmhwsof4CXTtFJp1Y2uEwp3/UAS3g9/Sf0Bpk F4ZN6agm1WCxdMhnsZUCzupN3p/sISezt1TxgGrLcueRRZIJutlqPeAqQvO1NdIk3ZvsZlfb/ FaHU38dqkJMTX5uW6kKPecSHlWJtq0L36UnjhikiyNGxuBZ27th+gWtDPaFtYW+qjNAVVNEZI rav5mRtEHtp7JrxVTpFTzvoKUYs5O3IkC0mVgt2SY0CaUgS2NTvlWORa9hiwRA7uLE8FSI/Tw W25K6/mpPokpAdoxKQdEM1dqUL23koIVaRKTauOmVumc1GSKkbDnpyuZ0/gw0Bkt+5BCzvXQk QJu/Qw//SPh7YV1xXdMecOYLhByuwQJvRBAx1o39sRU0Dw5Wg8uWsvT5BkLtWCuf6zIDVJN7P OyES4PuUaeglTTBUIZ5+bOGCRG5VP+GZVbTHzT0DXd9jN5EY6x3MUloKShM= Hi Jerry, hi Dominique, Jerry, thank you for the review. Committed to trunk as r234710 and to gcc-5-branch as r234711 including the additional option Dominique noted I had missed. Thank for pointing that out, Dominique. Regards, Andre On Sun, 3 Apr 2016 23:46:34 +0200 Dominique d'Humières wrote: > > Le 3 avr. 2016 à 23:38, Andre Vehreschild a écrit : > > > > Hi Dominique, > > > > I thought that was implicit, isn't it? > > I don’t think so and I see in the log files > > gcc/testsuite/gfortran4/gfortran.sum:UNRESOLVED: gfortran.dg/coarray_allocate_6.f08 -O0 scan-tree-dump-not original "c.caf.x = 0B" > > > Is only the removal of the file implicit? > > Yes, > > > I will add the option to be on the safe side. > > Thanks, > > Dominique > > > > > - Andre > > > > Am 3. April 2016 22:57:48 MESZ, schrieb "Dominique d'Humières" : > > Andre, > > > > Does not the test gfortran.dg/coarray_allocate_6.f08 require a -fdump-tree-original in the dg-options list? > > > > Thanks for the patch, > > > > Dominique > > > > > > -- > > Andre Vehreschild * Kreuzherrenstr. 8 * 52062 Aachen > > Tel.: +49 241 929 10 18 * vehre@gmx.de > Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (Revision 234706) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,3 +1,11 @@ +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 + the nullify missed the array ref and nullifies the wrong component. + Cosmetics. + 2016-03-28 Andre Vehreschild PR fortran/70397 Index: gcc/fortran/trans-array.c =================================================================== --- gcc/fortran/trans-array.c (Revision 234706) +++ gcc/fortran/trans-array.c (Arbeitskopie) @@ -5390,8 +5390,8 @@ else gfc_add_expr_to_block (&se->pre, set_descriptor); - if ((expr->ts.type == BT_DERIVED) - && expr->ts.u.derived->attr.alloc_comp) + if (expr->ts.type == BT_DERIVED && expr->ts.u.derived->attr.alloc_comp + && !coarray) { tmp = gfc_nullify_alloc_comp (expr->ts.u.derived, se->expr, ref->u.ar.as->rank); Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (Revision 234706) +++ gcc/testsuite/ChangeLog (Arbeitskopie) @@ -1,3 +1,8 @@ +2016-04-04 Andre Vehreschild + + PR fortran/65795 + * gfortran.dg/coarray_allocate_6.f08: New test. + 2016-04-01 Ilya Enkovich Backport from mainline r234666. Index: gcc/testsuite/gfortran.dg/coarray_allocate_6.f08 =================================================================== --- gcc/testsuite/gfortran.dg/coarray_allocate_6.f08 (nicht existent) +++ gcc/testsuite/gfortran.dg/coarray_allocate_6.f08 (Arbeitskopie) @@ -0,0 +1,27 @@ +! { dg-do run } +! { dg-options "-fcoarray=single -fdump-tree-original" } + +! Contributed by Tobias Burnus +! Test fix for pr65795. + +implicit none + +type t2 + integer, allocatable :: x +end type t2 + +type t3 + type(t2), allocatable :: caf[:] +end type t3 + +!type(t3), save, target :: c, d +type(t3), target :: c, d +integer :: stat + +allocate(c%caf[*], stat=stat) +end + +! Besides checking that the executable does not crash anymore, check +! that the cause has been remove. +! { dg-final { scan-tree-dump-not "c.caf.x = 0B" "original" } } +