This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH,FORTRAN 25/29] Use stringpool on loading module symbols
- From: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Bernhard Reutner-Fischer <aldot at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 5 Sep 2018 14:57:28 +0000
- Subject: [PATCH,FORTRAN 25/29] Use stringpool on loading module symbols
- References: <CAC1BbcSJmqmQW7Zuv+6UQu0znbsVm85i3gP_y4Dny3czMCANgA@mail.gmail.com>
From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
gcc/fortran/ChangeLog:
2017-11-29 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
* module.c (load_needed): Use stringpool when generating symbols
and module names.
---
gcc/fortran/module.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 8f6dc9f2864..ebfcd62801d 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4857,6 +4857,7 @@ load_needed (pointer_info *p)
pointer_info *q;
gfc_symbol *sym;
int rv;
+ const char *true_name, *module;
rv = 0;
if (p == NULL)
@@ -4888,15 +4889,21 @@ load_needed (pointer_info *p)
associate_integer_pointer (q, ns);
}
+ true_name = p->u.rsym.true_name;
+ if (true_name[0] != '\0')
+ true_name = gfc_get_string ("%s", true_name);
+ module = p->u.rsym.module;
+ if (module[0] != '\0')
+ module = gfc_get_string ("%s", module);
+
/* Use the module sym as 'proc_name' so that gfc_get_symbol_decl
doesn't go pear-shaped if the symbol is used. */
if (!ns->proc_name)
- gfc_find_symbol (p->u.rsym.module, gfc_current_ns,
- 1, &ns->proc_name);
+ gfc_find_symbol (module, gfc_current_ns, 1, &ns->proc_name);
- sym = gfc_new_symbol (p->u.rsym.true_name, ns);
- sym->name = gfc_dt_lower_string (p->u.rsym.true_name);
- sym->module = gfc_get_string ("%s", p->u.rsym.module);
+ sym = gfc_new_symbol (true_name, ns);
+ sym->name = gfc_dt_lower_string (true_name);
+ sym->module = module;
if (p->u.rsym.binding_label)
sym->binding_label = p->u.rsym.binding_label;
--
2.19.0.rc1