Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28324 Discussions

Type of function result not recognized


I am in the final stages of compiling legacy f90/95 code with the latest version of the IVF compiler in Visual Studio 2015. The code has successfully compiled, linked and run with two other compilers. The offending compilation unit is a module that is structured as follows:

module mod1
   implicit none
   function CaseText() result(Text)
      character(127) :: Text
   end function CaseText
   subroutine Sub1(...)
      ... (variable declarations)
      character(127) :: CaseMsg
      ... (Fortran statements)
      CaseMsg(1:) = CaseText()      !Statement A
   end subroutine Sub1
   subroutine Sub2(...)
      ... (variable declarations)
      character(127) :: CaseMsg
      CaseMsg(1:) = CaseText()      !Statement B
   end subroutine Sub2
end module mod1

Upon compilation, the following error messages are issued relating to Statement B, but not Statement A:

error #6404: This name does not have a type, and must have an explicit type.   [CASETEXT]
error #6054: A CHARACTER data type is required in this context.   [CASETEXT]

Furthermore, references to the function CaseText in modules other than Mod1 also flag no errors. I'm thinking this may have something to do with the differences between internal, external and module procedures, but I'm perplexed as to why the error is flagged for Statement B but not Statement A. If I simply comment out Statement B, no errors are flagged. Can anyone educate me on what is going on here? Thanks for any help.

0 Kudos
0 Replies