https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61928
Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2014-08-02 CC| |kargl at troutmask dot apl.washing | |ton.edu Ever confirmed|0 |1 --- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- Reduced test program Z0linpack ! with LINPACK's dgedi and dgefa, and SLATEC's idamax implicit none integer( kind = 4 )::n integer( kind = 4 )::info,lda integer( kind = 4 ),allocatable:: IPVT(:) integer( kind = 4 ),parameter::ns=10,job=10 doubleprecision,dimension(:,:),allocatable::A call dgefa ( A, lda, n, ipvt, info ) contains subroutine dgefa ( a, lda, n, ipvt, info ) implicit none integer ( kind = 4 ) lda integer ( kind = 4 ) n real ( kind = 8 ) a(lda,n) integer ( kind = 4 ) info integer ( kind = 4 ) ipvt(n) integer ( kind = 4 ) idamax integer ( kind = 4 ) k integer ( kind = 4 ) l k = 1 l = idamax ( n-k+1, a(k,k), 1 ) + k - 1 return end function idamax ( n, dx, incx ) implicit none real ( kind = 8 ) dx(*) integer ( kind = 4 ) idamax integer ( kind = 4 ) incx integer ( kind = 4 ) n idamax = 0 return end end program Z0linpack [Book15] f90/bug% gfc pr61928_red.f90 Undefined symbols for architecture x86_64: "_idamax_", referenced from: _dgefa.2338 in cc23XSKJ.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status However if I comment the line integer ( kind = 4 ) idamax in the subroutine dgefa, the code compiles and links without error. AFAIK the subroutine dgefa and the function idamax are not designed to be internal procedures. It seems that with the above line gfortran assumes that idamax is an external function and not the internal one; however I don't know where to find it in the standard. I suspect that this PR should be closed as invalid, but I let someone else to make the call! Note that compiling the code with gfortran 4.5 gives a lot of errors, starting with pr61928_red.f90:29.2: end 1 Error: END SUBROUTINE statement expected at (1) pr61928_red.f90:31: function idamax ( n, dx, incx ) 1 Error: Unclassifiable statement at (1) ...