x64 code and module variable

x64 code and module variable

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

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today