This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfotran] Use string pool for names of global symbols
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: patch <gcc-patches at gcc dot gnu dot org>,GCC Fortran mailing list <fortran at gcc dot gnu dot org>
- Date: Thu, 28 Apr 2005 23:07:43 +0200
- Subject: [gfotran] Use string pool for names of global symbols
This patch adds the names of global symbols to the string pool instead of
allocating them inside the gfc_gsymbol structure. This was an oversight in
the original string pool patch.
Bubblestrapped and regtested. Committed to the mainline under the obviously
correct rule.
I'll have a go at backporting stuff to 4.0 tomorrow, and I will just include
it in the bunch there.
- Tobi
2005-04-28 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.h (gfc_gsymbol): Make name a const char *.
* symbol.c (gfc_get_gsymbol): Allocate gsymbol name via
gfc_get_string.
Index: gfortran.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/gfortran.h,v
retrieving revision 1.65
diff -u -p -r1.65 gfortran.h
--- gfortran.h 15 Apr 2005 20:35:26 -0000 1.65
+++ gfortran.h 28 Apr 2005 20:30:18 -0000
@@ -842,7 +842,7 @@ typedef struct gfc_gsymbol
{
BBT_HEADER(gfc_gsymbol);
- char name[GFC_MAX_SYMBOL_LEN+1];
+ const char *name;
enum { GSYM_UNKNOWN=1, GSYM_PROGRAM, GSYM_FUNCTION, GSYM_SUBROUTINE,
GSYM_MODULE, GSYM_COMMON, GSYM_BLOCK_DATA } type;
Index: symbol.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/symbol.c,v
retrieving revision 1.27
diff -u -p -r1.27 symbol.c
--- symbol.c 14 Mar 2005 19:54:59 -0000 1.27
+++ symbol.c 28 Apr 2005 20:30:18 -0000
@@ -2410,7 +2410,7 @@ gfc_get_gsymbol (const char *name)
s = gfc_getmem (sizeof (gfc_gsymbol));
s->type = GSYM_UNKNOWN;
- strcpy (s->name, name);
+ s->name = gfc_get_string (name);
gfc_insert_bbt (&gfc_gsym_root, s, gsym_compare);