In a statement function, only the type and kind are determined from the host. gfortran fails to compile
troutmask:kargl[205] cat n.f SUBROUTINE PHTOD(E,N,I,H) DIMENSION E(N) HSTAR(E,B)=B**.4*((1.25*FUN(-E/40)+.18)) ! Doesn't work. C HSTAR(X,Y)=Y**.4*((1.25*FUN(-X/40)+.18)) ! Works. A = 1. H = HSTAR(E(I-1), A) END troutmask:kargl[207] ftnchek n.f FTNCHEK Version 3.3 November 2004 File n.f: 0 syntax errors detected in file n.f No main program found Warning: Subprogram FUN never defined Invoked in module PHTOD line 3 file n.f (possibly it is an array which was not declared) troutmask:kargl[208] gfc -c n.f n.f:1.24: SUBROUTINE PHTOD(E,N,I,H) 1 Error: Argument 'e' of statement function at (1) must be scalar If the reference to FUN in statement function is changed to an elemental function, then one gets an additional error. Changing FUN to SIN yields troutmask:kargl[210] gfc -c n.f n.f:1.24: SUBROUTINE PHTOD(E,N,I,H) 1 Error: Argument 'e' of statement function at (1) must be scalar n.f:3.11: HSTAR(E,B)=B**.4*((1.25*SIN(-E/40)+.18)) ! Doesn't work. 1 Error: Incompatible ranks 0 and 1 in assignment at (1) Because statement functions are obselscent in Fortran 95, this should be considered a very low priority bug. -- Summary: scope of variables in statement function do not acquire rank from host Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kargl at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35299