summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-31 16:42:58 +0000
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-31 16:42:58 +0000
commit09e18861c29b1bc1a2f10261a4e305cd767135d1 (patch)
tree7d470ade8ba2b23b23b184fcfc2c89c02a6a6c2d /gcc/fortran
parent42cef9dfc03464f08cbc8726edafee3779099eb3 (diff)
downloadgcc-09e18861c29b1bc1a2f10261a4e305cd767135d1.tar.gz
2007-03-31 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31160 * gfortran.texi: Add a section for the %VAL, %REF and %LOC extensions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123383 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-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 1697e44b4d8..63c8bb7c4a1 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 52b4c2c1c8c..5f315852e33 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 ---------------------------------------------------------------------