[Patch, fortran] PR37597 - internal procedure fails to access host-associated module procedure
Paul Richard Thomas
paul.richard.thomas@gmail.com
Tue Nov 4 21:21:00 GMT 2008
Bootstrapped and regtested on FC9/x86_i64 - committed as 'obvious'.
In fact, this is just plain and simple an error, which I'll fix on 4.3
in a week.
Cheers
Paul
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (revision 141587)
+++ gcc/fortran/ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2008-11-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/37597
+ * parse.c (gfc_fixup_sibling_symbols ): Fixup contained, even
+ when symbol not found.
+
2008-11-03 Tobias Burnus <burnus@net-b.de>
PR fortran/37821
Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c (revision 141587)
+++ gcc/fortran/parse.c (working copy)
@@ -3313,7 +3313,7 @@
gfc_find_sym_tree (sym->name, ns, 0, &st);
if (!st || (st->n.sym->attr.dummy && ns == st->n.sym->ns))
- continue;
+ goto fixup_contained;
old_sym = st->n.sym;
if (old_sym->ns == ns
@@ -3347,6 +3347,7 @@
gfc_free_symbol (old_sym);
}
+fixup_contained:
/* Do the same for any contained procedures. */
gfc_fixup_sibling_symbols (sym, ns->contained);
}
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (revision 141587)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2008-11-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/37597
+ * gfortran.dg/host_assoc_call_5.f90: New test.
+
2008-11-04 Jakub Jelinek <jakub@redhat.com>
Andrew Pinski <andrew_pinski@playstation.sony.com>
Index: gcc/testsuite/gfortran.dg/host_assoc_call_5.f90
===================================================================
--- gcc/testsuite/gfortran.dg/host_assoc_call_5.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/host_assoc_call_5.f90 (revision 0)
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! Tests the fix for PR37597, where the reference to other_sub would generate
+! Error: Symbol 'other_sub' at (1) has no IMPLICIT type.
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+! from a report on clf by Rich Townsend <rhdt@barvoidtol.udel.edu>
+!
+module foo
+ implicit none
+contains
+ subroutine main_sub ()
+ call internal_sub()
+ contains
+ subroutine internal_sub()
+ call QAG(other_sub)
+ end subroutine internal_sub
+ end subroutine main_sub
+ subroutine other_sub ()
+ end subroutine other_sub
+end module foo
+! { dg-final { cleanup-modules "foo" } }
More information about the Gcc-patches
mailing list