This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[patch, fortran] PR32710 - ICE: namelist and subroutine with the same name


:ADDPATCH fortran:

gcc/fortran:
2007-07-22  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/32710
	* parse.c (gfc_fixup_sibling_symbols): No replacement of symbols if the
	current is a namelist.

gcc/testsuite:
2007-07-22  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/32710
	* gfortran.dg/namelist_30.f90: New test.


Regression tested on i686-pc-linux-gnu. Ok for trunk?

Regards
	Daniel
Index: fortran/parse.c
===================================================================
--- fortran/parse.c	(revision 126788)
+++ fortran/parse.c	(working copy)
@@ -2769,7 +2769,8 @@
       if ((old_sym->attr.flavor == FL_PROCEDURE
 	   || old_sym->ts.type == BT_UNKNOWN)
 	  && old_sym->ns == ns
-	  && !old_sym->attr.contained)
+	  && !old_sym->attr.contained
+	  && old_sym->attr.flavor != FL_NAMELIST)
 	{
 	  /* Replace it with the symbol from the parent namespace.  */
 	  st->n.sym = sym;
Index: testsuite/gfortran.dg/namelist_30.f90
===================================================================
--- testsuite/gfortran.dg/namelist_30.f90	(revision 0)
+++ testsuite/gfortran.dg/namelist_30.f90	(revision 0)
@@ -0,0 +1,19 @@
+! { dg-do compile }
+!
+! PR fortran/32710 - ICE: namelist and subroutine with the same name
+!
+! Contributed by Janus Weil <jaydub66 AT gmail DOT com>
+!
+
+program x
+contains
+  subroutine readInput
+    integer:: a
+    NAMELIST /foo/ a
+    read(5,nml=foo)
+  end subroutine readInput
+
+  subroutine foo()
+  end subroutine
+
+end program

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