re PR fortran/34672 (.mod file misses renamed, USEd symbol)
2008-01-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/34672 * module.c (write_generic): Rewrite completely. (write_module): Change call to write_generic. 2008-01-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/34672 * gfortran.dg/use_only_2.f90: New test. From-SVN: r131377
This commit is contained in:
parent
b61ea03d2d
commit
3a7b9fdaf6
4 changed files with 56 additions and 20 deletions
|
@ -1,3 +1,9 @@
|
|||
2008-01-07 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/34672
|
||||
* module.c (write_generic): Rewrite completely.
|
||||
(write_module): Change call to write_generic.
|
||||
|
||||
2008-01-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR fortran/34659
|
||||
|
|
|
@ -4176,13 +4176,22 @@ write_operator (gfc_user_op *uop)
|
|||
}
|
||||
|
||||
|
||||
/* Write generic interfaces associated with a symbol. */
|
||||
/* Write generic interfaces from the namespace sym_root. */
|
||||
|
||||
static void
|
||||
write_generic (gfc_symbol *sym)
|
||||
write_generic (gfc_symtree *st)
|
||||
{
|
||||
const char *p;
|
||||
int nuse, j;
|
||||
gfc_symbol *sym;
|
||||
|
||||
if (st == NULL)
|
||||
return;
|
||||
|
||||
write_generic (st->left);
|
||||
write_generic (st->right);
|
||||
|
||||
sym = st->n.sym;
|
||||
if (!sym || check_unique_name (st->name))
|
||||
return;
|
||||
|
||||
if (sym->generic == NULL
|
||||
|| !gfc_check_access (sym->attr.access, sym->ns->default_access))
|
||||
|
@ -4191,21 +4200,7 @@ write_generic (gfc_symbol *sym)
|
|||
if (sym->module == NULL)
|
||||
sym->module = gfc_get_string (module_name);
|
||||
|
||||
/* See how many use names there are. If none, use the symbol name. */
|
||||
nuse = number_use_names (sym->name, false);
|
||||
if (nuse == 0)
|
||||
{
|
||||
mio_symbol_interface (&sym->name, &sym->module, &sym->generic);
|
||||
return;
|
||||
}
|
||||
|
||||
for (j = 1; j <= nuse; j++)
|
||||
{
|
||||
/* Get the jth local name for this symbol. */
|
||||
p = find_use_name_n (sym->name, &j, false);
|
||||
|
||||
mio_symbol_interface (&p, &sym->module, &sym->generic);
|
||||
}
|
||||
mio_symbol_interface (&st->name, &sym->module, &sym->generic);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4263,7 +4258,7 @@ write_module (void)
|
|||
write_char ('\n');
|
||||
|
||||
mio_lparen ();
|
||||
gfc_traverse_ns (gfc_current_ns, write_generic);
|
||||
write_generic (gfc_current_ns->sym_root);
|
||||
mio_rparen ();
|
||||
write_char ('\n');
|
||||
write_char ('\n');
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2008-01-07 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/34672
|
||||
* gfortran.dg/use_only_2.f90: New test.
|
||||
|
||||
2008-01-06 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
PR libstdc++/34680
|
||||
|
|
30
gcc/testsuite/gfortran.dg/use_only_2.f90
Normal file
30
gcc/testsuite/gfortran.dg/use_only_2.f90
Normal file
|
@ -0,0 +1,30 @@
|
|||
! { dg-do compile }
|
||||
! Checks the fix for PR34672, in which generic interfaces were not
|
||||
! being written correctly, when renamed.
|
||||
!
|
||||
! Contributed by Jos de Kloe <kloedej@knmi.nl>
|
||||
!
|
||||
MODULE MyMod1
|
||||
integer, parameter :: i2_ = Selected_Int_Kind(4)
|
||||
END Module MyMod1
|
||||
|
||||
module MyMod2
|
||||
INTERFACE write_int
|
||||
module procedure write_int_local
|
||||
END INTERFACE
|
||||
contains
|
||||
subroutine write_int_local(value)
|
||||
integer, intent(in) :: value
|
||||
print *,value
|
||||
end subroutine write_int_local
|
||||
end module MyMod2
|
||||
|
||||
module MyMod3
|
||||
USE MyMod2, only: write_MyInt => write_int
|
||||
USE MyMod1, only: i2_
|
||||
end module MyMod3
|
||||
|
||||
module MyMod4
|
||||
USE MyMod3, only: write_MyInt
|
||||
end module MYMOD4
|
||||
! { dg-final { cleanup-modules "MyMod1 MyMod2 MyMod3 MyMod4" } }
|
Loading…
Add table
Reference in a new issue