From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69975 invoked by alias); 5 Sep 2018 14:58:07 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 69094 invoked by uid 89); 5 Sep 2018 14:57:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Sep 2018 14:57:57 +0000 Received: by mail-wm0-f47.google.com with SMTP id n11-v6so8058312wmc.2; Wed, 05 Sep 2018 07:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Km9qYutJZlw4WSf7dRyyqcwsqJwwWx0VwSC1XKIZAHI=; b=rqLtWAukHdAFnKxo5jKaUg4HmrJT3h4N0W4yIl3/JMs+Lp5fZ4LH8Deo06zrlTwE0P NkHsyCZ13WBZPFM3Q3Cv4wPfWYe8ZG2rvr2xU1P5oy+r9dCNRO/Jx8AJeJbiWuqeb3S3 dCLZYBATYgBiX33E6vbcuJZ/zp/dZ+vX2SJcA6lvZopEBfVzCzQTEJFyH0RYiu0+WXee kSNSjiD/FgR/1V+hdcZE67dmVdbV/WjZzZoXRZyNF/wbbhiBhoUuSqD/BewluCQLS4VI zRLNCbfacY3EgqlemHq+vJCt8gpJX/vkVSuqwNFzaVvIGoqpgzL8A7dgbJakC3lXvGKj gPEA== Return-Path: Received: from s46.loc (91-119-125-11.dsl.dynamic.surfer.at. [91.119.125.11]) by smtp.gmail.com with ESMTPSA id b74-v6sm3706029wma.8.2018.09.05.07.57.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Sep 2018 07:57:51 -0700 (PDT) Received: from cow by s46.loc with local (Exim 4.91) (envelope-from ) id 1fxZFb-00008L-1u; Wed, 05 Sep 2018 14:57:47 +0000 From: Bernhard Reutner-Fischer To: fortran@gcc.gnu.org Cc: Bernhard Reutner-Fischer , gcc-patches@gcc.gnu.org Subject: [PATCH,FORTRAN 23/29] Use stringpool for module binding_label Date: Wed, 05 Sep 2018 14:58:00 -0000 Message-Id: <20180905145732.404-24-rep.dot.nop@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00035.txt.bz2 From: Bernhard Reutner-Fischer gcc/fortran/ChangeLog: 2017-11-28 Bernhard Reutner-Fischer * module.c (struct pointer_info): Change binding_label to const pointer. (free_pi_tree): Do not free binding_label. (load_commons): Use stringpool for binding_label. (load_needed): Likewise. (read_module): Likewise. --- gcc/fortran/module.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 24e48c94c76..8f6dc9f2864 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -158,7 +158,8 @@ typedef struct pointer_info struct { gfc_symbol *sym; - char *true_name, *module, *binding_label; + const char *binding_label; + char *true_name, *module; fixup_t *stfixup; gfc_symtree *symtree; enum gfc_rsym_state state; @@ -242,7 +243,6 @@ free_pi_tree (pointer_info *p) { XDELETEVEC (p->u.rsym.true_name); XDELETEVEC (p->u.rsym.module); - XDELETEVEC (p->u.rsym.binding_label); } free (p); @@ -4646,7 +4646,7 @@ load_commons (void) while (peek_atom () != ATOM_RPAREN) { int flags; - char* label; + const char* bind_label; mio_lparen (); mio_pool_string (&name); @@ -4663,10 +4663,9 @@ load_commons (void) /* Get whether this was a bind(c) common or not. */ mio_integer (&p->is_bind_c); /* Get the binding label. */ - label = read_string (); - if (strlen (label)) - p->binding_label = IDENTIFIER_POINTER (get_identifier (label)); - XDELETEVEC (label); + mio_pool_string (&bind_label); + if (bind_label) + p->binding_label = bind_label; mio_rparen (); } @@ -4899,8 +4898,7 @@ load_needed (pointer_info *p) sym->name = gfc_dt_lower_string (p->u.rsym.true_name); sym->module = gfc_get_string ("%s", p->u.rsym.module); if (p->u.rsym.binding_label) - sym->binding_label = IDENTIFIER_POINTER (get_identifier - (p->u.rsym.binding_label)); + sym->binding_label = p->u.rsym.binding_label; associate_integer_pointer (p, sym); } @@ -5052,7 +5050,7 @@ read_module (void) pointer_info *info, *q; gfc_use_rename *u = NULL; gfc_symtree *st; - gfc_symbol *sym; + gfc_symbol *sym = NULL; get_module_locus (&operator_interfaces); /* Skip these for now. */ skip_list (); @@ -5075,7 +5073,7 @@ read_module (void) while (peek_atom () != ATOM_RPAREN) { - char* bind_label; + const char* bind_label; require_atom (ATOM_INTEGER); info = get_integer (atom_int); @@ -5084,11 +5082,9 @@ read_module (void) info->u.rsym.true_name = read_string (); info->u.rsym.module = read_string (); - bind_label = read_string (); - if (strlen (bind_label)) + mio_pool_string (&bind_label); + if (bind_label) info->u.rsym.binding_label = bind_label; - else - XDELETEVEC (bind_label); require_atom (ATOM_INTEGER); info->u.rsym.ns = atom_int; @@ -5265,10 +5261,7 @@ read_module (void) sym->module = gfc_get_string ("%s", info->u.rsym.module); if (info->u.rsym.binding_label) - { - tree id = get_identifier (info->u.rsym.binding_label); - sym->binding_label = IDENTIFIER_POINTER (id); - } + sym->binding_label = info->u.rsym.binding_label; } st->n.sym = sym; -- 2.19.0.rc1