]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/fortran/gfortran.texi
Enable %LOC as an rvalue with -std=legacy.
[thirdparty/gcc.git] / gcc / fortran / gfortran.texi
index fb47c13ceaaf311b85eab0188b3c9f5635540c2f..e1256bd8824d930f504ca0626de5f6cf0826b942 100644 (file)
@@ -1467,6 +1467,7 @@ compatibility extensions along with those enabled by @option{-std=legacy}.
 * Extended math intrinsics::
 * Form feed as whitespace::
 * TYPE as an alias for PRINT::
+* %LOC as an rvalue::
 @end menu
 
 @node Old-style kind specifications
@@ -2537,6 +2538,26 @@ TYPE *, 'hello world'
 PRINT *, 'hello world'
 @end smallexample
 
+@node %LOC as an rvalue
+@subsection %LOC as an rvalue
+@cindex LOC
+Normally @code{%LOC} is allowed only in parameter lists.  However the intrinsic
+function @code{LOC} does the same thing, and is usable as the right-hand-side of
+assignments. For compatibility, GNU Fortran supports the use of @code{%LOC} as
+an alias for the builtin @code{LOC} with @option{-std=legacy}.  With this
+feature enabled the following two examples are equivalent:
+
+@smallexample
+integer :: i, l
+l = %loc(i)
+call sub(l)
+@end smallexample
+
+@smallexample
+integer :: i
+call sub(%loc(i))
+@end smallexample
+
 
 @node Extensions not implemented in GNU Fortran
 @section Extensions not implemented in GNU Fortran