http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55593
Bug #: 55593 Summary: Bogus error on passing DO LOOP variable Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: sfilipp...@uniroma2.it CC: tkoe...@gcc.gnu.org Created attachment 28877 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28877 test case Hi, I get the following bogus error: =========================================================================== [sfilippo@localhost bug34]$ gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/local/gnu48/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --prefix=/usr/local/gnu48 --enable-languages=c,c++,fortran --with-gmp=/home/travel/GCC/BUILDS/gmp --with-mpfr=/home/travel/GCC/BUILDS/mpfr --with-mpc=/home/travel/GCC/BUILDS/mpc : (reconfigured) ../gcc/configure --prefix=/usr/local/gnu48 --enable-languages=c,c++,fortran --with-gmp=/home/travel/GCC/BUILDS/gmp --with-mpfr=/home/travel/GCC/BUILDS/mpfr --with-mpc=/home/travel/GCC/BUILDS/mpc : (reconfigured) ../gcc/configure --prefix=/usr/local/gnu48 --with-gmp=/home/travel/GCC/BUILDS/gmp --with-mpfr=/home/travel/GCC/BUILDS/mpfr --with-mpc=/home/travel/GCC/BUILDS/mpc --enable-languages=c,c++,fortran,lto --no-create --no-recursion Thread model: posix gcc version 4.8.0 20121204 (experimental) (GCC) [sfilippo@localhost bug34]$ gfortran -c bug34.f90 bug34.f90:95.21: call loc_to_glob(i,idx,desc_a,info) 1 bug34.f90:94.14: do i=1, nrow 2 Error: Variable 'i' at (1) not definable inside loop beginning at (2) as INTENT(INOUT) argument to subroutine 'loc_to_glob' =========================================================== The error is bogus because the proper specific subroutine should be "loc_to_glob2s" and it gets I as the actual argument corresponding to an INTENT(IN) dummy (x). The compiler appears to be confused by the generic name being the same as one of the specifics; indeed, if I change the second specific name to "loc_to_glob1v" on line 49, the error goes away. Note that having one of the specific names the same as the generic is allowed by the standard. (even though it's not a very good idea, and I'll probably change it anyway) This sure looks like having been caused by the fix for PR30146.