Mercurial > hg > CbC > CbC_gcc
diff gcc/fortran/gfortran.texi @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line diff
--- a/gcc/fortran/gfortran.texi Thu Oct 25 07:37:49 2018 +0900 +++ b/gcc/fortran/gfortran.texi Thu Feb 13 11:34:05 2020 +0900 @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- @c %**start of header @setfilename gfortran.info -@set copyrights-gfortran 1999-2018 +@set copyrights-gfortran 1999-2020 @include gcc-common.texi @@ -384,7 +384,7 @@ This manual specifically documents the Fortran front end, which handles the programming language's syntax and semantics. The aspects of GCC which relate to the optimization passes and the back-end code generation -are documented in the GCC manual; see +are documented in the GCC manual; see @ref{Top,,Introduction,gcc,Using the GNU Compiler Collection (GCC)}. The two manuals together provide a complete reference for the GNU Fortran compiler. @@ -418,10 +418,18 @@ files, use the equivalent preprocessor statement @code{#include}. If GNU Fortran invokes the preprocessor, @code{__GFORTRAN__} -is defined and @code{__GNUC__}, @code{__GNUC_MINOR__} and +is defined. The macros @code{__GNUC__}, @code{__GNUC_MINOR__} and @code{__GNUC_PATCHLEVEL__} can be used to determine the version of the compiler. See @ref{Top,,Overview,cpp,The C Preprocessor} for details. +GNU Fortran supports a number of @code{INTEGER} and @code{REAL} kind types +in additional to the kind types required by the Fortran standard. +The availability of any given kind type is architecture dependent. The +following pre-defined preprocessor macros can be used to conditionally +include code for these additional kind types: @code{__GFC_INT_1__}, +@code{__GFC_INT_2__}, @code{__GFC_INT_8__}, @code{__GFC_INT_16__}, +@code{__GFC_REAL_10__}, and @code{__GFC_REAL_16__}. + While CPP is the de-facto standard for preprocessing Fortran code, Part 3 of the Fortran 95 standard (ISO/IEC 1539-3:1998) defines Conditional Compilation, which is not widely used and not directly @@ -438,11 +446,11 @@ @cindex Fortran 77 @cindex @command{g77} -The GNU Fortran compiler is the successor to @command{g77}, the Fortran -77 front end included in GCC prior to version 4. It is an entirely new -program that has been designed to provide Fortran 95 support and -extensibility for future Fortran language standards, as well as providing -backwards compatibility for Fortran 77 and nearly all of the GNU language +The GNU Fortran compiler is the successor to @command{g77}, the Fortran +77 front end included in GCC prior to version 4. It is an entirely new +program that has been designed to provide Fortran 95 support and +extensibility for future Fortran language standards, as well as providing +backwards compatibility for Fortran 77 and nearly all of the GNU language extensions supported by @command{g77}. @@ -477,15 +485,12 @@ Fortran 2003 and Fortran 2008 features, including TR 15581. However, it is still under development and has a few remaining rough edges. There also is initial support for OpenACC. -Note that this is an experimental feature, incomplete, and subject to -change in future versions of GCC. See -@uref{https://gcc.gnu.org/wiki/OpenACC} for more information. At present, the GNU Fortran compiler passes the -@uref{http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html, +@uref{http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html, NIST Fortran 77 Test Suite}, and produces acceptable results on the @uref{http://www.netlib.org/lapack/faq.html#1.21, LAPACK Test Suite}. -It also provides respectable performance on +It also provides respectable performance on the @uref{http://www.polyhedron.com/fortran-compiler-comparisons/polyhedron-benchmark-suite, Polyhedron Fortran compiler benchmarks} and the @@ -538,10 +543,8 @@ Additionally, the GNU Fortran compilers supports the OpenMP specification (version 4.0 and most of the features of the 4.5 version, @url{http://openmp.org/@/wp/@/openmp-specifications/}). -There also is initial support for the OpenACC specification (targeting -version 2.0, @uref{http://www.openacc.org/}). -Note that this is an experimental feature, incomplete, and subject to -change in future versions of GCC. See +There also is support for the OpenACC specification (targeting +version 2.6, @uref{http://www.openacc.org/}). See @uref{https://gcc.gnu.org/wiki/OpenACC} for more information. @node Varying Length Character Strings @@ -596,13 +599,15 @@ * GFORTRAN_STDIN_UNIT:: Unit number for standard input * GFORTRAN_STDOUT_UNIT:: Unit number for standard output * GFORTRAN_STDERR_UNIT:: Unit number for standard error -* GFORTRAN_UNBUFFERED_ALL:: Do not buffer I/O for all units. +* GFORTRAN_UNBUFFERED_ALL:: Do not buffer I/O for all units * GFORTRAN_UNBUFFERED_PRECONNECTED:: Do not buffer I/O for preconnected units. * GFORTRAN_SHOW_LOCUS:: Show location for runtime errors * GFORTRAN_OPTIONAL_PLUS:: Print leading + where permitted * GFORTRAN_LIST_SEPARATOR:: Separator for list output * GFORTRAN_CONVERT_UNIT:: Set endianness for unformatted I/O * GFORTRAN_ERROR_BACKTRACE:: Show backtrace on run-time errors +* GFORTRAN_FORMATTED_BUFFER_SIZE:: Buffer size for formatted files +* GFORTRAN_UNFORMATTED_BUFFER_SIZE:: Buffer size for unformatted files @end menu @node TMPDIR @@ -660,7 +665,7 @@ @section @env{GFORTRAN_UNBUFFERED_PRECONNECTED}---Do not buffer I/O on preconnected units The environment variable named @env{GFORTRAN_UNBUFFERED_PRECONNECTED} controls -whether I/O on a preconnected unit (i.e.@: STDOUT or STDERR) is unbuffered. If +whether I/O on a preconnected unit (i.e.@: STDOUT or STDERR) is unbuffered. If the first letter is @samp{y}, @samp{Y} or @samp{1}, I/O is unbuffered. This will slow down small sequential reads and writes. If the first letter is @samp{n}, @samp{N} or @samp{0}, I/O is buffered. This is the default. @@ -725,7 +730,7 @@ Examples of values for @env{GFORTRAN_CONVERT_UNIT} are: @itemize @w{} @item @code{'big_endian'} Do all unformatted I/O in big_endian mode. -@item @code{'little_endian;native:10-20,25'} Do all unformatted I/O +@item @code{'little_endian;native:10-20,25'} Do all unformatted I/O in little_endian mode, except for units 10 to 20 and 25, which are in native format. @item @code{'10-20'} Units 10 to 20 are big-endian, the rest is native. @@ -774,6 +779,20 @@ Default is to print a backtrace unless the @option{-fno-backtrace} compile option was used. +@node GFORTRAN_FORMATTED_BUFFER_SIZE +@section @env{GFORTRAN_FORMATTED_BUFFER_SIZE}---Set buffer size for formatted I/O + +The @env{GFORTRAN_FORMATTED_BUFFER_SIZE} environment variable +specifies buffer size in bytes to be used for formatted output. +The default value is 8192. + +@node GFORTRAN_UNFORMATTED_BUFFER_SIZE +@section @env{GFORTRAN_UNFORMATTED_BUFFER_SIZE}---Set buffer size for unformatted I/O + +The @env{GFORTRAN_UNFORMATTED_BUFFER_SIZE} environment variable +specifies buffer size in bytes to be used for unformatted output. +The default value is 131072. + @c ===================================================================== @c PART II: LANGUAGE REFERENCE @c ===================================================================== @@ -826,7 +845,7 @@ @item The @code{ASSOCIATE} construct. -@item Interoperability with C including enumerations, +@item Interoperability with C including enumerations, @item In structure constructors the components with default values may be omitted. @@ -991,7 +1010,7 @@ following is implemented. @itemize -@item The @option{-std=f2008} option and support for the file extensions +@item The @option{-std=f2008} option and support for the file extensions @file{.f08} and @file{.F08}. @item The @code{OPEN} statement now supports the @code{NEWUNIT=} option, @@ -1095,8 +1114,6 @@ @node Fortran 2018 status @section Status of Fortran 2018 support -So far very little work has been done to support Fortran 2018. - @itemize @item ERROR STOP in a PURE procedure An @code{ERROR STOP} statement is permitted in a @code{PURE} @@ -1135,8 +1152,12 @@ @item Assumed types (@code{TYPE(*)}). -@item Assumed-rank (@code{DIMENSION(..)}). However, the array descriptor -of the TS is not yet supported. +@item Assumed-rank (@code{DIMENSION(..)}). + +@item ISO_Fortran_binding (now in Fortran 2018 18.4) is implemented such that +conversion of the array descriptor for assumed type or assumed rank arrays is +done in the library. The include file ISO_Fortran_binding.h is can be found in +@code{~prefix/lib/gcc/$target/$version}. @end itemize @@ -1292,7 +1313,7 @@ The GNU Fortran runtime library, (@code{libgfortran}), supports being called concurrently from multiple threads with the following -exceptions. +exceptions. During library initialization, the C @code{getenv} function is used, which need not be thread-safe. Similarly, the @code{getenv} @@ -1422,7 +1443,7 @@ @cindex file, symbolic link This section documents the behavior of GNU Fortran for file operations on -symbolic links, on systems that support them. +symbolic links, on systems that support them. @itemize @@ -1461,8 +1482,8 @@ compability only) is in effect. The representation of the record markers is that of unformatted files -given with the @option{-fconvert} option, the @xref{CONVERT specifier} -on the open statement or the @xref{GFORTRAN_CONVERT_UNIT} environment +given with the @option{-fconvert} option, the @ref{CONVERT specifier} +in an open statement or the @ref{GFORTRAN_CONVERT_UNIT} environment variable. The maximum number of bytes of user data in a subrecord is 2147483639 @@ -1479,7 +1500,7 @@ In the most simple case, with only one subrecord per logical record, both record markers contain the number of bytes of user data in the -record, +record. The format for unformatted sequential data can be duplicated using unformatted stream, as shown in the example program for an unformatted @@ -1489,7 +1510,7 @@ program main use iso_fortran_env, only: int32 implicit none - integer(int32) :: i + integer(int32) :: i real, dimension(10) :: a, b call random_number(a) open (10,file='test.dat',form='unformatted',access='stream') @@ -1566,6 +1587,7 @@ * X format descriptor without count field:: * Commas in FORMAT specifications:: * Missing period in FORMAT specifications:: +* Default widths for F@comma{} G and I format descriptors:: * I/O item lists:: * @code{Q} exponent-letter:: * BOZ literal constants:: @@ -1573,6 +1595,7 @@ * Unary operators:: * Implicitly convert LOGICAL and INTEGER values:: * Hollerith constants support:: +* Character conversion:: * Cray pointers:: * CONVERT specifier:: * OpenMP:: @@ -1717,7 +1740,7 @@ END PROGRAM test_print @end smallexample -Expanded namelist reads are permitted. This causes an error if +Expanded namelist reads are permitted. This causes an error if @option{-std=f95} is used. In the following example, the first element of the array will be given the value 0.00 and the two succeeding elements will be given the values 1.00 and 2.00. @@ -1750,11 +1773,16 @@ To support legacy codes, GNU Fortran allows the comma separator to be omitted immediately before and after character string edit -descriptors in @code{FORMAT} statements. +descriptors in @code{FORMAT} statements. A comma with no following format +decriptor is permited if the @option{-fdec-blank-format-item} is given on +the command line. This is considered non-conforming code and is +discouraged. @smallexample PRINT 10, 2, 3 10 FORMAT ('FOO='I1' BAR='I2) + print 20, 5, 6 +20 FORMAT (I3, I3,) @end smallexample @@ -1772,6 +1800,22 @@ 10 FORMAT ('F4') @end smallexample +@node Default widths for F@comma{} G and I format descriptors +@subsection Default widths for @code{F}, @code{G} and @code{I} format descriptors + +To support legacy codes, GNU Fortran allows width to be omitted from format +specifications if and only if @option{-fdec-format-defaults} is given on the +command line. Default widths will be used. This is considered non-conforming +code and is discouraged. + +@smallexample + REAL :: value1 + INTEGER :: value2 + WRITE(*,10) value1, value1, value2 +10 FORMAT ('F, G, I') +@end smallexample + + @node I/O item lists @subsection I/O item lists @cindex I/O item lists @@ -1800,46 +1844,26 @@ octal (@code{o}) and hexadecimal (@code{z}) integer constants. The syntax is: @samp{prefix quote digits quote}, were the prefix is either @code{b}, @code{o} or @code{z}, quote is either @code{'} or -@code{"} and the digits are for binary @code{0} or @code{1}, for -octal between @code{0} and @code{7}, and for hexadecimal between -@code{0} and @code{F}. (Example: @code{b'01011101'}.) - -Up to Fortran 95, BOZ literals were only allowed to initialize -integer variables in DATA statements. Since Fortran 2003 BOZ literals -are also allowed as argument of @code{REAL}, @code{DBLE}, @code{INT} -and @code{CMPLX}; the result is the same as if the integer BOZ -literal had been converted by @code{TRANSFER} to, respectively, -@code{real}, @code{double precision}, @code{integer} or @code{complex}. -As GNU Fortran extension the intrinsic procedures @code{FLOAT}, -@code{DFLOAT}, @code{COMPLEX} and @code{DCMPLX} are treated alike. - -As an extension, GNU Fortran allows hexadecimal BOZ literal constants to -be specified using the @code{X} prefix, in addition to the standard -@code{Z} prefix. The BOZ literal can also be specified by adding a -suffix to the string, for example, @code{Z'ABC'} and @code{'ABC'Z} are -equivalent. - -Furthermore, GNU Fortran allows using BOZ literal constants outside -DATA statements and the four intrinsic functions allowed by Fortran 2003. -In DATA statements, in direct assignments, where the right-hand side -only contains a BOZ literal constant, and for old-style initializers of -the form @code{integer i /o'0173'/}, the constant is transferred -as if @code{TRANSFER} had been used; for @code{COMPLEX} numbers, only -the real part is initialized unless @code{CMPLX} is used. In all other -cases, the BOZ literal constant is converted to an @code{INTEGER} value with -the largest decimal representation. This value is then converted -numerically to the type and kind of the variable in question. -(For instance, @code{real :: r = b'0000001' + 1} initializes @code{r} -with @code{2.0}.) As different compilers implement the extension -differently, one should be careful when doing bitwise initialization -of non-integer variables. - -Note that initializing an @code{INTEGER} variable with a statement such -as @code{DATA i/Z'FFFFFFFF'/} will give an integer overflow error rather -than the desired result of @math{-1} when @code{i} is a 32-bit integer -on a system that supports 64-bit integers. The @samp{-fno-range-check} -option can be used as a workaround for legacy code that initializes -integers in this manner. +@code{"} and the digits are @code{0} or @code{1} for binary, +between @code{0} and @code{7} for octal, and between @code{0} and +@code{F} for hexadecimal. (Example: @code{b'01011101'}.) + +Up to Fortran 95, BOZ literal constants were only allowed to initialize +integer variables in DATA statements. Since Fortran 2003 BOZ literal +constants are also allowed as actual arguments to the @code{REAL}, +@code{DBLE}, @code{INT} and @code{CMPLX} intrinsic functions. +The BOZ literal constant is simply a string of bits, which is padded +or truncated as needed, during conversion to a numeric type. The +Fortran standard states that the treatment of the sign bit is processor +dependent. Gfortran interprets the sign bit as a user would expect. + +As a deprecated extension, GNU Fortran allows hexadecimal BOZ literal +constants to be specified using the @code{X} prefix. That the BOZ literal +constant can also be specified by adding a suffix to the string, for +example, @code{Z'ABC'} and @code{'ABC'X} are equivalent. Additionally, +as extension, BOZ literals are permitted in some contexts outside of +@code{DATA} and the intrinsic functions listed in the Fortran standard. +Use @option{-fallow-invalid-boz} to enable the extension. @node Real array indices @subsection Real array indices @@ -1890,14 +1914,14 @@ @subsection Hollerith constants support @cindex Hollerith constants -GNU Fortran supports Hollerith constants in assignments, function -arguments, and @code{DATA} and @code{ASSIGN} statements. A Hollerith -constant is written as a string of characters preceded by an integer -constant indicating the character count, and the letter @code{H} or +GNU Fortran supports Hollerith constants in assignments, @code{DATA} +statements, function and subroutine arguments. A Hollerith constant is +written as a string of characters preceded by an integer constant +indicating the character count, and the letter @code{H} or @code{h}, and stored in bytewise fashion in a numeric (@code{INTEGER}, -@code{REAL}, or @code{complex}) or @code{LOGICAL} variable. The -constant will be padded or truncated to fit the size of the variable in -which it is stored. +@code{REAL}, or @code{COMPLEX}), @code{LOGICAL} or @code{CHARACTER} variable. +The constant will be padded with spaces or truncated to fit the size of +the variable in which it is stored. Examples of valid uses of Hollerith constants: @smallexample @@ -1907,11 +1931,13 @@ call foo (4h abc) @end smallexample -Invalid Hollerith constants examples: +Examples of Hollerith constants: @smallexample integer*4 a + a = 0H ! Invalid, at least one character is needed. + a = 4HAB12 ! Valid a = 8H12345678 ! Valid, but the Hollerith constant will be truncated. - a = 0H ! At least one character is needed. + a = 3Hxyz ! Valid, but the Hollerith constant will be padded. @end smallexample In general, Hollerith constants were used to provide a rudimentary @@ -1923,8 +1949,44 @@ with a given byte sequence. In these cases, the same result can be obtained by using the @code{TRANSFER} statement, as in this example. @smallexample - INTEGER(KIND=4) :: a - a = TRANSFER ("abcd", a) ! equivalent to: a = 4Habcd + integer(kind=4) :: a + a = transfer ("abcd", a) ! equivalent to: a = 4Habcd +@end smallexample + +The use of the @option{-fdec} option extends support of Hollerith constants +to comparisons: +@smallexample + integer*4 a + a = 4hABCD + if (a .ne. 4habcd) then + write(*,*) "no match" + end if +@end smallexample + +Supported types are numeric (@code{INTEGER}, @code{REAL}, or @code{COMPLEX}), +and @code{CHARACTER}. + +@node Character conversion +@subsection Character conversion +@cindex conversion, to character + +Allowing character literals to be used in a similar way to Hollerith constants +is a non-standard extension. This feature is enabled using +-fdec-char-conversions and only applies to character literals of @code{kind=1}. + +Character literals can be used in @code{DATA} statements and assignments with +numeric (@code{INTEGER}, @code{REAL}, or @code{COMPLEX}) or @code{LOGICAL} +variables. Like Hollerith constants they are copied byte-wise fashion. The +constant will be padded with spaces or truncated to fit the size of the +variable in which it is stored. + +Examples: +@smallexample + integer*4 x + data x / 'abcd' / + + x = 'A' ! Will be padded. + x = 'ab1234' ! Will be truncated. @end smallexample @@ -1980,7 +2042,7 @@ real pointee(10) pointer (ipt, pointee) ipt = loc (target) - ipt = ipt + 1 + ipt = ipt + 1 @end smallexample The last statement does not set @code{ipt} to the address of @code{target(1)}, as it would in C pointer arithmetic. Adding @code{1} @@ -2112,13 +2174,13 @@ @cindex OpenMP OpenMP (Open Multi-Processing) is an application programming -interface (API) that supports multi-platform shared memory -multiprocessing programming in C/C++ and Fortran on many +interface (API) that supports multi-platform shared memory +multiprocessing programming in C/C++ and Fortran on many architectures, including Unix and Microsoft Windows platforms. It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior. -GNU Fortran strives to be compatible to the +GNU Fortran strives to be compatible to the @uref{http://openmp.org/wp/openmp-specifications/, OpenMP Application Program Interface v4.5}. @@ -2161,7 +2223,7 @@ @item On glibc-based systems, OpenMP enabled applications cannot be statically linked due to limitations of the underlying pthreads-implementation. It -might be possible to get a working solution if +might be possible to get a working solution if @command{-Wl,--whole-archive -lpthread -Wl,--no-whole-archive} is added to the command line. However, this is not supported by @command{gcc} and thus not recommended. @@ -2178,7 +2240,7 @@ GNU Fortran strives to be compatible to the @uref{http://www.openacc.org/, OpenACC Application Programming -Interface v2.0}. +Interface v2.6}. To enable the processing of the OpenACC directive @code{!$acc} in free-form source code; the @code{c$acc}, @code{*$acc} and @code{!$acc} @@ -2194,10 +2256,6 @@ form of a Fortran 90 module named @code{openacc} and in a form of a Fortran @code{include} file named @file{openacc_lib.h}. -Note that this is an experimental feature, incomplete, and subject to -change in future versions of GCC. See -@uref{https://gcc.gnu.org/wiki/OpenACC} for more information. - @node Argument list functions @subsection Argument list functions @code{%VAL}, @code{%REF} and @code{%LOC} @cindex argument list functions @@ -2205,20 +2263,20 @@ @cindex @code{%REF} @cindex @code{%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 +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 +@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.: @@ -2376,7 +2434,7 @@ @example structure /appointment/ ! nested structure definition: app_time is an array of two 'time' - structure /time/ app_time (2) + structure /time/ app_time (2) integer(1) hour, minute end structure character(10) memo @@ -2879,13 +2937,13 @@ @menu * ENCODE and DECODE statements:: * Variable FORMAT expressions:: -@c * Q edit descriptor:: @c * TYPE and ACCEPT I/O Statements:: @c * DEFAULTFILE, DISPOSE and RECORDTYPE I/O specifiers:: @c * Omitted arguments in procedure call:: * Alternate complex function syntax:: * Volatile COMMON blocks:: * OPEN( ... NAME=):: +* Q edit descriptor:: @end menu @node ENCODE and DECODE statements @@ -2962,7 +3020,7 @@ @smallexample c Variable declaration CHARACTER(LEN=20) FMT -c +c c Other code here... c WRITE(FMT,'("(I", I0, ")")') N+1 @@ -2975,7 +3033,7 @@ @smallexample c Variable declaration CHARACTER(LEN=20) FMT -c +c c Other code here... c WRITE(FMT,*) N+1 @@ -3008,7 +3066,7 @@ @node OPEN( ... NAME=) @subsection @code{OPEN( ... NAME=)} -@cindex @code{NAM} +@cindex @code{NAME} Some Fortran compilers, including @command{g77}, let the user declare @code{OPEN( ... NAME=)}. This is @@ -3016,6 +3074,26 @@ @command{gfortran}. @code{OPEN( ... NAME=)} should be replaced with @code{OPEN( ... FILE=)}. +@node Q edit descriptor +@subsection @code{Q} edit descriptor +@cindex @code{Q} edit descriptor + +Some Fortran compilers provide the @code{Q} edit descriptor, which +transfers the number of characters left within an input record into an +integer variable. + +A direct replacement of the @code{Q} edit descriptor is not available +in @command{gfortran}. How to replicate its functionality using +standard-conforming code depends on what the intent of the original +code is. + +Options to replace @code{Q} may be to read the whole line into a +character variable and then counting the number of non-blank +characters left using @code{LEN_TRIM}. Another method may be to use +formatted stream, read the data up to the position where the @code{Q} +descriptor occurred, use @code{INQUIRE} to get the file position, +count the characters up to the next @code{NEW_LINE} and then start +reading from the position marked previously. @c --------------------------------------------------------------------- @@ -3422,11 +3500,14 @@ assumed-shape, assumed-rank and deferred-shape arrays, including allocatables and pointers. -Note: Currently, GNU Fortran does not support the array descriptor +Note: Currently, GNU Fortran does not use internally the array descriptor (dope vector) as specified in the Technical Specification, but uses -an array descriptor with different fields. The Chasm Language -Interoperability Tools, @url{http://chasm-interop.sourceforge.net/}, -provide an interface to GNU Fortran's array descriptor. +an array descriptor with different fields. Assumed type and assumed rank +formal arguments are converted in the library to the specified form. The +ISO_Fortran_binding API functions (also Fortran 2018 18.4) are implemented +in libgfortran. Alternatively, the Chasm Language Interoperability Tools, +@url{http://chasm-interop.sourceforge.net/}, provide an interface to GNU +Fortran's array descriptor. The Technical Specification adds the following new features, which are supported by GNU Fortran: @@ -3492,6 +3573,10 @@ @menu * ATTRIBUTES directive:: * UNROLL directive:: +* BUILTIN directive:: +* IVDEP directive:: +* VECTOR directive:: +* NOVECTOR directive:: @end menu @node ATTRIBUTES directive @@ -3583,6 +3668,71 @@ The values of 0 and 1 block any unrolling of the loop. +@node BUILTIN directive +@subsection BUILTIN directive + +The syntax of the directive is + +@code{!GCC$ BUILTIN (B) attributes simd FLAGS IF('target')} + +You can use this directive to define which middle-end built-ins provide vector +implementations. @code{B} is name of the middle-end built-in. @code{FLAGS} +are optional and must be either "(inbranch)" or "(notinbranch)". +@code{IF} statement is optional and is used to filter multilib ABIs +for the built-in that should be vectorized. Example usage: + +@smallexample +!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') +@end smallexample + +The purpose of the directive is to provide an API among the GCC compiler and +the GNU C Library which would define vector implementations of math routines. + + +@node IVDEP directive +@subsection IVDEP directive + +The syntax of the directive is + +@code{!GCC$ ivdep} + +This directive tells the compiler to ignore vector dependencies in the +following loop. It must be placed immediately before a @code{DO} loop +and applies only to the loop that follows. + +Sometimes the compiler may not have sufficient information to decide +whether a particular loop is vectorizable due to potential +dependencies between iterations. The purpose of the directive is to +tell the compiler that vectorization is safe. + +This directive is intended for annotation of existing code. For new +code it is recommended to consider OpenMP SIMD directives as potential +alternative. + + +@node VECTOR directive +@subsection VECTOR directive + +The syntax of the directive is + +@code{!GCC$ vector} + +This directive tells the compiler to vectorize the following loop. It +must be placed immediately before a @code{DO} loop and applies only to +the loop that follows. + + +@node NOVECTOR directive +@subsection NOVECTOR directive + +The syntax of the directive is + +@code{!GCC$ novector} + +This directive tells the compiler to not vectorize the following loop. +It must be placed immediately before a @code{DO} loop and applies only +to the loop that follows. + @node Non-Fortran Main Program @section Non-Fortran Main Program @@ -3713,7 +3863,8 @@ Default: enabled. @item @var{option}[6] @tab Enables run-time checking. Possible values are (bitwise or-ed): GFC_RTCHECK_BOUNDS (1), GFC_RTCHECK_ARRAY_TEMPS (2), -GFC_RTCHECK_RECURSION (4), GFC_RTCHECK_DO (16), GFC_RTCHECK_POINTER (32). +GFC_RTCHECK_RECURSION (4), GFC_RTCHECK_DO (16), GFC_RTCHECK_POINTER (32), +GFC_RTCHECK_BITS (64). Default: disabled. @item @var{option}[7] @tab Unused. @item @var{option}[8] @tab Show a warning when invoking @code{STOP} and @@ -5727,7 +5878,7 @@ The following people have contributed bug reports, smaller or larger patches, and much needed feedback and encouragement for the -GNU Fortran project: +GNU Fortran project: @itemize @minus @item Bill Clodius