This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, gfortran] Tidy up repeated symbols in .mod files (cf.patch for PR 16861)
- From: Paul Thomas <paulthomas2 at wanadoo dot fr>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: patch <gcc-patches at gcc dot gnu dot org>,"'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Sat, 17 Sep 2005 19:03:42 +0200
- Subject: Re: [Patch, gfortran] Tidy up repeated symbols in .mod files (cf.patch for PR 16861)
- References: <432BDA19.3060301@wanadoo.fr> <20050917142053.GA33182@troutmask.apl.washington.edu>
Steve,
<>
(1) I'm back for limited duties. :-)
(2) Your patch was short and simple. :-)
(3) Your email was at the bottom of queue. LIFO :-)
I actually didn't see the multiple symbols in a *.mod
as a problem, particularly if we will need to make
further bug fixes.
Equally, fixing it does no harm. Talking of further bugfixes, I am
working on a splendid one in read module. See the PS attachment.
There's a whole bunch of whitespace issues. It appears
Yes, sorry, I copied and pasted. This time the patch is attached.
that some tabs may have been convertes to spaces. But
the big problem is
../gcc41/gcc/fortran/module.c -o fortran/module.o
../../gcc41/gcc/fortran/module.c: In function 'mio_symtree_ref':
../../gcc41/gcc/fortran/module.c:2098: error: 'ns_st' undeclared (first use in this function)
../../gcc41/gcc/fortran/module.c:2098: error: (Each undeclared identifier is reported only once
../../gcc41/gcc/fortran/module.c:2098: error: for each function it appears in.)
Drat! The file against which I diffed still had the declaration in it.
My working version of module.c is several patches adrift of what I a
submitting. Please find attached the Real McCoy.
Paul
*** module.c 2005-09-17 18:40:46.152187656 +0200
--- gcc/gcc/fortran/module.c 2005-09-17 10:37:25.677929872 +0200
*************** mio_symtree_ref (gfc_symtree ** stp)
*** 2087,2096 ****
{
pointer_info *p;
fixup_t *f;
if (iomode == IO_OUTPUT)
{
! mio_symbol_ref (&(*stp)->n.sym);
}
else
{
--- 2087,2105 ----
{
pointer_info *p;
fixup_t *f;
+ gfc_symtree * ns_st = NULL;
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
{
! Promoting the USE statements in SUB2 to mymodule removes
! the segfault, as does using ANYTHING else for the dimension
! in the offending statement!
!
! Even wierder is that the commented out integer declarations
! make the rest compile and run OK.
!
! The crash occurs whilst running
!
! line 3281: while (load_needed (pi_root));
!
! The IC occurs because the search for needed symbols is turning
! up pointer_info nodes, that reference the derived type component
! that have neither symbol nor symtree.
!
! A "three piper" as Mr S Holmes would say.....
!
! { dg-do and-die }
!
MODULE foo
TYPE type1
INTEGER i1
END TYPE type1
! integer i_needed
END MODULE
MODULE bar
! integer j_needed
CONTAINS
SUBROUTINE sub1(x, y)
use foo
type (type1) :: x
integer :: y(x%i1)
END SUBROUTINE SUB1
END MODULE
module foobar
use foo
USE bar
integer k_needed
end module foobar
program use_foobar
use foo
use bar
! integer :: j(4) = 0
type (type1) :: z
z%i1 = 3
call sub1 (z, j)
print *, j
end program use_foobar