On Tue, Dec 11, 2012 at 1:37 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> So, what about this version instead? > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2012-12-11 Jakub Jelinek <ja...@redhat.com> > Janus Weil <ja...@gcc.gnu.org> > > PR fortran/55636 > * gfortran.h (GFC_PREFIX): Define. > * trans-decl.c (gfc_create_string_length): For VAR_DECLs that > will be TREE_STATIC, use GFC_PREFIX to mangle the names. > > --- gcc/fortran/gfortran.h.jj 2012-12-04 14:17:30.574177056 +0100 > +++ gcc/fortran/gfortran.h 2012-12-11 15:48:37.967422227 +0100 > @@ -63,6 +63,15 @@ along with GCC; see the file COPYING3. > #define PREFIX(x) "_gfortran_" x > #define PREFIX_LEN 10 > > +/* A prefix for internal variables, which are not user-visible. */ > +#if !defined (NO_DOT_IN_LABEL) > +# define GFC_PREFIX(x) "_F." x > +#elif !defined (NO_DOLLAR_IN_LABEL) > +# define GFC_PREFIX(x) "_F$" x > +#else > +# define GFC_PREFIX(x) "_F_" x > +#endif > + > #define BLANK_COMMON_NAME "__BLNK__" > > /* Macro to initialize an mstring structure. */ > --- gcc/fortran/trans-decl.c.jj 2012-12-11 09:25:18.757189184 +0100 > +++ gcc/fortran/trans-decl.c 2012-12-11 15:50:13.487857146 +0100 > @@ -1090,7 +1090,15 @@ gfc_create_string_length (gfc_symbol * s > const char *name; > > /* Also prefix the mangled name. */ > - if (sym->module) > + if (sym->attr.save || sym->ns->proc_name->attr.flavor == FL_MODULE) > + { > + if (sym->module) > + name = gfc_get_string (GFC_PREFIX ("%s_MOD_%s"), sym->module, > + sym->name); > + else > + name = gfc_get_string (GFC_PREFIX ("%s"), sym->name); > + } > + else if (sym->module) > name = gfc_get_string (".__%s_MOD_%s", sym->module, sym->name); > else > name = gfc_get_string (".%s", sym->name); Why are you only correcting the prefix for attr.save or FL_MODULE? Why leave the dot name in the other cases? Thanks, David