From patchwork Wed May 20 08:24:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 474216 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 AA90A14027F for ; Wed, 20 May 2015 18:24:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=wZ1H4R2W; 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:content-transfer-encoding; q=dns; s= default; b=UuWPoQkxw/UjK8GZJx3BStCG5BV80ZqImCuenwT/FhmPkHZQ3cgp+ dMtisT0SH9MItutdp+WHF4VU0E9qfNABPR78JrjtQTX1ay1YPPWiKCLrAolvmuAE DfTX7WrOM1jIXRxpkwaZhl6P76KXtQlsgVtfRO09uxzsZQdaT86Ohw= 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:content-transfer-encoding; s=default; bh=Sz+xFQe62RzSa+gbrnCUV+h5arw=; b=wZ1H4R2Wwfo7K6oOcjz7ZDRkTcCp 3VVzZJ/e8qHTG1wskWx9VG0KX5nrXczO5hH7cUnFLJ/MLJCq0i5kGUaJry0L9n4x /GZixLmREU9EzB+Bv6w72XGD09pn2/tU5AXkWw95q+ApNM8plpBxvh2ZrjIMtTmh BXIObf5Xw1b/3aw= Received: (qmail 101813 invoked by alias); 20 May 2015 08:24:46 -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 101795 invoked by uid 89); 20 May 2015 08:24:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.15.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 20 May 2015 08:24:44 +0000 Received: from vepi2 ([88.75.104.20]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0M3AzH-1ZCNX50uG7-00swhH; Wed, 20 May 2015 10:24:40 +0200 Date: Wed, 20 May 2015 10:24:39 +0200 From: Andre Vehreschild To: Mikael Morin Cc: GCC-Patches-ML , GCC-Fortran-ML Subject: Re: [Patch, fortran, pr65548, 2nd take, v5] [5/6 Regression] gfc_conv_procedure_call Message-ID: <20150520102439.0aa1ce5c@vepi2> In-Reply-To: <555B426A.8030803@sfr.fr> References: <20150325143554.0343a7a7@vepi2> <20150402122830.4153db9b@vepi2> <551DD96F.2050706@charter.net> <20150407161152.22629ff5@vepi2> <20150429143101.1aa5d0b4@gmx.de> <20150430150728.17a76373@gmx.de> <55527874.1070602@sfr.fr> <20150513111230.73ec0ab0@gmx.de> <20150514114317.3a3efc89@vepi2> <20150519105016.782a642d@vepi2> <555B426A.8030803@sfr.fr> MIME-Version: 1.0 X-UI-Out-Filterresults: notjunk:1; Hi Mikael, when I got you right on IRC, then you proposed this change about the pointer attribute: This patch bootstraps and regtests fine again. Ok to commit? Regards, Andre On Tue, 19 May 2015 16:02:18 +0200 Mikael Morin wrote: > Le 19/05/2015 10:50, Andre Vehreschild a écrit : > > Hi all, > > > > find attached latest version to fix 65548. > > > > Bootstraps and regtests ok on x86_64-linux-gnu/f21. > > > OK. Thanks. > > Mikael diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 6d565ae..545f778 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -5361,6 +5361,7 @@ gfc_trans_allocate (gfc_code * code) /* Mark the symbol referenced or gfc_trans_assignment will bug. */ newsym->n.sym->attr.referenced = 1; + newsym->n.sym->attr.pointer = 1; e3rhs->expr_type = EXPR_VARIABLE; /* Set the symbols type, upto it was BT_UNKNOWN. */ newsym->n.sym->ts = e3rhs->ts; @@ -5374,7 +5375,6 @@ gfc_trans_allocate (gfc_code * code) /* Set the dimension and pointer attribute for arrays to be on the safe side. */ newsym->n.sym->attr.dimension = 1; - newsym->n.sym->attr.pointer = 1; newsym->n.sym->as = arr; gfc_add_full_array_ref (e3rhs, arr); } Unfortunately does this lead to numerous regressions in the testsuite. For example: ./gfortran.sh -g allocate_alloc_opt_6.f90 -o allocate_alloc_opt_6 Fortraning using ***DEVelopment*** version... allocate_alloc_opt_6.f90:26:0: allocate(t, source=mytype(1.0,2)) ^ internal compiler error: Segmentation fault 0xe09a08 crash_signal /home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/toplev.c:380 0xa9cbe1 useless_type_conversion_p(tree_node*, tree_node*) /home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/gimple-expr.c:83 0x10622ae tree_ssa_useless_type_conversion(tree_node*) /home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/tree-ssa.c:1178 0x10622fe tree_ssa_strip_useless_type_conversions(tree_node*) /home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/tree-ssa.c:1190 0xb6c4ae gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) /home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/gimplify.c:7815 0xb5e883 gimplify_modify_expr /home/vehre/Projekte/c_gcc_fortran2003_enhancements_cmbant_freelancer//gcc/gcc/gimplify.c:4644 I therefore came to a more elaborate change (revert the above one before testing this): diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 6d565ae..7b466de 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -5378,6 +5378,10 @@ gfc_trans_allocate (gfc_code * code) newsym->n.sym->as = arr; gfc_add_full_array_ref (e3rhs, arr); } + else if (POINTER_TYPE_P (TREE_TYPE (expr3))) + newsym->n.sym->attr.pointer = 1; + else + newsym->n.sym->attr.value = 1; /* The string length is known to. Set it for char arrays. */ if (e3rhs->ts.type == BT_CHARACTER) newsym->n.sym->ts.u.cl->backend_decl = expr3_len;