6.1.29 %LOC as an rvalue

Normally %LOC is allowed only in parameter lists. However the intrinsic function LOC does the same thing, and is usable as the right-hand-side of assignments. For compatibility, GNU Fortran supports the use of %LOC as an alias for the builtin LOC with -std=legacy. With this feature enabled the following two examples are equivalent:

integer :: i, l
l = %loc(i)
call sub(l)
integer :: i
call sub(%loc(i))

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gfortran/_0025LOC-as-an-rvalue.html