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

Compiler complains when using system command

ingo_berg
Beginner
575 Views
Hi,

What is wrong with the following code? It compiles with Intel Fortran 8.1 but not with V 9.0.019.
There I get the error:

"Error: The CALL statement is invoking an external function subprogram as a subroutine. [SYSTEM]"

Regards,
Ingo

--- code ----------------------------------------------------


program HydroSim

implicit none

call Test()

contains

subroutine Test()
use ifport
call system("notepad")
end subroutine

end program
0 Kudos
3 Replies
TimP
Honored Contributor III
575 Views
The lib_for.pdf which comes with the compiler specifies that system() is an integer function, which returns an error code. ifport.f90 enforces the standard.
0 Kudos
Steven_L_Intel1
Employee
575 Views
For a long time, our compiler allowed you to CALL a procedure declared as a function, with certain restrictions. But the restrictions weren't enough to prevent run-time problems and we decided it was the best course to simply enforce the declared procedure type all the time.

Please read the release notes where this and other changes are discussed. You may save yourself surprises by doing so.
0 Kudos
ingo_berg
Beginner
575 Views
Thanks for the clarification.

I wasn't aware that functions could be called as subroutines. I always thought system is a subroutine. Having that background information the error message makes sense.
0 Kudos
Reply