Skip to content

Instantly share code, notes, and snippets.

@qin-yu
Created January 23, 2020 16:32
Show Gist options
  • Save qin-yu/0fe9db2252acde996f7113d78b231a90 to your computer and use it in GitHub Desktop.
Save qin-yu/0fe9db2252acde996f7113d78b231a90 to your computer and use it in GitHub Desktop.
Error: The CALL statement is invoking a function subprogram as a subroutine

SYSTEM is a function that returns an integer result, so declare a variable:

integer iret

and then change the call to:

iret = system(tmpline)

The Fortran standard does not allow calling a function as a subroutine. Indeed, earlier versions of our compiler did allow this, under some conditions, but the restrictions were not enough to avoid possible bad results and, after long debate, we decided that as the number of cases where this was harmless was small enough it was simpler to just make it an error. The problem has to do with mismatched assumptions about where arguments and return values get placed.

Reference: Error: The CALL statement is invoking a function subprogram as a subroutine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment