re PR fortran/40011 (Problems with -fwhole-file)

2010-05-26  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40011
	* resolve.c (resolve_global_procedure): Resolve the gsymbol's
	namespace before trying to reorder the gsymbols.

2010-05-26  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40011
	* gfortran.dg/whole_file_19.f90 : New test.

From-SVN: r159852
This commit is contained in:
Paul Thomas 2010-05-26 05:11:04 +00:00
parent 1515fb6159
commit cc9a4ca933
4 changed files with 51 additions and 14 deletions

View File

@ -1,3 +1,9 @@
2010-05-26 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40011
* resolve.c (resolve_global_procedure): Resolve the gsymbol's
namespace before trying to reorder the gsymbols.
2010-05-25 Daniel Franke <franke.daniel@gmail.com>
PR fortran/30668

View File

@ -1824,20 +1824,7 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
&& not_in_recursive (sym, gsym->ns)
&& not_entry_self_reference (sym, gsym->ns))
{
/* Make sure that translation for the gsymbol occurs before
the procedure currently being resolved. */
ns = gsym->ns->resolved ? NULL : gfc_global_ns_list;
for (; ns && ns != gsym->ns; ns = ns->sibling)
{
if (ns->sibling == gsym->ns)
{
ns->sibling = gsym->ns->sibling;
gsym->ns->sibling = gfc_global_ns_list;
gfc_global_ns_list = gsym->ns;
break;
}
}
/* Resolve the gsymbol namespace if needed. */
if (!gsym->ns->resolved)
{
gfc_dt_list *old_dt_list;
@ -1857,6 +1844,20 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
gfc_derived_types = old_dt_list;
}
/* Make sure that translation for the gsymbol occurs before
the procedure currently being resolved. */
ns = gfc_global_ns_list;
for (; ns && ns != gsym->ns; ns = ns->sibling)
{
if (ns->sibling == gsym->ns)
{
ns->sibling = gsym->ns->sibling;
gsym->ns->sibling = gfc_global_ns_list;
gfc_global_ns_list = gsym->ns;
break;
}
}
if (gsym->ns->proc_name->attr.function
&& gsym->ns->proc_name->as
&& gsym->ns->proc_name->as->rank

View File

@ -1,3 +1,8 @@
2010-05-26 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40011
* gfortran.dg/whole_file_19.f90 : New test.
2010-05-25 Daniel Franke <franke.daniel@gmail.com>
PR fortran/30668

View File

@ -0,0 +1,25 @@
! { dg-do compile }
! { dg-options "-fwhole-file" }
! Test the fix for pr40011 comment #42, in which the subroutine
! would just get lost with -fwhole-file.
!
! Contributed by Joost VandeVandole <jv244@cam.ac.uk>
!
SUBROUTINE c()
CALL a()
END SUBROUTINE c
SUBROUTINE a()
END SUBROUTINE a
MODULE M
CONTAINS
SUBROUTINE b()
CALL c()
END SUBROUTINE
END MODULE
USE M
CALL b()
END
! { dg-final { cleanup-modules "m" } }