This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, fortran] PR32710 - ICE: namelist and subroutine with the same name
- From: Daniel Franke <franke dot daniel at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 22 Jul 2007 11:17:23 +0200
- Subject: [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