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

x64 code and module variable

felotti
Beginner
312 Views

I have a theory question: It's possible to pass a global variale (from a module) to a subroutine in x64 program?

0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
312 Views
I fail to see the relevance of "x64 program". According to the Bible Fortran Standard, you are allowed do it, and that supposedly has nothing to do with the compiler or architecture.

The only constraint is that the subroutine may not simultaneously refer to both the dumy argument and the said global variable in a non-read-only fashion. For example, this is a no-no in general:
MODULE Mod
INTEGER I
END MODULE Mod

PROGRAM
Use Mod
CALL FOO(I)
PRINT *, I
END PROGRAM

SUBROUTINE FOO(J)
Use Mod, ONLY: I
J = J + I
I = J * I
PRINT *, J, I
END SUBROUTINE

0 Kudos
Reply