aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-03-31 16:42:58 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-03-31 16:42:58 +0000
commitd60e76db50467899935a6738a56af8871d33a789 (patch)
tree7d470ade8ba2b23b23b184fcfc2c89c02a6a6c2d
parentc9516c38e3ea4a028efafe349142638800e0212e (diff)
downloadgcc-d60e76db50467899935a6738a56af8871d33a789.zip
gcc-d60e76db50467899935a6738a56af8871d33a789.tar.gz
gcc-d60e76db50467899935a6738a56af8871d33a789.tar.bz2
re PR fortran/31160 (%VAL and related features need to be documented.)
2007-03-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/31160 * gfortran.texi: Add a section for the %VAL, %REF and %LOC extensions. From-SVN: r123383
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/gfortran.texi39
2 files changed, 45 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 1697e44..63c8bb7 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-31 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/31160
+ * gfortran.texi: Add a section for the %VAL, %REF and %LOC
+ extensions.
+
2007-03-30 Rafael Avila de Espindola <espindola@google.com>
* trans-types.c (gfc_signed_or_unsigned_type): Remove.
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index 52b4c2c..5f31585 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -808,6 +808,7 @@ of extensions, and @option{-std=legacy} allows both without warning.
* Cray pointers::
* CONVERT specifier::
* OpenMP::
+* Argument list functions::
@end menu
@node Old-style kind specifications
@@ -1288,6 +1289,44 @@ For details refer to the actual
@uref{http://www.openmp.org/drupal/mp-documents/spec25.pdf,
OpenMP Application Program Interface v2.5} specification.
+@node Argument list functions
+@section Argument list functions %VAL, %REF and %LOC
+@cindex Argument list functions %VAL, %REF and %LOC
+
+GNU Fortran supports argument list functions @code{%VAL}, @code{%REF}
+and @code{%LOC} statements, for backward compatibility with g77.
+It is recommended that these should be used only for code that is
+accessing facilities outside of GNU Fortran, such as operating system
+or windowing facilities. It is best to constrain such uses to isolated
+portions of a program--portions that deal specifically and exclusively
+with low-level, system-dependent facilities. Such portions might well
+provide a portable interface for use by the program as a whole, but are
+themselves not portable, and should be thoroughly tested each time they
+are rebuilt using a new compiler or version of a compiler.
+
+@code{%VAL} passes a scalar argument by value, @code{%REF} passes it by
+reference and @code{%LOC} passes its memory location. Since gfortran
+already passes scalar arguments by reference, @code{%REF} is in effect
+a do-nothing. @code{%LOC} has the same effect as a fortran pointer.
+
+An example of passing an argument by value to a C subroutine foo.:
+@smallexample
+C
+C prototype void foo_ (float x);
+C
+ external foo
+ real*4 x
+ x = 3.14159
+ call foo (%VAL (x))
+ end
+@end smallexample
+
+For details refer to the g77 manual
+@uref{http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/index.html#Top}.
+
+Also, the gfortran testsuite c_by_val.f and its partner c_by_val.c are
+worth a look.
+
@c ---------------------------------------------------------------------
@c Intrinsic Procedures
@c ---------------------------------------------------------------------