aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2010-05-26 05:11:04 +0000
committerPaul Thomas <pault@gcc.gnu.org>2010-05-26 05:11:04 +0000
commitcc9a4ca9331ad603c930616c7d5700b5b56dc82b (patch)
tree87a9d3162eb4029d9950ddcf9eb6a94a7bb4c09f /gcc/fortran/resolve.c
parent1515fb61593745442a3c99552d0136320fce2a6a (diff)
downloadgcc-cc9a4ca9331ad603c930616c7d5700b5b56dc82b.zip
gcc-cc9a4ca9331ad603c930616c7d5700b5b56dc82b.tar.gz
gcc-cc9a4ca9331ad603c930616c7d5700b5b56dc82b.tar.bz2
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
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index f2c2440..1538ea0 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -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