From: Bernhard Reutner-Fischer <al...@gcc.gnu.org>

2017-10-26  Bernhard Reutner-Fischer  <al...@gcc.gnu.org>

        * gfortran.h (struct gfc_association_list): Change name to
        pointer.
        * match.c (gfc_match_associate): Adjust.
---
 gcc/fortran/gfortran.h | 2 +-
 gcc/fortran/match.c    | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 774a6de6168..ff42b39b453 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2482,7 +2482,7 @@ typedef struct gfc_association_list
   /* True when the rank of the target expression is guessed during parsing.  */
   unsigned rankguessed:1;
 
-  char name[GFC_MAX_SYMBOL_LEN + 1];
+  const char *name;
   gfc_symtree *st; /* Symtree corresponding to name.  */
   locus where;
 
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 1b03e7251a5..38827ed4637 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1891,8 +1891,7 @@ gfc_match_associate (void)
       gfc_association_list* a;
 
       /* Match the next association.  */
-      const char *name_hack = NULL;
-      if (gfc_match (" %n =>", &name_hack) != MATCH_YES)
+      if (gfc_match (" %n =>", &newAssoc->name) != MATCH_YES)
        {
          gfc_error ("Expected association at %C");
          goto assocListError;
@@ -1909,12 +1908,11 @@ gfc_match_associate (void)
            }
          gfc_matching_procptr_assignment = 0;
        }
-      strcpy (newAssoc->name, name_hack);
       newAssoc->where = gfc_current_locus;
 
       /* Check that the current name is not yet in the list.  */
       for (a = new_st.ext.block.assoc; a; a = a->next)
-       if (!strcmp (a->name, newAssoc->name))
+       if (a->name == newAssoc->name)
          {
            gfc_error ("Duplicate name %qs in association at %C",
                       newAssoc->name);
-- 
2.19.0.rc1

Reply via email to