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

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

typa
Einsteiger
3.112Aufrufe

Hi,

I get the error given in the headline when I try to run a program containing the following lines:

tmpline = 'if exist "'//filpid(1:i_dummy)//'"'//
# ' del /q "'//filpid(1:i_dummy)//'" > tmp'

call system(tmpline)

This is a program once compiled with an older compiler version. In a previous thread I have read that function calls are not longer allowed by the new compiler versions. So it is clear that this can not work using a new compiler version. But what would be the trick to gain the same result?

Bele

0 Kudos
2 Antworten
Steven_L_Intel1
Mitarbeiter
3.112Aufrufe
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.
typa
Einsteiger
3.112Aufrufe
Thanks for the fast response!!!!
Antworten