This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran,documentation patch] Improve the documentation of GNU extensions


I realized today that the GNU extensions allowed by gfortran are not all described in our documentation, although there is an Extensions section in gfortran.texi. By grepping for GFC_STD_LEGACY and GFC_STD_GNU, one can go through all the extensions currently implemented and add them to the documentation if need be.

I intend to do that in the future, but had only time today to document the GFC_STD_LEGACY extensions. Attached is the patch for these changes, I'd welcome a review by someone with real knowledge of these things (I first learnt Fortran 95, so these extensions just look like ugly nonsense to me :)

Here's the "attached" patch. Sorry :(
Index: gfortran.texi
===================================================================
--- gfortran.texi	(revision 115752)
+++ gfortran.texi	(working copy)
@@ -753,6 +753,10 @@
 * Cray pointers::
 * CONVERT specifier::
 * OpenMP::
+* Extra SAVE statements::
+* Integer-logical conversions::
+* Non scalar character formats::
+* Goto and label in different blocks::
 @end menu
 
 @node Old-style kind specifications
@@ -1199,6 +1203,78 @@
 @uref{http://www.openmp.org/drupal/mp-documents/spec25.pdf,
 OpenMP Application Program Interface v2.5} specification.
 
+
+@node Extra SAVE statements
+@section Extra SAVE statements
+@cindex Extra SAVE statements
+
+@command{gfortran} allows a @code{SAVE} statement with an omitted saved
+entity list (called a ``blanket @code{SAVE} statement'') to appear in the
+same scoping unit as other @code{SAVE} statements. This is sometimes
+useful for subroutines with saved common blocks, allowing the
+following example code to compile:
+@smallexample
+      subroutine net
+      implicit real*8(a-h,o-z)
+      save    /keyeosc/
+      common  /keyeosc/  jzone,keyeos,keycoul,kesfail,nupress,ntryeos
+      save    /eossub/
+      common  /eossub/ eossubf
+      character eossubf*10
+      logical bad,fmbad
+      save
+      end
+@end smallexample
+@command{gfortran} also allows a variable to be declared as saved
+multiple times in a scoping unit.
+
+
+@node Integer-logical conversions
+@section Integer-logical conversions
+@cindex Integer-logical conversions
+
+@command{gfortran} allows integer-to-logical and logical-to-integer
+conversions.
+
+
+@node Non scalar character formats
+@section Non scalar character formats
+@cindex Non scalar character formats
+
+@command{gfortran} allows a character array to be used as in a
+@code{FORMAT} tag; the format is then understood as the concatenation of
+all the character strings of the array. The following example program
+@smallexample
+  character*4,parameter :: str(2) = (/ "(I5,", "A4) " /)
+  write (*,str) 12345, "6789"
+  end
+@end smallexample
+outputs "123456789". Assigned Hollerith constants can also be used as
+@code{FORMAT} variables, when code is compiled with the
+@code{-std=legacy} option.
+
+
+@node Goto and label in different blocks
+@section Goto and label in different blocks
+@cindex Goto and label in different blocks
+
+When used with the @code{-std=legacy} option, @command{gfortran} allows
+a @code{GOTO} statement to branch to a @code{LABEL} that is located
+inside a different block of code:
+@smallexample
+      integer i,j
+      j = 0
+      do i = 1, 10
+  120   j = j + 1
+        print *, i, j
+      end do
+      i = 5
+      if (j .le. 10) goto 120
+      end
+@end smallexample
+
+
+
 @c ---------------------------------------------------------------------
 @include intrinsic.texi
 @c ---------------------------------------------------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]