The following program compiles successfully, but results in an undefined reference to `___MOD_names' during linking. It compiles and links successfully with g95 0.92! (May 31, 2009)and ifort 11.1.065.
Using gfortran built from svn trunk revision 159797. Command line was simply "gfortran filename.f90". Some experimentation shows that the problem is related to the use of an module procedure scoped array parameter in the specification expression for the function result. The type of the parameter array doesn't seem to matter. MODULE Fruits IMPLICIT NONE PRIVATE PUBLIC :: Get CONTAINS FUNCTION Get(i) RESULT(s) CHARACTER(*), PARAMETER :: names(3) = [ & 'Apple ', & 'Orange ', & 'Mango ' ]; INTEGER, INTENT(IN) :: i CHARACTER(LEN_TRIM(names(i))) :: s !**** s = names(i) END FUNCTION Get END MODULE Fruits PROGRAM WheresThatbLinkingConstantGone USE Fruits IMPLICIT NONE !**** WRITE (*, "('Eat the tasty ',A)") Get(1) END PROGRAM WheresThatbLinkingConstantGone -- Summary: Link error with reference to parameter array in specification expression Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ian_harvey at bigpond dot com GCC build triplet: i686-pc-mingw32 GCC host triplet: i686-pc-mingw32 GCC target triplet: i686-pc-mingw32 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44265