[FORTRAN,25/29] Use stringpool on loading module symbols
diff mbox series

Message ID 20180905145732.404-26-rep.dot.nop@gmail.com
State New
Headers show
Series
  • [FORTRAN,01/29] gdbinit: break on gfc_internal_error
Related show

Commit Message

Bernhard Reutner-Fischer Sept. 5, 2018, 2:57 p.m. UTC
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(-)

Patch
diff mbox series

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;