From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26844 invoked by alias); 3 Jan 2015 22:30:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 26815 invoked by uid 89); 3 Jan 2015 22:30:17 -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 autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: outpost5.zedat.fu-berlin.de Received: from outpost5.zedat.fu-berlin.de (HELO outpost5.zedat.fu-berlin.de) (130.133.4.89) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 03 Jan 2015 22:30:16 +0000 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by outpost.zedat.fu-berlin.de (Exim 4.82) with esmtp (envelope-from ) id <1Y7XD3-000NTW-5w>; Sat, 03 Jan 2015 23:30:13 +0100 Received: from squeeze64.physik.fu-berlin.de ([160.45.66.239] helo=tux.net-b.de) by relay1.zedat.fu-berlin.de (Exim 4.82) with esmtp (envelope-from ) id <1Y7XD2-003eXM-7t>; Sat, 03 Jan 2015 23:30:13 +0100 Message-ID: <54A86D6A.2030101@net-b.de> Date: Sat, 03 Jan 2015 22:30:00 -0000 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: =?windows-1252?Q?Dominique_d=27Humi=E8res?= CC: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org, fxcoudert@gmail.com Subject: Re: [Patch, Fortran + Testsuite] Fix coarray handling in modules References: <20150103102245.BAB57105@mailhost.lps.ens.fr> <54A855FB.3050207@net-b.de> In-Reply-To: Content-Type: multipart/mixed; boundary="------------080305040902090101090403" X-SW-Source: 2015-01/txt/msg00073.txt.bz2 This is a multi-part message in MIME format. --------------080305040902090101090403 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-length: 309 Dominique d'Humières wrote: > From a quick test, with the patch I still see the error with -m32 It helps if one actually adds the decl. The following (still untested) should help. I also marked the token as nonaliasing (it really should!) and added for proc pointers the tree-public optimization. Tobias --------------080305040902090101090403 Content-Type: text/x-patch; name="foo.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="foo.diff" Content-length: 1722 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 9ef6bfc..976db2b 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -830,15 +830,32 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) IDENTIFIER_POINTER (gfc_sym_mangled_identifier (sym)))); token = build_decl (DECL_SOURCE_LOCATION (decl), VAR_DECL, token_name, token_type); - TREE_PUBLIC (token) = 1; + if (sym->attr.use_assoc) + DECL_EXTERNAL (token) = 1; + else + TREE_STATIC (token) = 1; + + if (sym->attr.use_assoc || sym->attr.access != ACCESS_PRIVATE || + sym->attr.public_used) + TREE_PUBLIC (token) = 1; } else - token = gfc_create_var_np (token_type, "caf_token"); + { + token = gfc_create_var_np (token_type, "caf_token"); + TREE_STATIC (token) = 1; + } GFC_TYPE_ARRAY_CAF_TOKEN (type) = token; DECL_ARTIFICIAL (token) = 1; - TREE_STATIC (token) = 1; - gfc_add_decl_to_function (token); + DECL_NONALIASED (token) = 1; + + if (sym->module && !sym->attr.use_assoc) + { + DECL_CONTEXT (token) = sym->ns->proc_name->backend_decl; + gfc_module_add_decl (cur_module, token); + } + else + gfc_add_decl_to_function (token); } for (dim = 0; dim < GFC_TYPE_ARRAY_RANK (type); dim++) @@ -1664,7 +1681,9 @@ get_proc_pointer_decl (gfc_symbol *sym) else if (sym->module && sym->ns->proc_name->attr.flavor == FL_MODULE) { /* This is the declaration of a module variable. */ - TREE_PUBLIC (decl) = 1; + if (sym->ns->proc_name->attr.flavor == FL_MODULE + && (sym->attr.access != ACCESS_PRIVATE || sym->attr.public_used)) + TREE_PUBLIC (decl) = 1; TREE_STATIC (decl) = 1; } --------------080305040902090101090403--