+2011-07-17 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/34657
+ * module.c (check_for_ambiguous): Check whether the name is matches
+ the current program unit.
+
2011-07-17 Tobias Burnus <burnus@net-b.de>
PR fortran/49624
module_locus locus;
symbol_attribute attr;
+ if (st_sym->ns->proc_name && st_sym->name == st_sym->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);
+ return true;
+ }
+
rsym = info->u.rsym.sym;
if (st_sym == rsym)
return false;
+2011-07-17 Tobias Burnus <burnus@net-b.de>
+ Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/34657
+ * gfortran.dg/generic_17.f90: Fix testcase.
+ * gfortran.dg/interface_3.f90: Add dg-error.
+ * gfortran.dg/use_14.f90: New.
+ * gfortran.dg/use_15.f90: New.
+
2011-07-17 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/pointer_controlled.adb: New test.
use d_foo_mod\r
end module foo_mod\r
\r
-subroutine s_foobar(x) \r
+subroutine s_foobar2(x) \r
use foo_mod\r
-end subroutine s_foobar\r
+end subroutine s_foobar2\r
! { dg-final { cleanup-modules "s_foo_mod d_foo_mod foo_mod" } }
!
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
!
+! Modified for PR fortran/34657
+!
module test_mod
interface
subroutine my_sub (a)
! This is the original PR, excepting that the error requires the symbol
! to be referenced.
subroutine my_sub (a)
- use test_mod
+ use test_mod ! { dg-error "is also the name of the current program unit" }
real a
call my_sub (a) ! { dg-error "ambiguous reference" }
print *, a
end subroutine
integer function my_fun (a)
- use test_mod
+ use test_mod ! { dg-error "is also the name of the current program unit" }
real a
print *, a
my_fun = 1 ! { dg-error "ambiguous reference" }
--- /dev/null
+! { dg-do compile }
+!
+! PR fortran/34657
+!
+module test_mod
+interface
+ subroutine my_sub (a)
+ real a
+ end subroutine
+end interface
+end module
+
+subroutine my_sub (a)
+ use test_mod, gugu => my_sub
+ real a
+ print *, a
+end subroutine
+
+END
--- /dev/null
+! { dg-do compile }
+!
+! PR fortran/34657
+!
+module test_mod
+interface
+ subroutine my_sub (a)
+ real a
+ end subroutine
+end interface
+end module
+
+subroutine my_sub (a)
+ use test_mod ! { dg-error "is also the name of the current program unit" }
+ real a
+ print *, a
+end subroutine
+
+
+module test_mod2
+ integer :: my_sub2
+end module
+
+subroutine my_sub2 (a)
+ use test_mod2 ! { dg-error "is also the name of the current program unit" }
+ real a
+ print *, a
+end subroutine
+
+
+subroutine my_sub3 (a)
+ use test_mod2, my_sub3 => my_sub2 ! { dg-error "is also the name of the current program unit" }
+ real a
+ print *, a
+end subroutine
+
+END
+
+! { dg-final { cleanup-modules "test_mod test_mod2" } }