Fortran follows the link. The dummy attribute corresponds to those variables that are passed to the function ( X and Y in your case). The parameter operator expects something static, but since X is what is passed to the function, it really makes no sense. A parameter operator is a way of setting constants - it has nothing to do with subroutine parameters.
When you receive an error message that C not a DUMMY variable, it means that it does not find C in the list of variables that will be transferred to / from the function - your declaration is only F(X, Y) : no C in sight . Although you are not explicitly using the DUMMY attribute, you have the INTENT(INOUT) attribute, which means that these variables correspond to the I / O of the subroutine.
To get what you want, you will have a routine that looks something like this:
subroutine F(X, Y) implicit none ! These are the dummy variables real, intent(inout) :: X, Y ! These are the variables in the scope of this subroutine real :: a, b real, parameter, save :: c = 3.14E0 X = Y + 2*sin(Y) end subroutine F
I'm not quite sure what you are trying to do - you are declaring a pure routine, which means a routine without side effects, but you are using INTENT(INOUT) for your variables, which means that X and Y can be changed at runtime.
I would also add that inside a subroutine, initializing a variable in its statement of an expression of type REAL :: C = 3.14E0 gives a variable with the implicit save attribute. If you want it to be saved from call to call, you did the right thing by explicitly adding the save attribute so that it is clear that this is what you are doing.
I am not a parser and compiler guy, but I think that to answer your question the DUMMY attribute means that you just get a pointer - you do not need to allocate any space, since the variable used in the function call already has allocated space.
Tim whitcomb
source share