This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] PR15986 contained procedures as actual args


The patch below fixes PR15986. Sibling functions used as actual arguments 
weren't getting fixed up properly because they look like variables while 
parsing.

Tested on i686-linux. Applied to mainline.

Paul

2004-07-11  Paul Brook  <paul@codesourcery.com>

	PR fortran/15986
	* parse.c (gfc_fixup_sibling_symbols): Also look for untyped
	variables.
	(parse_contained): Mark contained symbols as referenced.
testsuite/
	* gfortran.dg/contained_1.f90: New test.

Index: parse.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/fortran/parse.c,v
retrieving revision 1.12
diff -u -p -r1.12 parse.c
--- parse.c	10 Jul 2004 21:52:20 -0000	1.12
+++ parse.c	11 Jul 2004 21:40:32 -0000
@@ -2116,7 +2116,9 @@ gfc_fixup_sibling_symbols (gfc_symbol * 
         continue;
 
       old_sym = st->n.sym;
-      if (old_sym->attr.flavor == FL_PROCEDURE && old_sym->ns == ns
+      if ((old_sym->attr.flavor == FL_PROCEDURE
+	   || old_sym->ts.type == BT_UNKNOWN)
+	  && old_sym->ns == ns
           && ! old_sym->attr.contained)
         {
           /* Replace it with the symbol from the parent namespace.  */
@@ -2199,6 +2201,7 @@ parse_contained (int module)
           /* Mark this as a contained function, so it isn't replaced
              by other module functions.  */
           sym->attr.contained = 1;
+	  sym->attr.referenced = 1;
 
           /* Fix up any sibling functions that refer to this one.  */
           gfc_fixup_sibling_symbols (sym, gfc_current_ns);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]