From patchwork Sat Mar 2 16:54:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 224516 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]) by ozlabs.org (Postfix) with SMTP id 23B8E2C02C4 for ; Sun, 3 Mar 2013 03:55:51 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1362848152; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:From:To:Message-ID:In-Reply-To:References: User-Agent:Subject:Date:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=KrgaPZ/q6eOPA28UGzq4hAArTb0=; b=vzH9OXVvxjayZOj t/9UFtDME2EBFzgf5KpR7O/hNr4nz4ZD0rHw6pn3DzL6iXqGhBm3VieayY01EKBP u+quVKH3sOZ/ZXnuje7zHWRHx61jtnSMvhCOLzDrX0jjcWMZI6LhFs2u6zApvonQ 3/Fs4MP+rbs7Je7p+LX3T77oM50k= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:X-SFR-UUID:MIME-Version:From:To:Message-ID:In-Reply-To:References:User-Agent:Subject:Date:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=BojYOnh2SW5erHvHxQM39HurycYrDy+mRlH9o+tZ8bUOjUr7cXjh1e2nI1rgbp Gl/a4z5YsyJ+c9EsE73lt/271yTE+I7vWWsdvuKEk8j4/IP8JejgW+9qd3xHUrKO GgG1n84YygdUjieqOWFCoRQPelbJEAn0BKjgAP9J3Mx+Q=; Received: (qmail 12267 invoked by alias); 2 Mar 2013 16:54:41 -0000 Received: (qmail 12068 invoked by uid 22791); 2 Mar 2013 16:54:25 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp23.services.sfr.fr (HELO smtp23.services.sfr.fr) (93.17.128.20) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 02 Mar 2013 16:54:19 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2306.sfr.fr (SMTP Server) with ESMTP id 991EA70000B5; Sat, 2 Mar 2013 17:54:18 +0100 (CET) Received: from [192.168.1.58] (95.183.72.86.rev.sfr.net [86.72.183.95]) by msfrf2306.sfr.fr (SMTP Server) with ESMTP id 5F1BD70000AC; Sat, 2 Mar 2013 17:54:18 +0100 (CET) X-SFR-UUID: 20130302165418389.5F1BD70000AC@msfrf2306.sfr.fr MIME-Version: 1.0 From: Mikael Morin To: gfortran , GCC patches Message-ID: <20130302165418.10658.13936@marvin> In-Reply-To: <20130302165401.10658.5226@marvin> References: <20130302165401.10658.5226@marvin> User-Agent: patchspam.py Subject: [Patch, fortran] [3/4] C binding access to C_PTR type: don't do name lookup in gen_special_c_interop_ptr Date: Sat, 2 Mar 2013 17:54:18 +0100 (CET) X-IsSubscribed: yes 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 This patch fixes gen_special_c_interop_ptr, which uses gfc_find_symtree to retrieve the current symbol. Again, this is not safe to renaming and hiding, so this patch passes the symbol directly, instead of passing its name and retrieving the symbol from it. 2013-03-02 Mikael Morin * symbol.c (gen_special_c_interop_ptr): Retrieve symbol through argument instead of symbol name lookup. (generate_isocbinding_symbol): Update caller. diff --git a/symbol.c b/symbol.c index 646ca9d..b03d572 100644 --- a/symbol.c +++ b/symbol.c @@ -3811,25 +3811,12 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym) /* Generate symbols for the named constants c_null_ptr and c_null_funptr. */ static gfc_try -gen_special_c_interop_ptr (int ptr_id, const char *ptr_name, - const char *module_name) +gen_special_c_interop_ptr (int ptr_id, gfc_symbol *tmp_sym, + const char *module_name) { - gfc_symtree *tmp_symtree; - gfc_symbol *tmp_sym; gfc_constructor *c; iso_c_binding_symbol type_id; - tmp_symtree = gfc_find_symtree (gfc_current_ns->sym_root, ptr_name); - - if (tmp_symtree != NULL) - tmp_sym = tmp_symtree->n.sym; - else - { - tmp_sym = NULL; - gfc_internal_error ("gen_special_c_interop_ptr(): Unable to " - "create symbol for %s", ptr_name); - } - tmp_sym->ts.is_c_interop = 1; tmp_sym->attr.is_c_interop = 1; tmp_sym->ts.is_iso_c = 1; @@ -4507,8 +4494,8 @@ generate_isocbinding_symbol (const char *mod_name, iso_c_binding_symbol s, case ISOCBINDING_NULL_PTR: case ISOCBINDING_NULL_FUNPTR: - gen_special_c_interop_ptr (s, name, mod_name); - break; + gen_special_c_interop_ptr (s, tmp_sym, mod_name); + break; case ISOCBINDING_F_POINTER: case ISOCBINDING_ASSOCIATED: