For the program module foo_mod implicit none interface twice module procedure twice_real end interface twice contains real function twice_real(x) real :: x twice_real = 2*x end function twice_real end module foo_mod program xfoo use foo_mod, only: twice,twice implicit none print*,twice(2.3) end program xfoo version gcc version 4.2.0 20061011 (experimental) of gfortran on Windows XP says In file xduplicate_use.f90:14 use foo_mod, only: twice,twice 1 Error: Symbol 'twice' referenced at (1) not found in module 'foo_mod' In the thread "USE, ONLY question" in comp.lang.fortran, most people thought that repetition in a USE, ONLY statement was standard-conforming. If "twice" is replaced with "twice_real" in program xfoo, it compiles and runs, giving the expected output. Vivek Rao
(In reply to comment #0) More seriously, this is also broken. module foo_mod implicit none interface twice module procedure twice_real end interface twice contains real function twice_real(x) real :: x twice_real = 2*x end function twice_real end module foo_mod program xfoo use foo_mod, only: two=>twice,dbl=>twice implicit none print*,two(2.3) print*,dbl(2.3) end program xfoo Paul
Subject: Bug number PR29464 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-11/msg01705.html
Since I posted a fix, I guess that I should accept the bug! Paul
Subject: Bug 29464 Author: pault Date: Sat Dec 9 20:52:27 2006 New Revision: 119696 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119696 Log: 2006-11-25 Paul Thomas <pault@gcc.gnu.org> PR fortran/29464 * module.c (load_generic_interfaces): Add symbols for all the local names of an interface. Share the interface amongst the symbols. * gfortran.h : Add generic_copy to symbol_attribute. * symbol.c (free_symbol): Only free interface if generic_copy is not set. 2006-11-25 Paul Thomas <pault@gcc.gnu.org> PR fortran/29464 * gfortran.dg/module_interface_2.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/module_interface_2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/module.c trunk/gcc/fortran/symbol.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 29464 Author: pault Date: Thu Dec 21 14:19:40 2006 New Revision: 120110 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120110 Log: 2006-11-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/29464 * module.c (load_generic_interfaces): Add symbols for all the local names of an interface. Share the interface amongst the symbols. * gfortran.h : Add generic_copy to symbol_attribute. * symbol.c (free_symbol): Only free interface if generic_copy is not set. 2006-11-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/29464 * gfortran.dg/module_interface_2.f90: New test. Added: branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/module_interface_2.f90 Modified: branches/gcc-4_2-branch/gcc/fortran/ChangeLog branches/gcc-4_2-branch/gcc/fortran/gfortran.h branches/gcc-4_2-branch/gcc/fortran/module.c branches/gcc-4_2-branch/gcc/fortran/symbol.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
Fixed on trunk and 4.2 Paul