This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, gfortran] Tidy up repeated symbols in .mod files (cf. patchfor PR 16861)


:ADDPATCH fortran:

Steve,

Thanks for clearing http://gcc.gnu.org/ml/fortran/2005-09/msg00316.html so quickly. I'll commit it this afternoon.

As mentioned in the above, such indices for contained assumed shape arrays cause multiple entries of the same symbol
in .mod files, when the reference to the index is resolved with a use associated symbol. The patch below cures this
"problem"(ie. nothing is broken) by eliminating extraneous symbol entries. The comment speaks for itself.


read_module was already capable of dealing with the resulting streamlined .mod files, as a bit of judicious editing
of the file foobar.mod from nested_modules_2.f90 will demonstrate.


Regtested on FC3/Athlon 1700.

OK for mainline and 4.03, when open?

Paul T

===================================================================

2005-09-15 Paul Thomas <pault@gcc.gnu.org>

   PR fortran/16861
   * module.c (mio_symtree_ref): Resolve "unique" symbol reference
   as soon as a corresponding symbol is available in the main
   namespace.


*** module.c 2005-09-17 10:54:31.743944128 +0200 --- gcc/gcc/fortran/module.c 2005-09-17 10:37:25.677929872 +0200 *************** mio_symtree_ref (gfc_symtree ** stp) *** 2091,2097 ****

   if (iomode == IO_OUTPUT)
     {
!       mio_symbol_ref (&(*stp)->n.sym);
     }
   else
     {
--- 2091,2105 ----

   if (iomode == IO_OUTPUT)
     {
!       /* If this is a symtree for a symbol that came from a contained
!      module namespace, it has a "unique" name and we should look in
!      the current namespace to see if the required, non-contained
!      symbol is available yet.  */
!       if ((*stp)->n.sym && check_unique_name((*stp)->name))
!     ns_st = gfc_find_symtree (gfc_current_ns->sym_root,
!                   (*stp)->n.sym->name);
!
!       mio_symbol_ref (ns_st ? &ns_st->n.sym : &(*stp)->n.sym);
     }
   else
     {



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]