]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/47203 (USE of module with same name as SUBROUTINE not reject, but also...
authorMikael Morin <mikael@gcc.gnu.org>
Wed, 9 Jan 2013 20:18:44 +0000 (20:18 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Wed, 9 Jan 2013 20:18:44 +0000 (20:18 +0000)
PR fortran/47203
* module.c (check_for_ambiguous): Get the current program unit using
gfc_current_ns.

PR fortran/47203
* gfortran.dg/use_28.f90: New test.

From-SVN: r195065

gcc/fortran/ChangeLog
gcc/fortran/module.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/use_28.f90 [new file with mode: 0644]

index d8c54488371d284129c8e9496bb11b1958e8b992..cfaae77fe02ba3f9af1eba5302c63c70fee5427c 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-09  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/47203
+       * module.c (check_for_ambiguous): Get the current program unit using
+       gfc_current_ns.
+
 2013-01-09  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/55758
index f3b3caa1ad817be80097fb0f30b4055fa4dd7184..604acbb13dac5e19c658f70d7e1824192e635f68 100644 (file)
@@ -4493,7 +4493,7 @@ check_for_ambiguous (gfc_symbol *st_sym, pointer_info *info)
   module_locus locus;
   symbol_attribute attr;
 
-  if (st_sym->ns->proc_name && st_sym->name == st_sym->ns->proc_name->name)
+  if (st_sym->name == gfc_current_ns->proc_name->name)
     {
       gfc_error ("'%s' of module '%s', imported at %C, is also the name of the "
                 "current program unit", st_sym->name, module_name);
index 1e66c770db42d2891b03bc9f6dd938d5060659ef..238d75217a8b39c0743397bfec2600c96cf3800e 100644 (file)
@@ -1,3 +1,8 @@
+2013-01-09  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/47203
+       * gfortran.dg/use_28.f90: New test.
+
 2012-01-09  Uros Bizjak  <ubizjak@gmail.com>
 
        * gfortran.dg/intrinsic_size_3.f90: Make scan-tree-dump-times
diff --git a/gcc/testsuite/gfortran.dg/use_28.f90 b/gcc/testsuite/gfortran.dg/use_28.f90
new file mode 100644 (file)
index 0000000..4972bea
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR fortran/47203
+! The USE statement of a module was not rejected in a procedure with the same
+! name if the procedure was contained.
+!
+! Contributed by Tobias Burnus <burnus@net-b.de>
+
+module m
+end module m
+
+call m
+contains
+  subroutine m()
+     use m      ! { dg-error "is also the name of the current program unit" }
+  end subroutine m
+end
+
This page took 0.071543 seconds and 5 git commands to generate.