[FORTRAN,21/29] Use stringpool for module tbp
diff mbox series

Message ID 20180905145732.404-22-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>

Switch type bound procedures to use the stringpool.

gcc/fortran/ChangeLog:

2017-11-24  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	* decl.c (gfc_match_decl_type_spec): Use stringpool.
	* module.c (mio_expr): Likewise.
	(mio_typebound_proc): Likewise.
	(mio_full_typebound_tree): Likewise.
	(mio_omp_udr_expr): Likewise.
---
 gcc/fortran/decl.c   |  9 +++++----
 gcc/fortran/module.c | 24 ++++++++++++------------
 2 files changed, 17 insertions(+), 16 deletions(-)

Patch
diff mbox series

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index d6a6538f769..cc14a871dfd 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -4049,12 +4049,13 @@  gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
 	{
 	  gfc_symbol *upe;
 	  gfc_symtree *st;
+	  const char *star_name = gfc_get_string ("%s", "STAR");
 	  ts->type = BT_CLASS;
-	  gfc_find_symbol ("STAR", gfc_current_ns, 1, &upe);
+	  gfc_find_symbol (star_name, gfc_current_ns, 1, &upe);
 	  if (upe == NULL)
 	    {
-	      upe = gfc_new_symbol ("STAR", gfc_current_ns);
-	      st = gfc_new_symtree (&gfc_current_ns->sym_root, "STAR");
+	      upe = gfc_new_symbol (star_name, gfc_current_ns);
+	      st = gfc_new_symtree (&gfc_current_ns->sym_root, star_name);
 	      st->n.sym = upe;
 	      gfc_set_sym_referenced (upe);
 	      upe->refs++;
@@ -4069,7 +4070,7 @@  gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
 	    }
 	  else
 	    {
-	      st = gfc_get_tbp_symtree (&gfc_current_ns->sym_root, "STAR");
+	      st = gfc_get_tbp_symtree (&gfc_current_ns->sym_root, star_name);
 	      st->n.sym = upe;
 	      upe->refs++;
 	    }
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 3b644234921..24e48c94c76 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3585,9 +3585,9 @@  mio_expr (gfc_expr **ep)
 	    case 3:
 	      break;
 	    default:
-	      require_atom (ATOM_STRING);
-	      e->value.function.isym = gfc_find_function (atom_string);
-	      free (atom_string);
+	      const char *name;
+	      mio_pool_string (&name);
+	      e->value.function.isym = gfc_find_function (name);
 	    }
 	}
 
@@ -3872,6 +3872,7 @@  mio_typebound_proc (gfc_typebound_proc** proc)
 	  while (peek_atom () != ATOM_RPAREN)
 	    {
 	      gfc_symtree** sym_root;
+	      const char *name;
 
 	      g = gfc_get_tbp_generic ();
 	      g->specific = NULL;
@@ -3879,10 +3880,9 @@  mio_typebound_proc (gfc_typebound_proc** proc)
 	      mio_integer (&iop);
 	      g->is_operator = (bool) iop;
 
-	      require_atom (ATOM_STRING);
+	      mio_pool_string (&name);
 	      sym_root = &current_f2k_derived->tb_sym_root;
-	      g->specific_st = gfc_get_tbp_symtree (sym_root, atom_string);
-	      free (atom_string);
+	      g->specific_st = gfc_get_tbp_symtree (sym_root, name);
 
 	      g->next = (*proc)->u.generic;
 	      (*proc)->u.generic = g;
@@ -3928,12 +3928,12 @@  mio_full_typebound_tree (gfc_symtree** root)
       while (peek_atom () == ATOM_LPAREN)
 	{
 	  gfc_symtree* st;
+	  const char *name;
 
 	  mio_lparen ();
 
-	  require_atom (ATOM_STRING);
-	  st = gfc_get_tbp_symtree (root, atom_string);
-	  free (atom_string);
+	  mio_pool_string (&name);
+	  st = gfc_get_tbp_symtree (root, name);
 
 	  mio_typebound_symtree (st);
 	}
@@ -4267,9 +4267,9 @@  mio_omp_udr_expr (gfc_omp_udr *udr, gfc_symbol **sym1, gfc_symbol **sym2,
 	  mio_integer (&flag);
 	  if (flag)
 	    {
-	      require_atom (ATOM_STRING);
-	      ns->code->resolved_isym = gfc_find_subroutine (atom_string);
-	      free (atom_string);
+	      const char *name;
+	      mio_pool_string (&name);
+	      ns->code->resolved_isym = gfc_find_subroutine (name);
 	    }
 	  else
 	    mio_symbol_ref (&ns->code->resolved_sym);