GNU fortran manual section "10.5.2.126 Rename Intrinsic (function)" says "Due to the side effects performed by this intrinsic, the function form is not recommended."
On other hand section "8.11.9.213 Rename Intrinsic (subroutine)" says "Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument."
Thus, two questions:
First note the manual you reference is extremely old. It is of GCC 3, so it is valid for g77
not for gfortran
. The recent version is here https://gcc.gnu.org/onlinedocs/gfortran/RENAME.html
If portability (from compiler to compiler) is needed, don't use this procedure at all, but call the OS to do that. That will be different on different OS. For example, on Linux
call EXECUTE_COMMAND_LINE('mv ' // trim(old) // ' ' // trim(new) )
or SYSTEM()
instead if EXECUTE_COMMAND_LINE()
on older compilers.
The side-effect is the action of file renaming itself. Normal intrinsic functions are pure and they will (mostly) return the same answer for the same input and they do not change any external state. A side-effect is any action that changes some external state in addition to returning the function return value.
Note that the subroutine form also has the same side-effects. But that is not a problem. Subroutines are expected to have side-effects.
This is the same reason why RANDOM_NUMBER()
is a subroutine. It has side-effects of changing the state of the random generator. The non-standard function RAND()
is ugly, because it is a function with side-effects.