1 |
285 |
jeremybenn |
This is doc/gfortran.info, produced by makeinfo version 4.12 from
|
2 |
|
|
/space/rguenther/gcc-4.5.1/gcc-4.5.1/gcc/fortran/gfortran.texi.
|
3 |
|
|
|
4 |
|
|
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
5 |
|
|
2008, 2009, 2010 Free Software Foundation, Inc.
|
6 |
|
|
|
7 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
8 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
9 |
|
|
any later version published by the Free Software Foundation; with the
|
10 |
|
|
Invariant Sections being "Funding Free Software", the Front-Cover Texts
|
11 |
|
|
being (a) (see below), and with the Back-Cover Texts being (b) (see
|
12 |
|
|
below). A copy of the license is included in the section entitled "GNU
|
13 |
|
|
Free Documentation License".
|
14 |
|
|
|
15 |
|
|
(a) The FSF's Front-Cover Text is:
|
16 |
|
|
|
17 |
|
|
A GNU Manual
|
18 |
|
|
|
19 |
|
|
(b) The FSF's Back-Cover Text is:
|
20 |
|
|
|
21 |
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
22 |
|
|
software. Copies published by the Free Software Foundation raise
|
23 |
|
|
funds for GNU development.
|
24 |
|
|
|
25 |
|
|
INFO-DIR-SECTION Software development
|
26 |
|
|
START-INFO-DIR-ENTRY
|
27 |
|
|
* gfortran: (gfortran). The GNU Fortran Compiler.
|
28 |
|
|
END-INFO-DIR-ENTRY
|
29 |
|
|
This file documents the use and the internals of the GNU Fortran
|
30 |
|
|
compiler, (`gfortran').
|
31 |
|
|
|
32 |
|
|
Published by the Free Software Foundation 51 Franklin Street, Fifth
|
33 |
|
|
Floor Boston, MA 02110-1301 USA
|
34 |
|
|
|
35 |
|
|
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
36 |
|
|
2008, 2009, 2010 Free Software Foundation, Inc.
|
37 |
|
|
|
38 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
39 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
40 |
|
|
any later version published by the Free Software Foundation; with the
|
41 |
|
|
Invariant Sections being "Funding Free Software", the Front-Cover Texts
|
42 |
|
|
being (a) (see below), and with the Back-Cover Texts being (b) (see
|
43 |
|
|
below). A copy of the license is included in the section entitled "GNU
|
44 |
|
|
Free Documentation License".
|
45 |
|
|
|
46 |
|
|
(a) The FSF's Front-Cover Text is:
|
47 |
|
|
|
48 |
|
|
A GNU Manual
|
49 |
|
|
|
50 |
|
|
(b) The FSF's Back-Cover Text is:
|
51 |
|
|
|
52 |
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
53 |
|
|
software. Copies published by the Free Software Foundation raise
|
54 |
|
|
funds for GNU development.
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
File: gfortran.info, Node: Top, Next: Introduction, Up: (dir)
|
58 |
|
|
|
59 |
|
|
Introduction
|
60 |
|
|
************
|
61 |
|
|
|
62 |
|
|
This manual documents the use of `gfortran', the GNU Fortran compiler.
|
63 |
|
|
You can find in this manual how to invoke `gfortran', as well as its
|
64 |
|
|
features and incompatibilities.
|
65 |
|
|
|
66 |
|
|
* Menu:
|
67 |
|
|
|
68 |
|
|
* Introduction::
|
69 |
|
|
|
70 |
|
|
Part I: Invoking GNU Fortran
|
71 |
|
|
* Invoking GNU Fortran:: Command options supported by `gfortran'.
|
72 |
|
|
* Runtime:: Influencing runtime behavior with environment variables.
|
73 |
|
|
|
74 |
|
|
Part II: Language Reference
|
75 |
|
|
* Fortran 2003 and 2008 status:: Fortran 2003 and 2008 features supported by GNU Fortran.
|
76 |
|
|
* Compiler Characteristics:: User-visible implementation details.
|
77 |
|
|
* Mixed-Language Programming:: Interoperability with C
|
78 |
|
|
* Extensions:: Language extensions implemented by GNU Fortran.
|
79 |
|
|
* Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran.
|
80 |
|
|
* Intrinsic Modules:: Intrinsic modules supported by GNU Fortran.
|
81 |
|
|
|
82 |
|
|
* Contributing:: How you can help.
|
83 |
|
|
* Copying:: GNU General Public License says
|
84 |
|
|
how you can copy and share GNU Fortran.
|
85 |
|
|
* GNU Free Documentation License::
|
86 |
|
|
How you can copy and share this manual.
|
87 |
|
|
* Funding:: How to help assure continued work for free software.
|
88 |
|
|
* Option Index:: Index of command line options
|
89 |
|
|
* Keyword Index:: Index of concepts
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
File: gfortran.info, Node: Introduction, Next: Invoking GNU Fortran, Prev: Top, Up: Top
|
93 |
|
|
|
94 |
|
|
1 Introduction
|
95 |
|
|
**************
|
96 |
|
|
|
97 |
|
|
The GNU Fortran compiler front end was designed initially as a free
|
98 |
|
|
replacement for, or alternative to, the unix `f95' command; `gfortran'
|
99 |
|
|
is the command you'll use to invoke the compiler.
|
100 |
|
|
|
101 |
|
|
* Menu:
|
102 |
|
|
|
103 |
|
|
* About GNU Fortran:: What you should know about the GNU Fortran compiler.
|
104 |
|
|
* GNU Fortran and GCC:: You can compile Fortran, C, or other programs.
|
105 |
|
|
* Preprocessing and conditional compilation:: The Fortran preprocessor
|
106 |
|
|
* GNU Fortran and G77:: Why we chose to start from scratch.
|
107 |
|
|
* Project Status:: Status of GNU Fortran, roadmap, proposed extensions.
|
108 |
|
|
* Standards:: Standards supported by GNU Fortran.
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
File: gfortran.info, Node: About GNU Fortran, Next: GNU Fortran and GCC, Up: Introduction
|
112 |
|
|
|
113 |
|
|
1.1 About GNU Fortran
|
114 |
|
|
=====================
|
115 |
|
|
|
116 |
|
|
The GNU Fortran compiler supports the Fortran 77, 90 and 95 standards
|
117 |
|
|
completely, parts of the Fortran 2003 and Fortran 2008 standards, and
|
118 |
|
|
several vendor extensions. The development goal is to provide the
|
119 |
|
|
following features:
|
120 |
|
|
|
121 |
|
|
* Read a user's program, stored in a file and containing
|
122 |
|
|
instructions written in Fortran 77, Fortran 90, Fortran 95,
|
123 |
|
|
Fortran 2003 or Fortran 2008. This file contains "source code".
|
124 |
|
|
|
125 |
|
|
* Translate the user's program into instructions a computer can
|
126 |
|
|
carry out more quickly than it takes to translate the instructions
|
127 |
|
|
in the first place. The result after compilation of a program is
|
128 |
|
|
"machine code", code designed to be efficiently translated and
|
129 |
|
|
processed by a machine such as your computer. Humans usually
|
130 |
|
|
aren't as good writing machine code as they are at writing Fortran
|
131 |
|
|
(or C++, Ada, or Java), because it is easy to make tiny mistakes
|
132 |
|
|
writing machine code.
|
133 |
|
|
|
134 |
|
|
* Provide the user with information about the reasons why the
|
135 |
|
|
compiler is unable to create a binary from the source code.
|
136 |
|
|
Usually this will be the case if the source code is flawed. The
|
137 |
|
|
Fortran 90 standard requires that the compiler can point out
|
138 |
|
|
mistakes to the user. An incorrect usage of the language causes
|
139 |
|
|
an "error message".
|
140 |
|
|
|
141 |
|
|
The compiler will also attempt to diagnose cases where the user's
|
142 |
|
|
program contains a correct usage of the language, but instructs
|
143 |
|
|
the computer to do something questionable. This kind of
|
144 |
|
|
diagnostics message is called a "warning message".
|
145 |
|
|
|
146 |
|
|
* Provide optional information about the translation passes from the
|
147 |
|
|
source code to machine code. This can help a user of the compiler
|
148 |
|
|
to find the cause of certain bugs which may not be obvious in the
|
149 |
|
|
source code, but may be more easily found at a lower level
|
150 |
|
|
compiler output. It also helps developers to find bugs in the
|
151 |
|
|
compiler itself.
|
152 |
|
|
|
153 |
|
|
* Provide information in the generated machine code that can make it
|
154 |
|
|
easier to find bugs in the program (using a debugging tool, called
|
155 |
|
|
a "debugger", such as the GNU Debugger `gdb').
|
156 |
|
|
|
157 |
|
|
* Locate and gather machine code already generated to perform
|
158 |
|
|
actions requested by statements in the user's program. This
|
159 |
|
|
machine code is organized into "modules" and is located and
|
160 |
|
|
"linked" to the user program.
|
161 |
|
|
|
162 |
|
|
The GNU Fortran compiler consists of several components:
|
163 |
|
|
|
164 |
|
|
* A version of the `gcc' command (which also might be installed as
|
165 |
|
|
the system's `cc' command) that also understands and accepts
|
166 |
|
|
Fortran source code. The `gcc' command is the "driver" program for
|
167 |
|
|
all the languages in the GNU Compiler Collection (GCC); With `gcc',
|
168 |
|
|
you can compile the source code of any language for which a front
|
169 |
|
|
end is available in GCC.
|
170 |
|
|
|
171 |
|
|
* The `gfortran' command itself, which also might be installed as the
|
172 |
|
|
system's `f95' command. `gfortran' is just another driver program,
|
173 |
|
|
but specifically for the Fortran compiler only. The difference
|
174 |
|
|
with `gcc' is that `gfortran' will automatically link the correct
|
175 |
|
|
libraries to your program.
|
176 |
|
|
|
177 |
|
|
* A collection of run-time libraries. These libraries contain the
|
178 |
|
|
machine code needed to support capabilities of the Fortran
|
179 |
|
|
language that are not directly provided by the machine code
|
180 |
|
|
generated by the `gfortran' compilation phase, such as intrinsic
|
181 |
|
|
functions and subroutines, and routines for interaction with files
|
182 |
|
|
and the operating system.
|
183 |
|
|
|
184 |
|
|
* The Fortran compiler itself, (`f951'). This is the GNU Fortran
|
185 |
|
|
parser and code generator, linked to and interfaced with the GCC
|
186 |
|
|
backend library. `f951' "translates" the source code to assembler
|
187 |
|
|
code. You would typically not use this program directly; instead,
|
188 |
|
|
the `gcc' or `gfortran' driver programs will call it for you.
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
File: gfortran.info, Node: GNU Fortran and GCC, Next: Preprocessing and conditional compilation, Prev: About GNU Fortran, Up: Introduction
|
192 |
|
|
|
193 |
|
|
1.2 GNU Fortran and GCC
|
194 |
|
|
=======================
|
195 |
|
|
|
196 |
|
|
GNU Fortran is a part of GCC, the "GNU Compiler Collection". GCC
|
197 |
|
|
consists of a collection of front ends for various languages, which
|
198 |
|
|
translate the source code into a language-independent form called
|
199 |
|
|
"GENERIC". This is then processed by a common middle end which
|
200 |
|
|
provides optimization, and then passed to one of a collection of back
|
201 |
|
|
ends which generate code for different computer architectures and
|
202 |
|
|
operating systems.
|
203 |
|
|
|
204 |
|
|
Functionally, this is implemented with a driver program (`gcc')
|
205 |
|
|
which provides the command-line interface for the compiler. It calls
|
206 |
|
|
the relevant compiler front-end program (e.g., `f951' for Fortran) for
|
207 |
|
|
each file in the source code, and then calls the assembler and linker
|
208 |
|
|
as appropriate to produce the compiled output. In a copy of GCC which
|
209 |
|
|
has been compiled with Fortran language support enabled, `gcc' will
|
210 |
|
|
recognize files with `.f', `.for', `.ftn', `.f90', `.f95', `.f03' and
|
211 |
|
|
`.f08' extensions as Fortran source code, and compile it accordingly. A
|
212 |
|
|
`gfortran' driver program is also provided, which is identical to `gcc'
|
213 |
|
|
except that it automatically links the Fortran runtime libraries into
|
214 |
|
|
the compiled program.
|
215 |
|
|
|
216 |
|
|
Source files with `.f', `.for', `.fpp', `.ftn', `.F', `.FOR',
|
217 |
|
|
`.FPP', and `.FTN' extensions are treated as fixed form. Source files
|
218 |
|
|
with `.f90', `.f95', `.f03', `.f08', `.F90', `.F95', `.F03' and `.F08'
|
219 |
|
|
extensions are treated as free form. The capitalized versions of
|
220 |
|
|
either form are run through preprocessing. Source files with the lower
|
221 |
|
|
case `.fpp' extension are also run through preprocessing.
|
222 |
|
|
|
223 |
|
|
This manual specifically documents the Fortran front end, which
|
224 |
|
|
handles the programming language's syntax and semantics. The aspects
|
225 |
|
|
of GCC which relate to the optimization passes and the back-end code
|
226 |
|
|
generation are documented in the GCC manual; see *note Introduction:
|
227 |
|
|
(gcc)Top. The two manuals together provide a complete reference for
|
228 |
|
|
the GNU Fortran compiler.
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
File: gfortran.info, Node: Preprocessing and conditional compilation, Next: GNU Fortran and G77, Prev: GNU Fortran and GCC, Up: Introduction
|
232 |
|
|
|
233 |
|
|
1.3 Preprocessing and conditional compilation
|
234 |
|
|
=============================================
|
235 |
|
|
|
236 |
|
|
Many Fortran compilers including GNU Fortran allow passing the source
|
237 |
|
|
code through a C preprocessor (CPP; sometimes also called the Fortran
|
238 |
|
|
preprocessor, FPP) to allow for conditional compilation. In the case of
|
239 |
|
|
GNU Fortran, this is the GNU C Preprocessor in the traditional mode. On
|
240 |
|
|
systems with case-preserving file names, the preprocessor is
|
241 |
|
|
automatically invoked if the filename extension is `.F', `.FOR',
|
242 |
|
|
`.FTN', `.fpp', `.FPP', `.F90', `.F95', `.F03' or `.F08'. To manually
|
243 |
|
|
invoke the preprocessor on any file, use `-cpp', to disable
|
244 |
|
|
preprocessing on files where the preprocessor is run automatically, use
|
245 |
|
|
`-nocpp'.
|
246 |
|
|
|
247 |
|
|
If a preprocessed file includes another file with the Fortran
|
248 |
|
|
`INCLUDE' statement, the included file is not preprocessed. To
|
249 |
|
|
preprocess included files, use the equivalent preprocessor statement
|
250 |
|
|
`#include'.
|
251 |
|
|
|
252 |
|
|
If GNU Fortran invokes the preprocessor, `__GFORTRAN__' is defined
|
253 |
|
|
and `__GNUC__', `__GNUC_MINOR__' and `__GNUC_PATCHLEVEL__' can be used
|
254 |
|
|
to determine the version of the compiler. See *note Overview: (cpp)Top.
|
255 |
|
|
for details.
|
256 |
|
|
|
257 |
|
|
While CPP is the de-facto standard for preprocessing Fortran code,
|
258 |
|
|
Part 3 of the Fortran 95 standard (ISO/IEC 1539-3:1998) defines
|
259 |
|
|
Conditional Compilation, which is not widely used and not directly
|
260 |
|
|
supported by the GNU Fortran compiler. You can use the program coco to
|
261 |
|
|
preprocess such files (`http://users.erols.com/dnagle/coco.html').
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
File: gfortran.info, Node: GNU Fortran and G77, Next: Project Status, Prev: Preprocessing and conditional compilation, Up: Introduction
|
265 |
|
|
|
266 |
|
|
1.4 GNU Fortran and G77
|
267 |
|
|
=======================
|
268 |
|
|
|
269 |
|
|
The GNU Fortran compiler is the successor to `g77', the Fortran 77
|
270 |
|
|
front end included in GCC prior to version 4. It is an entirely new
|
271 |
|
|
program that has been designed to provide Fortran 95 support and
|
272 |
|
|
extensibility for future Fortran language standards, as well as
|
273 |
|
|
providing backwards compatibility for Fortran 77 and nearly all of the
|
274 |
|
|
GNU language extensions supported by `g77'.
|
275 |
|
|
|
276 |
|
|
|
277 |
|
|
File: gfortran.info, Node: Project Status, Next: Standards, Prev: GNU Fortran and G77, Up: Introduction
|
278 |
|
|
|
279 |
|
|
1.5 Project Status
|
280 |
|
|
==================
|
281 |
|
|
|
282 |
|
|
As soon as `gfortran' can parse all of the statements correctly,
|
283 |
|
|
it will be in the "larva" state. When we generate code, the
|
284 |
|
|
"puppa" state. When `gfortran' is done, we'll see if it will be a
|
285 |
|
|
beautiful butterfly, or just a big bug....
|
286 |
|
|
|
287 |
|
|
-Andy Vaught, April 2000
|
288 |
|
|
|
289 |
|
|
The start of the GNU Fortran 95 project was announced on the GCC
|
290 |
|
|
homepage in March 18, 2000 (even though Andy had already been working
|
291 |
|
|
on it for a while, of course).
|
292 |
|
|
|
293 |
|
|
The GNU Fortran compiler is able to compile nearly all
|
294 |
|
|
standard-compliant Fortran 95, Fortran 90, and Fortran 77 programs,
|
295 |
|
|
including a number of standard and non-standard extensions, and can be
|
296 |
|
|
used on real-world programs. In particular, the supported extensions
|
297 |
|
|
include OpenMP, Cray-style pointers, and several Fortran 2003 and
|
298 |
|
|
Fortran 2008 features such as enumeration, stream I/O, and some of the
|
299 |
|
|
enhancements to allocatable array support from TR 15581. However, it is
|
300 |
|
|
still under development and has a few remaining rough edges.
|
301 |
|
|
|
302 |
|
|
At present, the GNU Fortran compiler passes the NIST Fortran 77 Test
|
303 |
|
|
Suite (http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html), and
|
304 |
|
|
produces acceptable results on the LAPACK Test Suite
|
305 |
|
|
(http://www.netlib.org/lapack/faq.html#1.21). It also provides
|
306 |
|
|
respectable performance on the Polyhedron Fortran compiler benchmarks
|
307 |
|
|
(http://www.polyhedron.com/pb05.html) and the Livermore Fortran Kernels
|
308 |
|
|
test
|
309 |
|
|
(http://www.llnl.gov/asci_benchmarks/asci/limited/lfk/README.html). It
|
310 |
|
|
has been used to compile a number of large real-world programs,
|
311 |
|
|
including the HIRLAM weather-forecasting code
|
312 |
|
|
(http://mysite.verizon.net/serveall/moene.pdf) and the Tonto quantum
|
313 |
|
|
chemistry package (http://www.theochem.uwa.edu.au/tonto/); see
|
314 |
|
|
`http://gcc.gnu.org/wiki/GfortranApps' for an extended list.
|
315 |
|
|
|
316 |
|
|
Among other things, the GNU Fortran compiler is intended as a
|
317 |
|
|
replacement for G77. At this point, nearly all programs that could be
|
318 |
|
|
compiled with G77 can be compiled with GNU Fortran, although there are
|
319 |
|
|
a few minor known regressions.
|
320 |
|
|
|
321 |
|
|
The primary work remaining to be done on GNU Fortran falls into three
|
322 |
|
|
categories: bug fixing (primarily regarding the treatment of invalid
|
323 |
|
|
code and providing useful error messages), improving the compiler
|
324 |
|
|
optimizations and the performance of compiled code, and extending the
|
325 |
|
|
compiler to support future standards--in particular, Fortran 2003 and
|
326 |
|
|
Fortran 2008.
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
File: gfortran.info, Node: Standards, Prev: Project Status, Up: Introduction
|
330 |
|
|
|
331 |
|
|
1.6 Standards
|
332 |
|
|
=============
|
333 |
|
|
|
334 |
|
|
* Menu:
|
335 |
|
|
|
336 |
|
|
* Varying Length Character Strings::
|
337 |
|
|
|
338 |
|
|
The GNU Fortran compiler implements ISO/IEC 1539:1997 (Fortran 95).
|
339 |
|
|
As such, it can also compile essentially all standard-compliant Fortran
|
340 |
|
|
90 and Fortran 77 programs. It also supports the ISO/IEC TR-15581
|
341 |
|
|
enhancements to allocatable arrays, and the OpenMP Application Program
|
342 |
|
|
Interface v2.5 (http://www.openmp.org/drupal/mp-documents/spec25.pdf)
|
343 |
|
|
specification.
|
344 |
|
|
|
345 |
|
|
In the future, the GNU Fortran compiler will also support ISO/IEC
|
346 |
|
|
1539-1:2004 (Fortran 2003) and future Fortran standards. Partial support
|
347 |
|
|
of that standard is already provided; the current status of Fortran 2003
|
348 |
|
|
support is reported in the *note Fortran 2003 status:: section of the
|
349 |
|
|
documentation.
|
350 |
|
|
|
351 |
|
|
The next version of the Fortran standard (Fortran 2008) is currently
|
352 |
|
|
being developed and the GNU Fortran compiler supports some of its new
|
353 |
|
|
features. This support is based on the latest draft of the standard
|
354 |
|
|
(available from `http://www.nag.co.uk/sc22wg5/') and no guarantee of
|
355 |
|
|
future compatibility is made, as the final standard might differ from
|
356 |
|
|
the draft. For more information, see the *note Fortran 2008 status::
|
357 |
|
|
section.
|
358 |
|
|
|
359 |
|
|
Additionally, the GNU Fortran compilers supports the OpenMP
|
360 |
|
|
specification (version 3.0,
|
361 |
|
|
`http://openmp.org/wp/openmp-specifications/').
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
File: gfortran.info, Node: Varying Length Character Strings, Up: Standards
|
365 |
|
|
|
366 |
|
|
1.6.1 Varying Length Character Strings
|
367 |
|
|
--------------------------------------
|
368 |
|
|
|
369 |
|
|
The Fortran 95 standard specifies in Part 2 (ISO/IEC 1539-2:2000)
|
370 |
|
|
varying length character strings. While GNU Fortran currently does not
|
371 |
|
|
support such strings directly, there exist two Fortran implementations
|
372 |
|
|
for them, which work with GNU Fortran. They can be found at
|
373 |
|
|
`http://www.fortran.com/iso_varying_string.f95' and at
|
374 |
|
|
`ftp://ftp.nag.co.uk/sc22wg5/ISO_VARYING_STRING/'.
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
File: gfortran.info, Node: Invoking GNU Fortran, Next: Runtime, Prev: Introduction, Up: Top
|
378 |
|
|
|
379 |
|
|
2 GNU Fortran Command Options
|
380 |
|
|
*****************************
|
381 |
|
|
|
382 |
|
|
The `gfortran' command supports all the options supported by the `gcc'
|
383 |
|
|
command. Only options specific to GNU Fortran are documented here.
|
384 |
|
|
|
385 |
|
|
*Note GCC Command Options: (gcc)Invoking GCC, for information on the
|
386 |
|
|
non-Fortran-specific aspects of the `gcc' command (and, therefore, the
|
387 |
|
|
`gfortran' command).
|
388 |
|
|
|
389 |
|
|
All GCC and GNU Fortran options are accepted both by `gfortran' and
|
390 |
|
|
by `gcc' (as well as any other drivers built at the same time, such as
|
391 |
|
|
`g++'), since adding GNU Fortran to the GCC distribution enables
|
392 |
|
|
acceptance of GNU Fortran options by all of the relevant drivers.
|
393 |
|
|
|
394 |
|
|
In some cases, options have positive and negative forms; the
|
395 |
|
|
negative form of `-ffoo' would be `-fno-foo'. This manual documents
|
396 |
|
|
only one of these two forms, whichever one is not the default.
|
397 |
|
|
|
398 |
|
|
* Menu:
|
399 |
|
|
|
400 |
|
|
* Option Summary:: Brief list of all `gfortran' options,
|
401 |
|
|
without explanations.
|
402 |
|
|
* Fortran Dialect Options:: Controlling the variant of Fortran language
|
403 |
|
|
compiled.
|
404 |
|
|
* Preprocessing Options:: Enable and customize preprocessing.
|
405 |
|
|
* Error and Warning Options:: How picky should the compiler be?
|
406 |
|
|
* Debugging Options:: Symbol tables, measurements, and debugging dumps.
|
407 |
|
|
* Directory Options:: Where to find module files
|
408 |
|
|
* Link Options :: Influencing the linking step
|
409 |
|
|
* Runtime Options:: Influencing runtime behavior
|
410 |
|
|
* Code Gen Options:: Specifying conventions for function calls, data layout
|
411 |
|
|
and register usage.
|
412 |
|
|
* Environment Variables:: Environment variables that affect `gfortran'.
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
File: gfortran.info, Node: Option Summary, Next: Fortran Dialect Options, Up: Invoking GNU Fortran
|
416 |
|
|
|
417 |
|
|
2.1 Option summary
|
418 |
|
|
==================
|
419 |
|
|
|
420 |
|
|
Here is a summary of all the options specific to GNU Fortran, grouped
|
421 |
|
|
by type. Explanations are in the following sections.
|
422 |
|
|
|
423 |
|
|
_Fortran Language Options_
|
424 |
|
|
*Note Options controlling Fortran dialect: Fortran Dialect Options.
|
425 |
|
|
-fall-intrinsics -ffree-form -fno-fixed-form
|
426 |
|
|
-fdollar-ok -fimplicit-none -fmax-identifier-length
|
427 |
|
|
-std=STD -fd-lines-as-code -fd-lines-as-comments
|
428 |
|
|
-ffixed-line-length-N -ffixed-line-length-none
|
429 |
|
|
-ffree-line-length-N -ffree-line-length-none
|
430 |
|
|
-fdefault-double-8 -fdefault-integer-8 -fdefault-real-8
|
431 |
|
|
-fcray-pointer -fopenmp -fno-range-check -fbackslash -fmodule-private
|
432 |
|
|
|
433 |
|
|
_Preprocessing Options_
|
434 |
|
|
*Note Enable and customize preprocessing: Preprocessing Options.
|
435 |
|
|
-cpp -dD -dI -dM -dN -dU -fworking-directory
|
436 |
|
|
-imultilib DIR -iprefix FILE -isysroot DIR
|
437 |
|
|
-iquote -isystem DIR -nocpp -nostdinc -undef
|
438 |
|
|
-AQUESTION=ANSWER -A-QUESTION[=ANSWER]
|
439 |
|
|
-C -CC -DMACRO[=DEFN] -UMACRO -H -P
|
440 |
|
|
|
441 |
|
|
_Error and Warning Options_
|
442 |
|
|
*Note Options to request or suppress errors and warnings: Error
|
443 |
|
|
and Warning Options.
|
444 |
|
|
-fmax-errors=N
|
445 |
|
|
-fsyntax-only -pedantic -pedantic-errors
|
446 |
|
|
-Wall -Waliasing -Wampersand -Warray-bounds -Wcharacter-truncation
|
447 |
|
|
-Wconversion -Wimplicit-interface -Wimplicit-procedure -Wline-truncation
|
448 |
|
|
-Wintrinsics-std -Wsurprising -Wno-tabs -Wunderflow -Wunused-parameter
|
449 |
|
|
-Wintrinsics-shadow -Wno-align-commons
|
450 |
|
|
|
451 |
|
|
_Debugging Options_
|
452 |
|
|
*Note Options for debugging your program or GNU Fortran: Debugging
|
453 |
|
|
Options.
|
454 |
|
|
-fdump-parse-tree -ffpe-trap=LIST
|
455 |
|
|
-fdump-core -fbacktrace
|
456 |
|
|
|
457 |
|
|
_Directory Options_
|
458 |
|
|
*Note Options for directory search: Directory Options.
|
459 |
|
|
-IDIR -JDIR -MDIR
|
460 |
|
|
-fintrinsic-modules-path DIR
|
461 |
|
|
|
462 |
|
|
_Link Options_
|
463 |
|
|
*Note Options for influencing the linking step: Link Options.
|
464 |
|
|
-static-libgfortran
|
465 |
|
|
|
466 |
|
|
_Runtime Options_
|
467 |
|
|
*Note Options for influencing runtime behavior: Runtime Options.
|
468 |
|
|
-fconvert=CONVERSION -fno-range-check
|
469 |
|
|
-frecord-marker=LENGTH -fmax-subrecord-length=LENGTH
|
470 |
|
|
-fsign-zero
|
471 |
|
|
|
472 |
|
|
_Code Generation Options_
|
473 |
|
|
*Note Options for code generation conventions: Code Gen Options.
|
474 |
|
|
-fno-automatic -ff2c -fno-underscoring
|
475 |
|
|
-fwhole-file -fsecond-underscore
|
476 |
|
|
-fbounds-check -fcheck-array-temporaries -fmax-array-constructor =N
|
477 |
|
|
-fcheck=
|
478 |
|
|
-fmax-stack-var-size=N
|
479 |
|
|
-fpack-derived -frepack-arrays -fshort-enums -fexternal-blas
|
480 |
|
|
-fblas-matmul-limit=N -frecursive -finit-local-zero
|
481 |
|
|
-finit-integer=N -finit-real=
|
482 |
|
|
-finit-logical= -finit-character=N
|
483 |
|
|
-fno-align-commons -fno-protect-parens
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
* Menu:
|
487 |
|
|
|
488 |
|
|
* Fortran Dialect Options:: Controlling the variant of Fortran language
|
489 |
|
|
compiled.
|
490 |
|
|
* Preprocessing Options:: Enable and customize preprocessing.
|
491 |
|
|
* Error and Warning Options:: How picky should the compiler be?
|
492 |
|
|
* Debugging Options:: Symbol tables, measurements, and debugging dumps.
|
493 |
|
|
* Directory Options:: Where to find module files
|
494 |
|
|
* Link Options :: Influencing the linking step
|
495 |
|
|
* Runtime Options:: Influencing runtime behavior
|
496 |
|
|
* Code Gen Options:: Specifying conventions for function calls, data layout
|
497 |
|
|
and register usage.
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
File: gfortran.info, Node: Fortran Dialect Options, Next: Preprocessing Options, Prev: Option Summary, Up: Invoking GNU Fortran
|
501 |
|
|
|
502 |
|
|
2.2 Options controlling Fortran dialect
|
503 |
|
|
=======================================
|
504 |
|
|
|
505 |
|
|
The following options control the details of the Fortran dialect
|
506 |
|
|
accepted by the compiler:
|
507 |
|
|
|
508 |
|
|
`-ffree-form'
|
509 |
|
|
|
510 |
|
|
`-ffixed-form'
|
511 |
|
|
Specify the layout used by the source file. The free form layout
|
512 |
|
|
was introduced in Fortran 90. Fixed form was traditionally used in
|
513 |
|
|
older Fortran programs. When neither option is specified, the
|
514 |
|
|
source form is determined by the file extension.
|
515 |
|
|
|
516 |
|
|
`-fall-intrinsics'
|
517 |
|
|
This option causes all intrinsic procedures (including the
|
518 |
|
|
GNU-specific extensions) to be accepted. This can be useful with
|
519 |
|
|
`-std=f95' to force standard-compliance but get access to the full
|
520 |
|
|
range of intrinsics available with `gfortran'. As a consequence,
|
521 |
|
|
`-Wintrinsics-std' will be ignored and no user-defined procedure
|
522 |
|
|
with the same name as any intrinsic will be called except when it
|
523 |
|
|
is explicitly declared `EXTERNAL'.
|
524 |
|
|
|
525 |
|
|
`-fd-lines-as-code'
|
526 |
|
|
|
527 |
|
|
`-fd-lines-as-comments'
|
528 |
|
|
Enable special treatment for lines beginning with `d' or `D' in
|
529 |
|
|
fixed form sources. If the `-fd-lines-as-code' option is given
|
530 |
|
|
they are treated as if the first column contained a blank. If the
|
531 |
|
|
`-fd-lines-as-comments' option is given, they are treated as
|
532 |
|
|
comment lines.
|
533 |
|
|
|
534 |
|
|
`-fdefault-double-8'
|
535 |
|
|
Set the `DOUBLE PRECISION' type to an 8 byte wide type. If
|
536 |
|
|
`-fdefault-real-8' is given, `DOUBLE PRECISION' would instead be
|
537 |
|
|
promoted to 16 bytes if possible, and `-fdefault-double-8' can be
|
538 |
|
|
used to prevent this. The kind of real constants like `1.d0' will
|
539 |
|
|
not be changed by `-fdefault-real-8' though, so also
|
540 |
|
|
`-fdefault-double-8' does not affect it.
|
541 |
|
|
|
542 |
|
|
`-fdefault-integer-8'
|
543 |
|
|
Set the default integer and logical types to an 8 byte wide type.
|
544 |
|
|
Do nothing if this is already the default. This option also
|
545 |
|
|
affects the kind of integer constants like `42'.
|
546 |
|
|
|
547 |
|
|
`-fdefault-real-8'
|
548 |
|
|
Set the default real type to an 8 byte wide type. Do nothing if
|
549 |
|
|
this is already the default. This option also affects the kind of
|
550 |
|
|
non-double real constants like `1.0', and does promote the default
|
551 |
|
|
width of `DOUBLE PRECISION' to 16 bytes if possible, unless
|
552 |
|
|
`-fdefault-double-8' is given, too.
|
553 |
|
|
|
554 |
|
|
`-fdollar-ok'
|
555 |
|
|
Allow `$' as a valid non-first character in a symbol name. Symbols
|
556 |
|
|
that start with `$' are rejected since it is unclear which rules to
|
557 |
|
|
apply to implicit typing as different vendors implement different
|
558 |
|
|
rules. Using `$' in `IMPLICIT' statements is also rejected.
|
559 |
|
|
|
560 |
|
|
`-fbackslash'
|
561 |
|
|
Change the interpretation of backslashes in string literals from a
|
562 |
|
|
single backslash character to "C-style" escape characters. The
|
563 |
|
|
following combinations are expanded `\a', `\b', `\f', `\n', `\r',
|
564 |
|
|
`\t', `\v', `\\', and `\0' to the ASCII characters alert,
|
565 |
|
|
backspace, form feed, newline, carriage return, horizontal tab,
|
566 |
|
|
vertical tab, backslash, and NUL, respectively. Additionally,
|
567 |
|
|
`\x'NN, `\u'NNNN and `\U'NNNNNNNN (where each N is a hexadecimal
|
568 |
|
|
digit) are translated into the Unicode characters corresponding to
|
569 |
|
|
the specified code points. All other combinations of a character
|
570 |
|
|
preceded by \ are unexpanded.
|
571 |
|
|
|
572 |
|
|
`-fmodule-private'
|
573 |
|
|
Set the default accessibility of module entities to `PRIVATE'.
|
574 |
|
|
Use-associated entities will not be accessible unless they are
|
575 |
|
|
explicitly declared as `PUBLIC'.
|
576 |
|
|
|
577 |
|
|
`-ffixed-line-length-N'
|
578 |
|
|
Set column after which characters are ignored in typical fixed-form
|
579 |
|
|
lines in the source file, and through which spaces are assumed (as
|
580 |
|
|
if padded to that length) after the ends of short fixed-form lines.
|
581 |
|
|
|
582 |
|
|
Popular values for N include 72 (the standard and the default), 80
|
583 |
|
|
(card image), and 132 (corresponding to "extended-source" options
|
584 |
|
|
in some popular compilers). N may also be `none', meaning that
|
585 |
|
|
the entire line is meaningful and that continued character
|
586 |
|
|
constants never have implicit spaces appended to them to fill out
|
587 |
|
|
the line. `-ffixed-line-length-0' means the same thing as
|
588 |
|
|
`-ffixed-line-length-none'.
|
589 |
|
|
|
590 |
|
|
`-ffree-line-length-N'
|
591 |
|
|
Set column after which characters are ignored in typical free-form
|
592 |
|
|
lines in the source file. The default value is 132. N may be
|
593 |
|
|
`none', meaning that the entire line is meaningful.
|
594 |
|
|
`-ffree-line-length-0' means the same thing as
|
595 |
|
|
`-ffree-line-length-none'.
|
596 |
|
|
|
597 |
|
|
`-fmax-identifier-length=N'
|
598 |
|
|
Specify the maximum allowed identifier length. Typical values are
|
599 |
|
|
31 (Fortran 95) and 63 (Fortran 2003 and Fortran 2008).
|
600 |
|
|
|
601 |
|
|
`-fimplicit-none'
|
602 |
|
|
Specify that no implicit typing is allowed, unless overridden by
|
603 |
|
|
explicit `IMPLICIT' statements. This is the equivalent of adding
|
604 |
|
|
`implicit none' to the start of every procedure.
|
605 |
|
|
|
606 |
|
|
`-fcray-pointer'
|
607 |
|
|
Enable the Cray pointer extension, which provides C-like pointer
|
608 |
|
|
functionality.
|
609 |
|
|
|
610 |
|
|
`-fopenmp'
|
611 |
|
|
Enable the OpenMP extensions. This includes OpenMP `!$omp'
|
612 |
|
|
directives in free form and `c$omp', `*$omp' and `!$omp'
|
613 |
|
|
directives in fixed form, `!$' conditional compilation sentinels
|
614 |
|
|
in free form and `c$', `*$' and `!$' sentinels in fixed form, and
|
615 |
|
|
when linking arranges for the OpenMP runtime library to be linked
|
616 |
|
|
in. The option `-fopenmp' implies `-frecursive'.
|
617 |
|
|
|
618 |
|
|
`-fno-range-check'
|
619 |
|
|
Disable range checking on results of simplification of constant
|
620 |
|
|
expressions during compilation. For example, GNU Fortran will give
|
621 |
|
|
an error at compile time when simplifying `a = 1. / 0'. With this
|
622 |
|
|
option, no error will be given and `a' will be assigned the value
|
623 |
|
|
`+Infinity'. If an expression evaluates to a value outside of the
|
624 |
|
|
relevant range of [`-HUGE()':`HUGE()'], then the expression will
|
625 |
|
|
be replaced by `-Inf' or `+Inf' as appropriate. Similarly, `DATA
|
626 |
|
|
i/Z'FFFFFFFF'/' will result in an integer overflow on most
|
627 |
|
|
systems, but with `-fno-range-check' the value will "wrap around"
|
628 |
|
|
and `i' will be initialized to -1 instead.
|
629 |
|
|
|
630 |
|
|
`-std=STD'
|
631 |
|
|
Specify the standard to which the program is expected to conform,
|
632 |
|
|
which may be one of `f95', `f2003', `f2008', `gnu', or `legacy'.
|
633 |
|
|
The default value for STD is `gnu', which specifies a superset of
|
634 |
|
|
the Fortran 95 standard that includes all of the extensions
|
635 |
|
|
supported by GNU Fortran, although warnings will be given for
|
636 |
|
|
obsolete extensions not recommended for use in new code. The
|
637 |
|
|
`legacy' value is equivalent but without the warnings for obsolete
|
638 |
|
|
extensions, and may be useful for old non-standard programs. The
|
639 |
|
|
`f95', `f2003' and `f2008' values specify strict conformance to
|
640 |
|
|
the Fortran 95, Fortran 2003 and Fortran 2008 standards,
|
641 |
|
|
respectively; errors are given for all extensions beyond the
|
642 |
|
|
relevant language standard, and warnings are given for the Fortran
|
643 |
|
|
77 features that are permitted but obsolescent in later standards.
|
644 |
|
|
|
645 |
|
|
|
646 |
|
|
|
647 |
|
|
File: gfortran.info, Node: Preprocessing Options, Next: Error and Warning Options, Prev: Fortran Dialect Options, Up: Invoking GNU Fortran
|
648 |
|
|
|
649 |
|
|
2.3 Enable and customize preprocessing
|
650 |
|
|
======================================
|
651 |
|
|
|
652 |
|
|
Preprocessor related options. See section *note Preprocessing and
|
653 |
|
|
conditional compilation:: for more detailed information on
|
654 |
|
|
preprocessing in `gfortran'.
|
655 |
|
|
|
656 |
|
|
`-cpp'
|
657 |
|
|
|
658 |
|
|
`-nocpp'
|
659 |
|
|
Enable preprocessing. The preprocessor is automatically invoked if
|
660 |
|
|
the file extension is `.fpp', `.FPP', `.F', `.FOR', `.FTN',
|
661 |
|
|
`.F90', `.F95', `.F03' or `.F08'. Use this option to manually
|
662 |
|
|
enable preprocessing of any kind of Fortran file.
|
663 |
|
|
|
664 |
|
|
To disable preprocessing of files with any of the above listed
|
665 |
|
|
extensions, use the negative form: `-nocpp'.
|
666 |
|
|
|
667 |
|
|
The preprocessor is run in traditional mode, be aware that any
|
668 |
|
|
restrictions of the file-format, e.g. fixed-form line width, apply
|
669 |
|
|
for preprocessed output as well.
|
670 |
|
|
|
671 |
|
|
`-dM'
|
672 |
|
|
Instead of the normal output, generate a list of `'#define''
|
673 |
|
|
directives for all the macros defined during the execution of the
|
674 |
|
|
preprocessor, including predefined macros. This gives you a way of
|
675 |
|
|
finding out what is predefined in your version of the preprocessor.
|
676 |
|
|
Assuming you have no file `foo.f90', the command
|
677 |
|
|
touch foo.f90; gfortran -cpp -dM foo.f90
|
678 |
|
|
will show all the predefined macros.
|
679 |
|
|
|
680 |
|
|
`-dD'
|
681 |
|
|
Like `-dM' except in two respects: it does not include the
|
682 |
|
|
predefined macros, and it outputs both the `#define' directives
|
683 |
|
|
and the result of preprocessing. Both kinds of output go to the
|
684 |
|
|
standard output file.
|
685 |
|
|
|
686 |
|
|
`-dN'
|
687 |
|
|
Like `-dD', but emit only the macro names, not their expansions.
|
688 |
|
|
|
689 |
|
|
`-dU'
|
690 |
|
|
Like `dD' except that only macros that are expanded, or whose
|
691 |
|
|
definedness is tested in preprocessor directives, are output; the
|
692 |
|
|
output is delayed until the use or test of the macro; and
|
693 |
|
|
`'#undef'' directives are also output for macros tested but
|
694 |
|
|
undefined at the time.
|
695 |
|
|
|
696 |
|
|
`-dI'
|
697 |
|
|
Output `'#include'' directives in addition to the result of
|
698 |
|
|
preprocessing.
|
699 |
|
|
|
700 |
|
|
`-fworking-directory'
|
701 |
|
|
Enable generation of linemarkers in the preprocessor output that
|
702 |
|
|
will let the compiler know the current working directory at the
|
703 |
|
|
time of preprocessing. When this option is enabled, the
|
704 |
|
|
preprocessor will emit, after the initial linemarker, a second
|
705 |
|
|
linemarker with the current working directory followed by two
|
706 |
|
|
slashes. GCC will use this directory, when it's present in the
|
707 |
|
|
preprocessed input, as the directory emitted as the current
|
708 |
|
|
working directory in some debugging information formats. This
|
709 |
|
|
option is implicitly enabled if debugging information is enabled,
|
710 |
|
|
but this can be inhibited with the negated form
|
711 |
|
|
`-fno-working-directory'. If the `-P' flag is present in the
|
712 |
|
|
command line, this option has no effect, since no `#line'
|
713 |
|
|
directives are emitted whatsoever.
|
714 |
|
|
|
715 |
|
|
`-idirafter DIR'
|
716 |
|
|
Search DIR for include files, but do it after all directories
|
717 |
|
|
specified with `-I' and the standard system directories have been
|
718 |
|
|
exhausted. DIR is treated as a system include directory. If dir
|
719 |
|
|
begins with `=', then the `=' will be replaced by the sysroot
|
720 |
|
|
prefix; see `--sysroot' and `-isysroot'.
|
721 |
|
|
|
722 |
|
|
`-imultilib DIR'
|
723 |
|
|
Use DIR as a subdirectory of the directory containing
|
724 |
|
|
target-specific C++ headers.
|
725 |
|
|
|
726 |
|
|
`-iprefix PREFIX'
|
727 |
|
|
Specify PREFIX as the prefix for subsequent `-iwithprefix'
|
728 |
|
|
options. If the PREFIX represents a directory, you should include
|
729 |
|
|
the final `'/''.
|
730 |
|
|
|
731 |
|
|
`-isysroot DIR'
|
732 |
|
|
This option is like the `--sysroot' option, but applies only to
|
733 |
|
|
header files. See the `--sysroot' option for more information.
|
734 |
|
|
|
735 |
|
|
`-iquote DIR'
|
736 |
|
|
Search DIR only for header files requested with `#include "file"';
|
737 |
|
|
they are not searched for `#include ', before all directories
|
738 |
|
|
specified by `-I' and before the standard system directories. If
|
739 |
|
|
DIR begins with `=', then the `=' will be replaced by the sysroot
|
740 |
|
|
prefix; see `--sysroot' and `-isysroot'.
|
741 |
|
|
|
742 |
|
|
`-isystem DIR'
|
743 |
|
|
Search DIR for header files, after all directories specified by
|
744 |
|
|
`-I' but before the standard system directories. Mark it as a
|
745 |
|
|
system directory, so that it gets the same special treatment as is
|
746 |
|
|
applied to the standard system directories. If DIR begins with
|
747 |
|
|
`=', then the `=' will be replaced by the sysroot prefix; see
|
748 |
|
|
`--sysroot' and `-isysroot'.
|
749 |
|
|
|
750 |
|
|
`-nostdinc'
|
751 |
|
|
Do not search the standard system directories for header files.
|
752 |
|
|
Only the directories you have specified with `-I' options (and the
|
753 |
|
|
directory of the current file, if appropriate) are searched.
|
754 |
|
|
|
755 |
|
|
`-undef'
|
756 |
|
|
Do not predefine any system-specific or GCC-specific macros. The
|
757 |
|
|
standard predefined macros remain defined.
|
758 |
|
|
|
759 |
|
|
`-APREDICATE=ANSWER'
|
760 |
|
|
Make an assertion with the predicate PREDICATE and answer ANSWER.
|
761 |
|
|
This form is preferred to the older form -A predicate(answer),
|
762 |
|
|
which is still supported, because it does not use shell special
|
763 |
|
|
characters.
|
764 |
|
|
|
765 |
|
|
`-A-PREDICATE=ANSWER'
|
766 |
|
|
Cancel an assertion with the predicate PREDICATE and answer ANSWER.
|
767 |
|
|
|
768 |
|
|
`-C'
|
769 |
|
|
Do not discard comments. All comments are passed through to the
|
770 |
|
|
output file, except for comments in processed directives, which
|
771 |
|
|
are deleted along with the directive.
|
772 |
|
|
|
773 |
|
|
You should be prepared for side effects when using `-C'; it causes
|
774 |
|
|
the preprocessor to treat comments as tokens in their own right.
|
775 |
|
|
For example, comments appearing at the start of what would be a
|
776 |
|
|
directive line have the effect of turning that line into an
|
777 |
|
|
ordinary source line, since the first token on the line is no
|
778 |
|
|
longer a `'#''.
|
779 |
|
|
|
780 |
|
|
Warning: this currently handles C-Style comments only. The
|
781 |
|
|
preprocessor does not yet recognize Fortran-style comments.
|
782 |
|
|
|
783 |
|
|
`-CC'
|
784 |
|
|
Do not discard comments, including during macro expansion. This is
|
785 |
|
|
like `-C', except that comments contained within macros are also
|
786 |
|
|
passed through to the output file where the macro is expanded.
|
787 |
|
|
|
788 |
|
|
In addition to the side-effects of the `-C' option, the `-CC'
|
789 |
|
|
option causes all C++-style comments inside a macro to be
|
790 |
|
|
converted to C-style comments. This is to prevent later use of
|
791 |
|
|
that macro from inadvertently commenting out the remainder of the
|
792 |
|
|
source line. The `-CC' option is generally used to support lint
|
793 |
|
|
comments.
|
794 |
|
|
|
795 |
|
|
Warning: this currently handles C- and C++-Style comments only. The
|
796 |
|
|
preprocessor does not yet recognize Fortran-style comments.
|
797 |
|
|
|
798 |
|
|
`-DNAME'
|
799 |
|
|
Predefine name as a macro, with definition `1'.
|
800 |
|
|
|
801 |
|
|
`-DNAME=DEFINITION'
|
802 |
|
|
The contents of DEFINITION are tokenized and processed as if they
|
803 |
|
|
appeared during translation phase three in a `'#define'' directive.
|
804 |
|
|
In particular, the definition will be truncated by embedded newline
|
805 |
|
|
characters.
|
806 |
|
|
|
807 |
|
|
If you are invoking the preprocessor from a shell or shell-like
|
808 |
|
|
program you may need to use the shell's quoting syntax to protect
|
809 |
|
|
characters such as spaces that have a meaning in the shell syntax.
|
810 |
|
|
|
811 |
|
|
If you wish to define a function-like macro on the command line,
|
812 |
|
|
write its argument list with surrounding parentheses before the
|
813 |
|
|
equals sign (if any). Parentheses are meaningful to most shells,
|
814 |
|
|
so you will need to quote the option. With sh and csh,
|
815 |
|
|
`-D'name(args...)=definition'' works.
|
816 |
|
|
|
817 |
|
|
`-D' and `-U' options are processed in the order they are given on
|
818 |
|
|
the command line. All -imacros file and -include file options are
|
819 |
|
|
processed after all -D and -U options.
|
820 |
|
|
|
821 |
|
|
`-H'
|
822 |
|
|
Print the name of each header file used, in addition to other
|
823 |
|
|
normal activities. Each name is indented to show how deep in the
|
824 |
|
|
`'#include'' stack it is.
|
825 |
|
|
|
826 |
|
|
`-P'
|
827 |
|
|
Inhibit generation of linemarkers in the output from the
|
828 |
|
|
preprocessor. This might be useful when running the preprocessor
|
829 |
|
|
on something that is not C code, and will be sent to a program
|
830 |
|
|
which might be confused by the linemarkers.
|
831 |
|
|
|
832 |
|
|
`-UNAME'
|
833 |
|
|
Cancel any previous definition of NAME, either built in or provided
|
834 |
|
|
with a `-D' option.
|
835 |
|
|
|
836 |
|
|
|
837 |
|
|
File: gfortran.info, Node: Error and Warning Options, Next: Debugging Options, Prev: Preprocessing Options, Up: Invoking GNU Fortran
|
838 |
|
|
|
839 |
|
|
2.4 Options to request or suppress errors and warnings
|
840 |
|
|
======================================================
|
841 |
|
|
|
842 |
|
|
Errors are diagnostic messages that report that the GNU Fortran compiler
|
843 |
|
|
cannot compile the relevant piece of source code. The compiler will
|
844 |
|
|
continue to process the program in an attempt to report further errors
|
845 |
|
|
to aid in debugging, but will not produce any compiled output.
|
846 |
|
|
|
847 |
|
|
Warnings are diagnostic messages that report constructions which are
|
848 |
|
|
not inherently erroneous but which are risky or suggest there is likely
|
849 |
|
|
to be a bug in the program. Unless `-Werror' is specified, they do not
|
850 |
|
|
prevent compilation of the program.
|
851 |
|
|
|
852 |
|
|
You can request many specific warnings with options beginning `-W',
|
853 |
|
|
for example `-Wimplicit' to request warnings on implicit declarations.
|
854 |
|
|
Each of these specific warning options also has a negative form
|
855 |
|
|
beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'.
|
856 |
|
|
This manual lists only one of the two forms, whichever is not the
|
857 |
|
|
default.
|
858 |
|
|
|
859 |
|
|
These options control the amount and kinds of errors and warnings
|
860 |
|
|
produced by GNU Fortran:
|
861 |
|
|
|
862 |
|
|
`-fmax-errors=N'
|
863 |
|
|
Limits the maximum number of error messages to N, at which point
|
864 |
|
|
GNU Fortran bails out rather than attempting to continue
|
865 |
|
|
processing the source code. If N is 0, there is no limit on the
|
866 |
|
|
number of error messages produced.
|
867 |
|
|
|
868 |
|
|
`-fsyntax-only'
|
869 |
|
|
Check the code for syntax errors, but don't actually compile it.
|
870 |
|
|
This will generate module files for each module present in the
|
871 |
|
|
code, but no other output file.
|
872 |
|
|
|
873 |
|
|
`-pedantic'
|
874 |
|
|
Issue warnings for uses of extensions to Fortran 95. `-pedantic'
|
875 |
|
|
also applies to C-language constructs where they occur in GNU
|
876 |
|
|
Fortran source files, such as use of `\e' in a character constant
|
877 |
|
|
within a directive like `#include'.
|
878 |
|
|
|
879 |
|
|
Valid Fortran 95 programs should compile properly with or without
|
880 |
|
|
this option. However, without this option, certain GNU extensions
|
881 |
|
|
and traditional Fortran features are supported as well. With this
|
882 |
|
|
option, many of them are rejected.
|
883 |
|
|
|
884 |
|
|
Some users try to use `-pedantic' to check programs for
|
885 |
|
|
conformance. They soon find that it does not do quite what they
|
886 |
|
|
want--it finds some nonstandard practices, but not all. However,
|
887 |
|
|
improvements to GNU Fortran in this area are welcome.
|
888 |
|
|
|
889 |
|
|
This should be used in conjunction with `-std=f95', `-std=f2003'
|
890 |
|
|
or `-std=f2008'.
|
891 |
|
|
|
892 |
|
|
`-pedantic-errors'
|
893 |
|
|
Like `-pedantic', except that errors are produced rather than
|
894 |
|
|
warnings.
|
895 |
|
|
|
896 |
|
|
`-Wall'
|
897 |
|
|
Enables commonly used warning options pertaining to usage that we
|
898 |
|
|
recommend avoiding and that we believe are easy to avoid. This
|
899 |
|
|
currently includes `-Waliasing', `-Wampersand', `-Wsurprising',
|
900 |
|
|
`-Wintrinsics-std', `-Wno-tabs', `-Wintrinsic-shadow' and
|
901 |
|
|
`-Wline-truncation'.
|
902 |
|
|
|
903 |
|
|
`-Waliasing'
|
904 |
|
|
Warn about possible aliasing of dummy arguments. Specifically, it
|
905 |
|
|
warns if the same actual argument is associated with a dummy
|
906 |
|
|
argument with `INTENT(IN)' and a dummy argument with `INTENT(OUT)'
|
907 |
|
|
in a call with an explicit interface.
|
908 |
|
|
|
909 |
|
|
The following example will trigger the warning.
|
910 |
|
|
interface
|
911 |
|
|
subroutine bar(a,b)
|
912 |
|
|
integer, intent(in) :: a
|
913 |
|
|
integer, intent(out) :: b
|
914 |
|
|
end subroutine
|
915 |
|
|
end interface
|
916 |
|
|
integer :: a
|
917 |
|
|
|
918 |
|
|
call bar(a,a)
|
919 |
|
|
|
920 |
|
|
`-Wampersand'
|
921 |
|
|
Warn about missing ampersand in continued character constants. The
|
922 |
|
|
warning is given with `-Wampersand', `-pedantic', `-std=f95',
|
923 |
|
|
`-std=f2003' and `-std=f2008'. Note: With no ampersand given in a
|
924 |
|
|
continued character constant, GNU Fortran assumes continuation at
|
925 |
|
|
the first non-comment, non-whitespace character after the ampersand
|
926 |
|
|
that initiated the continuation.
|
927 |
|
|
|
928 |
|
|
`-Warray-temporaries'
|
929 |
|
|
Warn about array temporaries generated by the compiler. The
|
930 |
|
|
information generated by this warning is sometimes useful in
|
931 |
|
|
optimization, in order to avoid such temporaries.
|
932 |
|
|
|
933 |
|
|
`-Wcharacter-truncation'
|
934 |
|
|
Warn when a character assignment will truncate the assigned string.
|
935 |
|
|
|
936 |
|
|
`-Wline-truncation'
|
937 |
|
|
Warn when a source code line will be truncated.
|
938 |
|
|
|
939 |
|
|
`-Wconversion'
|
940 |
|
|
Warn about implicit conversions between different types.
|
941 |
|
|
|
942 |
|
|
`-Wimplicit-interface'
|
943 |
|
|
Warn if a procedure is called without an explicit interface. Note
|
944 |
|
|
this only checks that an explicit interface is present. It does
|
945 |
|
|
not check that the declared interfaces are consistent across
|
946 |
|
|
program units.
|
947 |
|
|
|
948 |
|
|
`-Wimplicit-procedure'
|
949 |
|
|
Warn if a procedure is called that has neither an explicit
|
950 |
|
|
interface nor has been declared as `EXTERNAL'.
|
951 |
|
|
|
952 |
|
|
`-Wintrinsics-std'
|
953 |
|
|
Warn if `gfortran' finds a procedure named like an intrinsic not
|
954 |
|
|
available in the currently selected standard (with `-std') and
|
955 |
|
|
treats it as `EXTERNAL' procedure because of this.
|
956 |
|
|
`-fall-intrinsics' can be used to never trigger this behavior and
|
957 |
|
|
always link to the intrinsic regardless of the selected standard.
|
958 |
|
|
|
959 |
|
|
`-Wsurprising'
|
960 |
|
|
Produce a warning when "suspicious" code constructs are
|
961 |
|
|
encountered. While technically legal these usually indicate that
|
962 |
|
|
an error has been made.
|
963 |
|
|
|
964 |
|
|
This currently produces a warning under the following
|
965 |
|
|
circumstances:
|
966 |
|
|
|
967 |
|
|
* An INTEGER SELECT construct has a CASE that can never be
|
968 |
|
|
matched as its lower value is greater than its upper value.
|
969 |
|
|
|
970 |
|
|
* A LOGICAL SELECT construct has three CASE statements.
|
971 |
|
|
|
972 |
|
|
* A TRANSFER specifies a source that is shorter than the
|
973 |
|
|
destination.
|
974 |
|
|
|
975 |
|
|
* The type of a function result is declared more than once with
|
976 |
|
|
the same type. If `-pedantic' or standard-conforming mode is
|
977 |
|
|
enabled, this is an error.
|
978 |
|
|
|
979 |
|
|
* A `CHARACTER' variable is declared with negative length.
|
980 |
|
|
|
981 |
|
|
`-Wtabs'
|
982 |
|
|
By default, tabs are accepted as whitespace, but tabs are not
|
983 |
|
|
members of the Fortran Character Set. For continuation lines, a
|
984 |
|
|
tab followed by a digit between 1 and 9 is supported. `-Wno-tabs'
|
985 |
|
|
will cause a warning to be issued if a tab is encountered. Note,
|
986 |
|
|
`-Wno-tabs' is active for `-pedantic', `-std=f95', `-std=f2003',
|
987 |
|
|
`-std=f2008' and `-Wall'.
|
988 |
|
|
|
989 |
|
|
`-Wunderflow'
|
990 |
|
|
Produce a warning when numerical constant expressions are
|
991 |
|
|
encountered, which yield an UNDERFLOW during compilation.
|
992 |
|
|
|
993 |
|
|
`-Wintrinsic-shadow'
|
994 |
|
|
Warn if a user-defined procedure or module procedure has the same
|
995 |
|
|
name as an intrinsic; in this case, an explicit interface or
|
996 |
|
|
`EXTERNAL' or `INTRINSIC' declaration might be needed to get calls
|
997 |
|
|
later resolved to the desired intrinsic/procedure.
|
998 |
|
|
|
999 |
|
|
`-Wunused-parameter'
|
1000 |
|
|
Contrary to `gcc''s meaning of `-Wunused-parameter', `gfortran''s
|
1001 |
|
|
implementation of this option does not warn about unused dummy
|
1002 |
|
|
arguments, but about unused `PARAMETER' values.
|
1003 |
|
|
`-Wunused-parameter' is not included in `-Wall' but is implied by
|
1004 |
|
|
`-Wall -Wextra'.
|
1005 |
|
|
|
1006 |
|
|
`-Walign-commons'
|
1007 |
|
|
By default, `gfortran' warns about any occasion of variables being
|
1008 |
|
|
padded for proper alignment inside a COMMON block. This warning
|
1009 |
|
|
can be turned off via `-Wno-align-commons'. See also
|
1010 |
|
|
`-falign-commons'.
|
1011 |
|
|
|
1012 |
|
|
`-Werror'
|
1013 |
|
|
Turns all warnings into errors.
|
1014 |
|
|
|
1015 |
|
|
*Note Options to Request or Suppress Errors and Warnings: (gcc)Error
|
1016 |
|
|
and Warning Options, for information on more options offered by the GBE
|
1017 |
|
|
shared by `gfortran', `gcc' and other GNU compilers.
|
1018 |
|
|
|
1019 |
|
|
Some of these have no effect when compiling programs written in
|
1020 |
|
|
Fortran.
|
1021 |
|
|
|
1022 |
|
|
|
1023 |
|
|
File: gfortran.info, Node: Debugging Options, Next: Directory Options, Prev: Error and Warning Options, Up: Invoking GNU Fortran
|
1024 |
|
|
|
1025 |
|
|
2.5 Options for debugging your program or GNU Fortran
|
1026 |
|
|
=====================================================
|
1027 |
|
|
|
1028 |
|
|
GNU Fortran has various special options that are used for debugging
|
1029 |
|
|
either your program or the GNU Fortran compiler.
|
1030 |
|
|
|
1031 |
|
|
`-fdump-parse-tree'
|
1032 |
|
|
Output the internal parse tree before starting code generation.
|
1033 |
|
|
Only really useful for debugging the GNU Fortran compiler itself.
|
1034 |
|
|
|
1035 |
|
|
`-ffpe-trap=LIST'
|
1036 |
|
|
Specify a list of IEEE exceptions when a Floating Point Exception
|
1037 |
|
|
(FPE) should be raised. On most systems, this will result in a
|
1038 |
|
|
SIGFPE signal being sent and the program being interrupted,
|
1039 |
|
|
producing a core file useful for debugging. LIST is a (possibly
|
1040 |
|
|
empty) comma-separated list of the following IEEE exceptions:
|
1041 |
|
|
`invalid' (invalid floating point operation, such as
|
1042 |
|
|
`SQRT(-1.0)'), `zero' (division by zero), `overflow' (overflow in
|
1043 |
|
|
a floating point operation), `underflow' (underflow in a floating
|
1044 |
|
|
point operation), `precision' (loss of precision during operation)
|
1045 |
|
|
and `denormal' (operation produced a denormal value).
|
1046 |
|
|
|
1047 |
|
|
Some of the routines in the Fortran runtime library, like
|
1048 |
|
|
`CPU_TIME', are likely to trigger floating point exceptions when
|
1049 |
|
|
`ffpe-trap=precision' is used. For this reason, the use of
|
1050 |
|
|
`ffpe-trap=precision' is not recommended.
|
1051 |
|
|
|
1052 |
|
|
`-fbacktrace'
|
1053 |
|
|
Specify that, when a runtime error is encountered or a deadly
|
1054 |
|
|
signal is emitted (segmentation fault, illegal instruction, bus
|
1055 |
|
|
error or floating-point exception), the Fortran runtime library
|
1056 |
|
|
should output a backtrace of the error. This option only has
|
1057 |
|
|
influence for compilation of the Fortran main program.
|
1058 |
|
|
|
1059 |
|
|
`-fdump-core'
|
1060 |
|
|
Request that a core-dump file is written to disk when a runtime
|
1061 |
|
|
error is encountered on systems that support core dumps. This
|
1062 |
|
|
option is only effective for the compilation of the Fortran main
|
1063 |
|
|
program.
|
1064 |
|
|
|
1065 |
|
|
*Note Options for Debugging Your Program or GCC: (gcc)Debugging
|
1066 |
|
|
Options, for more information on debugging options.
|
1067 |
|
|
|
1068 |
|
|
|
1069 |
|
|
File: gfortran.info, Node: Directory Options, Next: Link Options, Prev: Debugging Options, Up: Invoking GNU Fortran
|
1070 |
|
|
|
1071 |
|
|
2.6 Options for directory search
|
1072 |
|
|
================================
|
1073 |
|
|
|
1074 |
|
|
These options affect how GNU Fortran searches for files specified by
|
1075 |
|
|
the `INCLUDE' directive and where it searches for previously compiled
|
1076 |
|
|
modules.
|
1077 |
|
|
|
1078 |
|
|
It also affects the search paths used by `cpp' when used to
|
1079 |
|
|
preprocess Fortran source.
|
1080 |
|
|
|
1081 |
|
|
`-IDIR'
|
1082 |
|
|
These affect interpretation of the `INCLUDE' directive (as well as
|
1083 |
|
|
of the `#include' directive of the `cpp' preprocessor).
|
1084 |
|
|
|
1085 |
|
|
Also note that the general behavior of `-I' and `INCLUDE' is
|
1086 |
|
|
pretty much the same as of `-I' with `#include' in the `cpp'
|
1087 |
|
|
preprocessor, with regard to looking for `header.gcc' files and
|
1088 |
|
|
other such things.
|
1089 |
|
|
|
1090 |
|
|
This path is also used to search for `.mod' files when previously
|
1091 |
|
|
compiled modules are required by a `USE' statement.
|
1092 |
|
|
|
1093 |
|
|
*Note Options for Directory Search: (gcc)Directory Options, for
|
1094 |
|
|
information on the `-I' option.
|
1095 |
|
|
|
1096 |
|
|
`-JDIR'
|
1097 |
|
|
|
1098 |
|
|
`-MDIR'
|
1099 |
|
|
This option specifies where to put `.mod' files for compiled
|
1100 |
|
|
modules. It is also added to the list of directories to searched
|
1101 |
|
|
by an `USE' statement.
|
1102 |
|
|
|
1103 |
|
|
The default is the current directory.
|
1104 |
|
|
|
1105 |
|
|
`-M' is deprecated to avoid conflicts with existing GCC options.
|
1106 |
|
|
|
1107 |
|
|
`-fintrinsic-modules-path DIR'
|
1108 |
|
|
This option specifies the location of pre-compiled intrinsic
|
1109 |
|
|
modules, if they are not in the default location expected by the
|
1110 |
|
|
compiler.
|
1111 |
|
|
|
1112 |
|
|
|
1113 |
|
|
File: gfortran.info, Node: Link Options, Next: Runtime Options, Prev: Directory Options, Up: Invoking GNU Fortran
|
1114 |
|
|
|
1115 |
|
|
2.7 Influencing the linking step
|
1116 |
|
|
================================
|
1117 |
|
|
|
1118 |
|
|
These options come into play when the compiler links object files into
|
1119 |
|
|
an executable output file. They are meaningless if the compiler is not
|
1120 |
|
|
doing a link step.
|
1121 |
|
|
|
1122 |
|
|
`-static-libgfortran'
|
1123 |
|
|
On systems that provide `libgfortran' as a shared and a static
|
1124 |
|
|
library, this option forces the use of the static version. If no
|
1125 |
|
|
shared version of `libgfortran' was built when the compiler was
|
1126 |
|
|
configured, this option has no effect.
|
1127 |
|
|
|
1128 |
|
|
|
1129 |
|
|
File: gfortran.info, Node: Runtime Options, Next: Code Gen Options, Prev: Link Options, Up: Invoking GNU Fortran
|
1130 |
|
|
|
1131 |
|
|
2.8 Influencing runtime behavior
|
1132 |
|
|
================================
|
1133 |
|
|
|
1134 |
|
|
These options affect the runtime behavior of programs compiled with GNU
|
1135 |
|
|
Fortran.
|
1136 |
|
|
`-fconvert=CONVERSION'
|
1137 |
|
|
Specify the representation of data for unformatted files. Valid
|
1138 |
|
|
values for conversion are: `native', the default; `swap', swap
|
1139 |
|
|
between big- and little-endian; `big-endian', use big-endian
|
1140 |
|
|
representation for unformatted files; `little-endian', use
|
1141 |
|
|
little-endian representation for unformatted files.
|
1142 |
|
|
|
1143 |
|
|
_This option has an effect only when used in the main program.
|
1144 |
|
|
The `CONVERT' specifier and the GFORTRAN_CONVERT_UNIT environment
|
1145 |
|
|
variable override the default specified by `-fconvert'._
|
1146 |
|
|
|
1147 |
|
|
`-fno-range-check'
|
1148 |
|
|
Disable range checking of input values during integer `READ'
|
1149 |
|
|
operations. For example, GNU Fortran will give an error if an
|
1150 |
|
|
input value is outside of the relevant range of
|
1151 |
|
|
[`-HUGE()':`HUGE()']. In other words, with `INTEGER (kind=4) :: i'
|
1152 |
|
|
, attempting to read -2147483648 will give an error unless
|
1153 |
|
|
`-fno-range-check' is given.
|
1154 |
|
|
|
1155 |
|
|
`-frecord-marker=LENGTH'
|
1156 |
|
|
Specify the length of record markers for unformatted files. Valid
|
1157 |
|
|
values for LENGTH are 4 and 8. Default is 4. _This is different
|
1158 |
|
|
from previous versions of `gfortran'_, which specified a default
|
1159 |
|
|
record marker length of 8 on most systems. If you want to read or
|
1160 |
|
|
write files compatible with earlier versions of `gfortran', use
|
1161 |
|
|
`-frecord-marker=8'.
|
1162 |
|
|
|
1163 |
|
|
`-fmax-subrecord-length=LENGTH'
|
1164 |
|
|
Specify the maximum length for a subrecord. The maximum permitted
|
1165 |
|
|
value for length is 2147483639, which is also the default. Only
|
1166 |
|
|
really useful for use by the gfortran testsuite.
|
1167 |
|
|
|
1168 |
|
|
`-fsign-zero'
|
1169 |
|
|
When enabled, floating point numbers of value zero with the sign
|
1170 |
|
|
bit set are written as negative number in formatted output and
|
1171 |
|
|
treated as negative in the `SIGN' intrinsic. `fno-sign-zero' does
|
1172 |
|
|
not print the negative sign of zero values and regards zero as
|
1173 |
|
|
positive number in the `SIGN' intrinsic for compatibility with F77.
|
1174 |
|
|
Default behavior is to show the negative sign.
|
1175 |
|
|
|
1176 |
|
|
|
1177 |
|
|
File: gfortran.info, Node: Code Gen Options, Next: Environment Variables, Prev: Runtime Options, Up: Invoking GNU Fortran
|
1178 |
|
|
|
1179 |
|
|
2.9 Options for code generation conventions
|
1180 |
|
|
===========================================
|
1181 |
|
|
|
1182 |
|
|
These machine-independent options control the interface conventions
|
1183 |
|
|
used in code generation.
|
1184 |
|
|
|
1185 |
|
|
Most of them have both positive and negative forms; the negative form
|
1186 |
|
|
of `-ffoo' would be `-fno-foo'. In the table below, only one of the
|
1187 |
|
|
forms is listed--the one which is not the default. You can figure out
|
1188 |
|
|
the other form by either removing `no-' or adding it.
|
1189 |
|
|
|
1190 |
|
|
`-fno-automatic'
|
1191 |
|
|
Treat each program unit (except those marked as RECURSIVE) as if
|
1192 |
|
|
the `SAVE' statement were specified for every local variable and
|
1193 |
|
|
array referenced in it. Does not affect common blocks. (Some
|
1194 |
|
|
Fortran compilers provide this option under the name `-static' or
|
1195 |
|
|
`-save'.) The default, which is `-fautomatic', uses the stack for
|
1196 |
|
|
local variables smaller than the value given by
|
1197 |
|
|
`-fmax-stack-var-size'. Use the option `-frecursive' to use no
|
1198 |
|
|
static memory.
|
1199 |
|
|
|
1200 |
|
|
`-ff2c'
|
1201 |
|
|
Generate code designed to be compatible with code generated by
|
1202 |
|
|
`g77' and `f2c'.
|
1203 |
|
|
|
1204 |
|
|
The calling conventions used by `g77' (originally implemented in
|
1205 |
|
|
`f2c') require functions that return type default `REAL' to
|
1206 |
|
|
actually return the C type `double', and functions that return
|
1207 |
|
|
type `COMPLEX' to return the values via an extra argument in the
|
1208 |
|
|
calling sequence that points to where to store the return value.
|
1209 |
|
|
Under the default GNU calling conventions, such functions simply
|
1210 |
|
|
return their results as they would in GNU C--default `REAL'
|
1211 |
|
|
functions return the C type `float', and `COMPLEX' functions
|
1212 |
|
|
return the GNU C type `complex'. Additionally, this option
|
1213 |
|
|
implies the `-fsecond-underscore' option, unless
|
1214 |
|
|
`-fno-second-underscore' is explicitly requested.
|
1215 |
|
|
|
1216 |
|
|
This does not affect the generation of code that interfaces with
|
1217 |
|
|
the `libgfortran' library.
|
1218 |
|
|
|
1219 |
|
|
_Caution:_ It is not a good idea to mix Fortran code compiled with
|
1220 |
|
|
`-ff2c' with code compiled with the default `-fno-f2c' calling
|
1221 |
|
|
conventions as, calling `COMPLEX' or default `REAL' functions
|
1222 |
|
|
between program parts which were compiled with different calling
|
1223 |
|
|
conventions will break at execution time.
|
1224 |
|
|
|
1225 |
|
|
_Caution:_ This will break code which passes intrinsic functions
|
1226 |
|
|
of type default `REAL' or `COMPLEX' as actual arguments, as the
|
1227 |
|
|
library implementations use the `-fno-f2c' calling conventions.
|
1228 |
|
|
|
1229 |
|
|
`-fno-underscoring'
|
1230 |
|
|
Do not transform names of entities specified in the Fortran source
|
1231 |
|
|
file by appending underscores to them.
|
1232 |
|
|
|
1233 |
|
|
With `-funderscoring' in effect, GNU Fortran appends one
|
1234 |
|
|
underscore to external names with no underscores. This is done to
|
1235 |
|
|
ensure compatibility with code produced by many UNIX Fortran
|
1236 |
|
|
compilers.
|
1237 |
|
|
|
1238 |
|
|
_Caution_: The default behavior of GNU Fortran is incompatible
|
1239 |
|
|
with `f2c' and `g77', please use the `-ff2c' option if you want
|
1240 |
|
|
object files compiled with GNU Fortran to be compatible with
|
1241 |
|
|
object code created with these tools.
|
1242 |
|
|
|
1243 |
|
|
Use of `-fno-underscoring' is not recommended unless you are
|
1244 |
|
|
experimenting with issues such as integration of GNU Fortran into
|
1245 |
|
|
existing system environments (vis-a`-vis existing libraries, tools,
|
1246 |
|
|
and so on).
|
1247 |
|
|
|
1248 |
|
|
For example, with `-funderscoring', and assuming other defaults
|
1249 |
|
|
like `-fcase-lower' and that `j()' and `max_count()' are external
|
1250 |
|
|
functions while `my_var' and `lvar' are local variables, a
|
1251 |
|
|
statement like
|
1252 |
|
|
I = J() + MAX_COUNT (MY_VAR, LVAR)
|
1253 |
|
|
is implemented as something akin to:
|
1254 |
|
|
i = j_() + max_count__(&my_var__, &lvar);
|
1255 |
|
|
|
1256 |
|
|
With `-fno-underscoring', the same statement is implemented as:
|
1257 |
|
|
|
1258 |
|
|
i = j() + max_count(&my_var, &lvar);
|
1259 |
|
|
|
1260 |
|
|
Use of `-fno-underscoring' allows direct specification of
|
1261 |
|
|
user-defined names while debugging and when interfacing GNU Fortran
|
1262 |
|
|
code with other languages.
|
1263 |
|
|
|
1264 |
|
|
Note that just because the names match does _not_ mean that the
|
1265 |
|
|
interface implemented by GNU Fortran for an external name matches
|
1266 |
|
|
the interface implemented by some other language for that same
|
1267 |
|
|
name. That is, getting code produced by GNU Fortran to link to
|
1268 |
|
|
code produced by some other compiler using this or any other
|
1269 |
|
|
method can be only a small part of the overall solution--getting
|
1270 |
|
|
the code generated by both compilers to agree on issues other than
|
1271 |
|
|
naming can require significant effort, and, unlike naming
|
1272 |
|
|
disagreements, linkers normally cannot detect disagreements in
|
1273 |
|
|
these other areas.
|
1274 |
|
|
|
1275 |
|
|
Also, note that with `-fno-underscoring', the lack of appended
|
1276 |
|
|
underscores introduces the very real possibility that a
|
1277 |
|
|
user-defined external name will conflict with a name in a system
|
1278 |
|
|
library, which could make finding unresolved-reference bugs quite
|
1279 |
|
|
difficult in some cases--they might occur at program run time, and
|
1280 |
|
|
show up only as buggy behavior at run time.
|
1281 |
|
|
|
1282 |
|
|
In future versions of GNU Fortran we hope to improve naming and
|
1283 |
|
|
linking issues so that debugging always involves using the names
|
1284 |
|
|
as they appear in the source, even if the names as seen by the
|
1285 |
|
|
linker are mangled to prevent accidental linking between
|
1286 |
|
|
procedures with incompatible interfaces.
|
1287 |
|
|
|
1288 |
|
|
`-fwhole-file'
|
1289 |
|
|
By default, GNU Fortran parses, resolves and translates each
|
1290 |
|
|
procedure in a file separately. Using this option modifies this
|
1291 |
|
|
such that the whole file is parsed and placed in a single
|
1292 |
|
|
front-end tree. During resolution, in addition to all the usual
|
1293 |
|
|
checks and fixups, references to external procedures that are in
|
1294 |
|
|
the same file effect resolution of that procedure, if not already
|
1295 |
|
|
done, and a check of the interfaces. The dependences are resolved
|
1296 |
|
|
by changing the order in which the file is translated into the
|
1297 |
|
|
backend tree. Thus, a procedure that is referenced is translated
|
1298 |
|
|
before the reference and the duplication of backend tree
|
1299 |
|
|
declarations eliminated.
|
1300 |
|
|
|
1301 |
|
|
`-fsecond-underscore'
|
1302 |
|
|
By default, GNU Fortran appends an underscore to external names.
|
1303 |
|
|
If this option is used GNU Fortran appends two underscores to
|
1304 |
|
|
names with underscores and one underscore to external names with
|
1305 |
|
|
no underscores. GNU Fortran also appends two underscores to
|
1306 |
|
|
internal names with underscores to avoid naming collisions with
|
1307 |
|
|
external names.
|
1308 |
|
|
|
1309 |
|
|
This option has no effect if `-fno-underscoring' is in effect. It
|
1310 |
|
|
is implied by the `-ff2c' option.
|
1311 |
|
|
|
1312 |
|
|
Otherwise, with this option, an external name such as `MAX_COUNT'
|
1313 |
|
|
is implemented as a reference to the link-time external symbol
|
1314 |
|
|
`max_count__', instead of `max_count_'. This is required for
|
1315 |
|
|
compatibility with `g77' and `f2c', and is implied by use of the
|
1316 |
|
|
`-ff2c' option.
|
1317 |
|
|
|
1318 |
|
|
`-fcheck='
|
1319 |
|
|
Enable the generation of run-time checks; the argument shall be a
|
1320 |
|
|
comma-delimited list of the following keywords.
|
1321 |
|
|
|
1322 |
|
|
`all'
|
1323 |
|
|
Enable all run-time test of `-fcheck'.
|
1324 |
|
|
|
1325 |
|
|
`array-temps'
|
1326 |
|
|
Warns at run time when for passing an actual argument a
|
1327 |
|
|
temporary array had to be generated. The information
|
1328 |
|
|
generated by this warning is sometimes useful in
|
1329 |
|
|
optimization, in order to avoid such temporaries.
|
1330 |
|
|
|
1331 |
|
|
Note: The warning is only printed once per location.
|
1332 |
|
|
|
1333 |
|
|
`bounds'
|
1334 |
|
|
Enable generation of run-time checks for array subscripts and
|
1335 |
|
|
against the declared minimum and maximum values. It also
|
1336 |
|
|
checks array indices for assumed and deferred shape arrays
|
1337 |
|
|
against the actual allocated bounds and ensures that all
|
1338 |
|
|
string lengths are equal for character array constructors
|
1339 |
|
|
without an explicit typespec.
|
1340 |
|
|
|
1341 |
|
|
Some checks require that `-fcheck=bounds' is set for the
|
1342 |
|
|
compilation of the main program.
|
1343 |
|
|
|
1344 |
|
|
Note: In the future this may also include other forms of
|
1345 |
|
|
checking, e.g., checking substring references.
|
1346 |
|
|
|
1347 |
|
|
`do'
|
1348 |
|
|
Enable generation of run-time checks for invalid modification
|
1349 |
|
|
of loop iteration variables.
|
1350 |
|
|
|
1351 |
|
|
`mem'
|
1352 |
|
|
Enable generation of run-time checks for memory allocation.
|
1353 |
|
|
Note: This option does not affect explicit allocations using
|
1354 |
|
|
the `ALLOCATE' statement, which will be always checked.
|
1355 |
|
|
|
1356 |
|
|
`pointer'
|
1357 |
|
|
Enable generation of run-time checks for pointers and
|
1358 |
|
|
allocatables.
|
1359 |
|
|
|
1360 |
|
|
`recursion'
|
1361 |
|
|
Enable generation of run-time checks for recursively called
|
1362 |
|
|
subroutines and functions which are not marked as recursive.
|
1363 |
|
|
See also `-frecursive'. Note: This check does not work for
|
1364 |
|
|
OpenMP programs and is disabled if used together with
|
1365 |
|
|
`-frecursive' and `-fopenmp'.
|
1366 |
|
|
|
1367 |
|
|
`-fbounds-check'
|
1368 |
|
|
Deprecated alias for `-fcheck=bounds'.
|
1369 |
|
|
|
1370 |
|
|
`-fcheck-array-temporaries'
|
1371 |
|
|
Deprecated alias for `-fcheck=array-temps'.
|
1372 |
|
|
|
1373 |
|
|
`-fmax-array-constructor=N'
|
1374 |
|
|
This option can be used to increase the upper limit permitted in
|
1375 |
|
|
array constructors. The code below requires this option to expand
|
1376 |
|
|
the array at compile time.
|
1377 |
|
|
|
1378 |
|
|
`program test'
|
1379 |
|
|
`implicit none'
|
1380 |
|
|
`integer j'
|
1381 |
|
|
`integer, parameter :: n = 100000'
|
1382 |
|
|
`integer, parameter :: i(n) = (/ (2*j, j = 1, n) /)'
|
1383 |
|
|
`print '(10(I0,1X))', i'
|
1384 |
|
|
`end program test'
|
1385 |
|
|
|
1386 |
|
|
_Caution: This option can lead to long compile times and
|
1387 |
|
|
excessively large object files._
|
1388 |
|
|
|
1389 |
|
|
The default value for N is 65535.
|
1390 |
|
|
|
1391 |
|
|
`-fmax-stack-var-size=N'
|
1392 |
|
|
This option specifies the size in bytes of the largest array that
|
1393 |
|
|
will be put on the stack; if the size is exceeded static memory is
|
1394 |
|
|
used (except in procedures marked as RECURSIVE). Use the option
|
1395 |
|
|
`-frecursive' to allow for recursive procedures which do not have
|
1396 |
|
|
a RECURSIVE attribute or for parallel programs. Use
|
1397 |
|
|
`-fno-automatic' to never use the stack.
|
1398 |
|
|
|
1399 |
|
|
This option currently only affects local arrays declared with
|
1400 |
|
|
constant bounds, and may not apply to all character variables.
|
1401 |
|
|
Future versions of GNU Fortran may improve this behavior.
|
1402 |
|
|
|
1403 |
|
|
The default value for N is 32768.
|
1404 |
|
|
|
1405 |
|
|
`-fpack-derived'
|
1406 |
|
|
This option tells GNU Fortran to pack derived type members as
|
1407 |
|
|
closely as possible. Code compiled with this option is likely to
|
1408 |
|
|
be incompatible with code compiled without this option, and may
|
1409 |
|
|
execute slower.
|
1410 |
|
|
|
1411 |
|
|
`-frepack-arrays'
|
1412 |
|
|
In some circumstances GNU Fortran may pass assumed shape array
|
1413 |
|
|
sections via a descriptor describing a noncontiguous area of
|
1414 |
|
|
memory. This option adds code to the function prologue to repack
|
1415 |
|
|
the data into a contiguous block at runtime.
|
1416 |
|
|
|
1417 |
|
|
This should result in faster accesses to the array. However it
|
1418 |
|
|
can introduce significant overhead to the function call,
|
1419 |
|
|
especially when the passed data is noncontiguous.
|
1420 |
|
|
|
1421 |
|
|
`-fshort-enums'
|
1422 |
|
|
This option is provided for interoperability with C code that was
|
1423 |
|
|
compiled with the `-fshort-enums' option. It will make GNU
|
1424 |
|
|
Fortran choose the smallest `INTEGER' kind a given enumerator set
|
1425 |
|
|
will fit in, and give all its enumerators this kind.
|
1426 |
|
|
|
1427 |
|
|
`-fexternal-blas'
|
1428 |
|
|
This option will make `gfortran' generate calls to BLAS functions
|
1429 |
|
|
for some matrix operations like `MATMUL', instead of using our own
|
1430 |
|
|
algorithms, if the size of the matrices involved is larger than a
|
1431 |
|
|
given limit (see `-fblas-matmul-limit'). This may be profitable
|
1432 |
|
|
if an optimized vendor BLAS library is available. The BLAS
|
1433 |
|
|
library will have to be specified at link time.
|
1434 |
|
|
|
1435 |
|
|
`-fblas-matmul-limit=N'
|
1436 |
|
|
Only significant when `-fexternal-blas' is in effect. Matrix
|
1437 |
|
|
multiplication of matrices with size larger than (or equal to) N
|
1438 |
|
|
will be performed by calls to BLAS functions, while others will be
|
1439 |
|
|
handled by `gfortran' internal algorithms. If the matrices
|
1440 |
|
|
involved are not square, the size comparison is performed using the
|
1441 |
|
|
geometric mean of the dimensions of the argument and result
|
1442 |
|
|
matrices.
|
1443 |
|
|
|
1444 |
|
|
The default value for N is 30.
|
1445 |
|
|
|
1446 |
|
|
`-frecursive'
|
1447 |
|
|
Allow indirect recursion by forcing all local arrays to be
|
1448 |
|
|
allocated on the stack. This flag cannot be used together with
|
1449 |
|
|
`-fmax-stack-var-size=' or `-fno-automatic'.
|
1450 |
|
|
|
1451 |
|
|
`-finit-local-zero'
|
1452 |
|
|
|
1453 |
|
|
`-finit-integer=N'
|
1454 |
|
|
|
1455 |
|
|
`-finit-real='
|
1456 |
|
|
|
1457 |
|
|
`-finit-logical='
|
1458 |
|
|
|
1459 |
|
|
`-finit-character=N'
|
1460 |
|
|
The `-finit-local-zero' option instructs the compiler to
|
1461 |
|
|
initialize local `INTEGER', `REAL', and `COMPLEX' variables to
|
1462 |
|
|
zero, `LOGICAL' variables to false, and `CHARACTER' variables to a
|
1463 |
|
|
string of null bytes. Finer-grained initialization options are
|
1464 |
|
|
provided by the `-finit-integer=N',
|
1465 |
|
|
`-finit-real=' (which also initializes the
|
1466 |
|
|
real and imaginary parts of local `COMPLEX' variables),
|
1467 |
|
|
`-finit-logical=', and `-finit-character=N' (where N
|
1468 |
|
|
is an ASCII character value) options. These options do not
|
1469 |
|
|
initialize components of derived type variables, nor do they
|
1470 |
|
|
initialize variables that appear in an `EQUIVALENCE' statement.
|
1471 |
|
|
(This limitation may be removed in future releases).
|
1472 |
|
|
|
1473 |
|
|
Note that the `-finit-real=nan' option initializes `REAL' and
|
1474 |
|
|
`COMPLEX' variables with a quiet NaN. For a signalling NaN use
|
1475 |
|
|
`-finit-real=snan'; note, however, that compile-time optimizations
|
1476 |
|
|
may convert them into quiet NaN and that trapping needs to be
|
1477 |
|
|
enabled (e.g. via `-ffpe-trap').
|
1478 |
|
|
|
1479 |
|
|
`-falign-commons'
|
1480 |
|
|
By default, `gfortran' enforces proper alignment of all variables
|
1481 |
|
|
in a COMMON block by padding them as needed. On certain platforms
|
1482 |
|
|
this is mandatory, on others it increases performance. If a COMMON
|
1483 |
|
|
block is not declared with consistent data types everywhere, this
|
1484 |
|
|
padding can cause trouble, and `-fno-align-commons ' can be used
|
1485 |
|
|
to disable automatic alignment. The same form of this option
|
1486 |
|
|
should be used for all files that share a COMMON block. To avoid
|
1487 |
|
|
potential alignment issues in COMMON blocks, it is recommended to
|
1488 |
|
|
order objects from largests to smallest.
|
1489 |
|
|
|
1490 |
|
|
`-fno-protect-parens'
|
1491 |
|
|
By default the parentheses in expression are honored for all
|
1492 |
|
|
optimization levels such that the compiler does not do any
|
1493 |
|
|
re-association. Using `-fno-protect-parens' allows the compiler to
|
1494 |
|
|
reorder REAL and COMPLEX expressions to produce faster code. Note
|
1495 |
|
|
that for the re-association optimization `-fno-signed-zeros' and
|
1496 |
|
|
`-fno-trapping-math' need to be in effect.
|
1497 |
|
|
|
1498 |
|
|
*Note Options for Code Generation Conventions: (gcc)Code Gen
|
1499 |
|
|
Options, for information on more options offered by the GBE shared by
|
1500 |
|
|
`gfortran', `gcc', and other GNU compilers.
|
1501 |
|
|
|
1502 |
|
|
|
1503 |
|
|
File: gfortran.info, Node: Environment Variables, Prev: Code Gen Options, Up: Invoking GNU Fortran
|
1504 |
|
|
|
1505 |
|
|
2.10 Environment variables affecting `gfortran'
|
1506 |
|
|
===============================================
|
1507 |
|
|
|
1508 |
|
|
The `gfortran' compiler currently does not make use of any environment
|
1509 |
|
|
variables to control its operation above and beyond those that affect
|
1510 |
|
|
the operation of `gcc'.
|
1511 |
|
|
|
1512 |
|
|
*Note Environment Variables Affecting GCC: (gcc)Environment
|
1513 |
|
|
Variables, for information on environment variables.
|
1514 |
|
|
|
1515 |
|
|
*Note Runtime::, for environment variables that affect the run-time
|
1516 |
|
|
behavior of programs compiled with GNU Fortran.
|
1517 |
|
|
|
1518 |
|
|
|
1519 |
|
|
File: gfortran.info, Node: Runtime, Next: Fortran 2003 and 2008 status, Prev: Invoking GNU Fortran, Up: Top
|
1520 |
|
|
|
1521 |
|
|
3 Runtime: Influencing runtime behavior with environment variables
|
1522 |
|
|
*******************************************************************
|
1523 |
|
|
|
1524 |
|
|
The behavior of the `gfortran' can be influenced by environment
|
1525 |
|
|
variables.
|
1526 |
|
|
|
1527 |
|
|
Malformed environment variables are silently ignored.
|
1528 |
|
|
|
1529 |
|
|
* Menu:
|
1530 |
|
|
|
1531 |
|
|
* GFORTRAN_STDIN_UNIT:: Unit number for standard input
|
1532 |
|
|
* GFORTRAN_STDOUT_UNIT:: Unit number for standard output
|
1533 |
|
|
* GFORTRAN_STDERR_UNIT:: Unit number for standard error
|
1534 |
|
|
* GFORTRAN_USE_STDERR:: Send library output to standard error
|
1535 |
|
|
* GFORTRAN_TMPDIR:: Directory for scratch files
|
1536 |
|
|
* GFORTRAN_UNBUFFERED_ALL:: Don't buffer I/O for all units.
|
1537 |
|
|
* GFORTRAN_UNBUFFERED_PRECONNECTED:: Don't buffer I/O for preconnected units.
|
1538 |
|
|
* GFORTRAN_SHOW_LOCUS:: Show location for runtime errors
|
1539 |
|
|
* GFORTRAN_OPTIONAL_PLUS:: Print leading + where permitted
|
1540 |
|
|
* GFORTRAN_DEFAULT_RECL:: Default record length for new files
|
1541 |
|
|
* GFORTRAN_LIST_SEPARATOR:: Separator for list output
|
1542 |
|
|
* GFORTRAN_CONVERT_UNIT:: Set endianness for unformatted I/O
|
1543 |
|
|
* GFORTRAN_ERROR_DUMPCORE:: Dump core on run-time errors
|
1544 |
|
|
* GFORTRAN_ERROR_BACKTRACE:: Show backtrace on run-time errors
|
1545 |
|
|
|
1546 |
|
|
|
1547 |
|
|
File: gfortran.info, Node: GFORTRAN_STDIN_UNIT, Next: GFORTRAN_STDOUT_UNIT, Up: Runtime
|
1548 |
|
|
|
1549 |
|
|
3.1 `GFORTRAN_STDIN_UNIT'--Unit number for standard input
|
1550 |
|
|
=========================================================
|
1551 |
|
|
|
1552 |
|
|
This environment variable can be used to select the unit number
|
1553 |
|
|
preconnected to standard input. This must be a positive integer. The
|
1554 |
|
|
default value is 5.
|
1555 |
|
|
|
1556 |
|
|
|
1557 |
|
|
File: gfortran.info, Node: GFORTRAN_STDOUT_UNIT, Next: GFORTRAN_STDERR_UNIT, Prev: GFORTRAN_STDIN_UNIT, Up: Runtime
|
1558 |
|
|
|
1559 |
|
|
3.2 `GFORTRAN_STDOUT_UNIT'--Unit number for standard output
|
1560 |
|
|
===========================================================
|
1561 |
|
|
|
1562 |
|
|
This environment variable can be used to select the unit number
|
1563 |
|
|
preconnected to standard output. This must be a positive integer. The
|
1564 |
|
|
default value is 6.
|
1565 |
|
|
|
1566 |
|
|
|
1567 |
|
|
File: gfortran.info, Node: GFORTRAN_STDERR_UNIT, Next: GFORTRAN_USE_STDERR, Prev: GFORTRAN_STDOUT_UNIT, Up: Runtime
|
1568 |
|
|
|
1569 |
|
|
3.3 `GFORTRAN_STDERR_UNIT'--Unit number for standard error
|
1570 |
|
|
==========================================================
|
1571 |
|
|
|
1572 |
|
|
This environment variable can be used to select the unit number
|
1573 |
|
|
preconnected to standard error. This must be a positive integer. The
|
1574 |
|
|
default value is 0.
|
1575 |
|
|
|
1576 |
|
|
|
1577 |
|
|
File: gfortran.info, Node: GFORTRAN_USE_STDERR, Next: GFORTRAN_TMPDIR, Prev: GFORTRAN_STDERR_UNIT, Up: Runtime
|
1578 |
|
|
|
1579 |
|
|
3.4 `GFORTRAN_USE_STDERR'--Send library output to standard error
|
1580 |
|
|
================================================================
|
1581 |
|
|
|
1582 |
|
|
This environment variable controls where library output is sent. If
|
1583 |
|
|
the first letter is `y', `Y' or `1', standard error is used. If the
|
1584 |
|
|
first letter is `n', `N' or `0', standard output is used.
|
1585 |
|
|
|
1586 |
|
|
|
1587 |
|
|
File: gfortran.info, Node: GFORTRAN_TMPDIR, Next: GFORTRAN_UNBUFFERED_ALL, Prev: GFORTRAN_USE_STDERR, Up: Runtime
|
1588 |
|
|
|
1589 |
|
|
3.5 `GFORTRAN_TMPDIR'--Directory for scratch files
|
1590 |
|
|
==================================================
|
1591 |
|
|
|
1592 |
|
|
This environment variable controls where scratch files are created. If
|
1593 |
|
|
this environment variable is missing, GNU Fortran searches for the
|
1594 |
|
|
environment variable `TMP'. If this is also missing, the default is
|
1595 |
|
|
`/tmp'.
|
1596 |
|
|
|
1597 |
|
|
|
1598 |
|
|
File: gfortran.info, Node: GFORTRAN_UNBUFFERED_ALL, Next: GFORTRAN_UNBUFFERED_PRECONNECTED, Prev: GFORTRAN_TMPDIR, Up: Runtime
|
1599 |
|
|
|
1600 |
|
|
3.6 `GFORTRAN_UNBUFFERED_ALL'--Don't buffer I/O on all units
|
1601 |
|
|
============================================================
|
1602 |
|
|
|
1603 |
|
|
This environment variable controls whether all I/O is unbuffered. If
|
1604 |
|
|
the first letter is `y', `Y' or `1', all I/O is unbuffered. This will
|
1605 |
|
|
slow down small sequential reads and writes. If the first letter is
|
1606 |
|
|
`n', `N' or `0', I/O is buffered. This is the default.
|
1607 |
|
|
|
1608 |
|
|
|
1609 |
|
|
File: gfortran.info, Node: GFORTRAN_UNBUFFERED_PRECONNECTED, Next: GFORTRAN_SHOW_LOCUS, Prev: GFORTRAN_UNBUFFERED_ALL, Up: Runtime
|
1610 |
|
|
|
1611 |
|
|
3.7 `GFORTRAN_UNBUFFERED_PRECONNECTED'--Don't buffer I/O on preconnected units
|
1612 |
|
|
==============================================================================
|
1613 |
|
|
|
1614 |
|
|
The environment variable named `GFORTRAN_UNBUFFERED_PRECONNECTED'
|
1615 |
|
|
controls whether I/O on a preconnected unit (i.e. STDOUT or STDERR) is
|
1616 |
|
|
unbuffered. If the first letter is `y', `Y' or `1', I/O is unbuffered.
|
1617 |
|
|
This will slow down small sequential reads and writes. If the first
|
1618 |
|
|
letter is `n', `N' or `0', I/O is buffered. This is the default.
|
1619 |
|
|
|
1620 |
|
|
|
1621 |
|
|
File: gfortran.info, Node: GFORTRAN_SHOW_LOCUS, Next: GFORTRAN_OPTIONAL_PLUS, Prev: GFORTRAN_UNBUFFERED_PRECONNECTED, Up: Runtime
|
1622 |
|
|
|
1623 |
|
|
3.8 `GFORTRAN_SHOW_LOCUS'--Show location for runtime errors
|
1624 |
|
|
===========================================================
|
1625 |
|
|
|
1626 |
|
|
If the first letter is `y', `Y' or `1', filename and line numbers for
|
1627 |
|
|
runtime errors are printed. If the first letter is `n', `N' or `0',
|
1628 |
|
|
don't print filename and line numbers for runtime errors. The default
|
1629 |
|
|
is to print the location.
|
1630 |
|
|
|
1631 |
|
|
|
1632 |
|
|
File: gfortran.info, Node: GFORTRAN_OPTIONAL_PLUS, Next: GFORTRAN_DEFAULT_RECL, Prev: GFORTRAN_SHOW_LOCUS, Up: Runtime
|
1633 |
|
|
|
1634 |
|
|
3.9 `GFORTRAN_OPTIONAL_PLUS'--Print leading + where permitted
|
1635 |
|
|
=============================================================
|
1636 |
|
|
|
1637 |
|
|
If the first letter is `y', `Y' or `1', a plus sign is printed where
|
1638 |
|
|
permitted by the Fortran standard. If the first letter is `n', `N' or
|
1639 |
|
|
`0', a plus sign is not printed in most cases. Default is not to print
|
1640 |
|
|
plus signs.
|
1641 |
|
|
|
1642 |
|
|
|
1643 |
|
|
File: gfortran.info, Node: GFORTRAN_DEFAULT_RECL, Next: GFORTRAN_LIST_SEPARATOR, Prev: GFORTRAN_OPTIONAL_PLUS, Up: Runtime
|
1644 |
|
|
|
1645 |
|
|
3.10 `GFORTRAN_DEFAULT_RECL'--Default record length for new files
|
1646 |
|
|
=================================================================
|
1647 |
|
|
|
1648 |
|
|
This environment variable specifies the default record length, in
|
1649 |
|
|
bytes, for files which are opened without a `RECL' tag in the `OPEN'
|
1650 |
|
|
statement. This must be a positive integer. The default value is
|
1651 |
|
|
1073741824 bytes (1 GB).
|
1652 |
|
|
|
1653 |
|
|
|
1654 |
|
|
File: gfortran.info, Node: GFORTRAN_LIST_SEPARATOR, Next: GFORTRAN_CONVERT_UNIT, Prev: GFORTRAN_DEFAULT_RECL, Up: Runtime
|
1655 |
|
|
|
1656 |
|
|
3.11 `GFORTRAN_LIST_SEPARATOR'--Separator for list output
|
1657 |
|
|
=========================================================
|
1658 |
|
|
|
1659 |
|
|
This environment variable specifies the separator when writing
|
1660 |
|
|
list-directed output. It may contain any number of spaces and at most
|
1661 |
|
|
one comma. If you specify this on the command line, be sure to quote
|
1662 |
|
|
spaces, as in
|
1663 |
|
|
$ GFORTRAN_LIST_SEPARATOR=' , ' ./a.out
|
1664 |
|
|
when `a.out' is the compiled Fortran program that you want to run.
|
1665 |
|
|
Default is a single space.
|
1666 |
|
|
|
1667 |
|
|
|
1668 |
|
|
File: gfortran.info, Node: GFORTRAN_CONVERT_UNIT, Next: GFORTRAN_ERROR_DUMPCORE, Prev: GFORTRAN_LIST_SEPARATOR, Up: Runtime
|
1669 |
|
|
|
1670 |
|
|
3.12 `GFORTRAN_CONVERT_UNIT'--Set endianness for unformatted I/O
|
1671 |
|
|
================================================================
|
1672 |
|
|
|
1673 |
|
|
By setting the `GFORTRAN_CONVERT_UNIT' variable, it is possible to
|
1674 |
|
|
change the representation of data for unformatted files. The syntax
|
1675 |
|
|
for the `GFORTRAN_CONVERT_UNIT' variable is:
|
1676 |
|
|
GFORTRAN_CONVERT_UNIT: mode | mode ';' exception | exception ;
|
1677 |
|
|
mode: 'native' | 'swap' | 'big_endian' | 'little_endian' ;
|
1678 |
|
|
exception: mode ':' unit_list | unit_list ;
|
1679 |
|
|
unit_list: unit_spec | unit_list unit_spec ;
|
1680 |
|
|
unit_spec: INTEGER | INTEGER '-' INTEGER ;
|
1681 |
|
|
The variable consists of an optional default mode, followed by a
|
1682 |
|
|
list of optional exceptions, which are separated by semicolons from the
|
1683 |
|
|
preceding default and each other. Each exception consists of a format
|
1684 |
|
|
and a comma-separated list of units. Valid values for the modes are
|
1685 |
|
|
the same as for the `CONVERT' specifier:
|
1686 |
|
|
|
1687 |
|
|
`NATIVE' Use the native format. This is the default.
|
1688 |
|
|
|
1689 |
|
|
`SWAP' Swap between little- and big-endian.
|
1690 |
|
|
|
1691 |
|
|
`LITTLE_ENDIAN' Use the little-endian format for unformatted files.
|
1692 |
|
|
|
1693 |
|
|
`BIG_ENDIAN' Use the big-endian format for unformatted files.
|
1694 |
|
|
A missing mode for an exception is taken to mean `BIG_ENDIAN'.
|
1695 |
|
|
Examples of values for `GFORTRAN_CONVERT_UNIT' are:
|
1696 |
|
|
`'big_endian'' Do all unformatted I/O in big_endian mode.
|
1697 |
|
|
|
1698 |
|
|
`'little_endian;native:10-20,25'' Do all unformatted I/O in
|
1699 |
|
|
little_endian mode, except for units 10 to 20 and 25, which are in
|
1700 |
|
|
native format.
|
1701 |
|
|
|
1702 |
|
|
`'10-20'' Units 10 to 20 are big-endian, the rest is native.
|
1703 |
|
|
|
1704 |
|
|
Setting the environment variables should be done on the command line
|
1705 |
|
|
or via the `export' command for `sh'-compatible shells and via `setenv'
|
1706 |
|
|
for `csh'-compatible shells.
|
1707 |
|
|
|
1708 |
|
|
Example for `sh':
|
1709 |
|
|
$ gfortran foo.f90
|
1710 |
|
|
$ GFORTRAN_CONVERT_UNIT='big_endian;native:10-20' ./a.out
|
1711 |
|
|
|
1712 |
|
|
Example code for `csh':
|
1713 |
|
|
% gfortran foo.f90
|
1714 |
|
|
% setenv GFORTRAN_CONVERT_UNIT 'big_endian;native:10-20'
|
1715 |
|
|
% ./a.out
|
1716 |
|
|
|
1717 |
|
|
Using anything but the native representation for unformatted data
|
1718 |
|
|
carries a significant speed overhead. If speed in this area matters to
|
1719 |
|
|
you, it is best if you use this only for data that needs to be portable.
|
1720 |
|
|
|
1721 |
|
|
*Note CONVERT specifier::, for an alternative way to specify the
|
1722 |
|
|
data representation for unformatted files. *Note Runtime Options::, for
|
1723 |
|
|
setting a default data representation for the whole program. The
|
1724 |
|
|
`CONVERT' specifier overrides the `-fconvert' compile options.
|
1725 |
|
|
|
1726 |
|
|
_Note that the values specified via the GFORTRAN_CONVERT_UNIT
|
1727 |
|
|
environment variable will override the CONVERT specifier in the open
|
1728 |
|
|
statement_. This is to give control over data formats to users who do
|
1729 |
|
|
not have the source code of their program available.
|
1730 |
|
|
|
1731 |
|
|
|
1732 |
|
|
File: gfortran.info, Node: GFORTRAN_ERROR_DUMPCORE, Next: GFORTRAN_ERROR_BACKTRACE, Prev: GFORTRAN_CONVERT_UNIT, Up: Runtime
|
1733 |
|
|
|
1734 |
|
|
3.13 `GFORTRAN_ERROR_DUMPCORE'--Dump core on run-time errors
|
1735 |
|
|
============================================================
|
1736 |
|
|
|
1737 |
|
|
If the `GFORTRAN_ERROR_DUMPCORE' variable is set to `y', `Y' or `1'
|
1738 |
|
|
(only the first letter is relevant) then library run-time errors cause
|
1739 |
|
|
core dumps. To disable the core dumps, set the variable to `n', `N',
|
1740 |
|
|
`0'. Default is not to core dump unless the `-fdump-core' compile option
|
1741 |
|
|
was used.
|
1742 |
|
|
|
1743 |
|
|
|
1744 |
|
|
File: gfortran.info, Node: GFORTRAN_ERROR_BACKTRACE, Prev: GFORTRAN_ERROR_DUMPCORE, Up: Runtime
|
1745 |
|
|
|
1746 |
|
|
3.14 `GFORTRAN_ERROR_BACKTRACE'--Show backtrace on run-time errors
|
1747 |
|
|
==================================================================
|
1748 |
|
|
|
1749 |
|
|
If the `GFORTRAN_ERROR_BACKTRACE' variable is set to `y', `Y' or `1'
|
1750 |
|
|
(only the first letter is relevant) then a backtrace is printed when a
|
1751 |
|
|
run-time error occurs. To disable the backtracing, set the variable to
|
1752 |
|
|
`n', `N', `0'. Default is not to print a backtrace unless the
|
1753 |
|
|
`-fbacktrace' compile option was used.
|
1754 |
|
|
|
1755 |
|
|
|
1756 |
|
|
File: gfortran.info, Node: Fortran 2003 and 2008 status, Next: Compiler Characteristics, Prev: Runtime, Up: Top
|
1757 |
|
|
|
1758 |
|
|
4 Fortran 2003 and 2008 Status
|
1759 |
|
|
******************************
|
1760 |
|
|
|
1761 |
|
|
* Menu:
|
1762 |
|
|
|
1763 |
|
|
* Fortran 2003 status::
|
1764 |
|
|
* Fortran 2008 status::
|
1765 |
|
|
|
1766 |
|
|
|
1767 |
|
|
File: gfortran.info, Node: Fortran 2003 status, Next: Fortran 2008 status, Up: Fortran 2003 and 2008 status
|
1768 |
|
|
|
1769 |
|
|
4.1 Fortran 2003 status
|
1770 |
|
|
=======================
|
1771 |
|
|
|
1772 |
|
|
GNU Fortran supports several Fortran 2003 features; an incomplete list
|
1773 |
|
|
can be found below. See also the wiki page
|
1774 |
|
|
(http://gcc.gnu.org/wiki/Fortran2003) about Fortran 2003.
|
1775 |
|
|
|
1776 |
|
|
* Intrinsics `command_argument_count', `get_command',
|
1777 |
|
|
`get_command_argument', `get_environment_variable', and
|
1778 |
|
|
`move_alloc'.
|
1779 |
|
|
|
1780 |
|
|
* Array constructors using square brackets. That is, `[...]' rather
|
1781 |
|
|
than `(/.../)'. Type-specification for array constructors like
|
1782 |
|
|
`(/ some-type :: ... /)'.
|
1783 |
|
|
|
1784 |
|
|
* `FLUSH' statement.
|
1785 |
|
|
|
1786 |
|
|
* `IOMSG=' specifier for I/O statements.
|
1787 |
|
|
|
1788 |
|
|
* Support for the declaration of enumeration constants via the
|
1789 |
|
|
`ENUM' and `ENUMERATOR' statements. Interoperability with `gcc'
|
1790 |
|
|
is guaranteed also for the case where the `-fshort-enums' command
|
1791 |
|
|
line option is given.
|
1792 |
|
|
|
1793 |
|
|
* TR 15581:
|
1794 |
|
|
* `ALLOCATABLE' dummy arguments.
|
1795 |
|
|
|
1796 |
|
|
* `ALLOCATABLE' function results
|
1797 |
|
|
|
1798 |
|
|
* `ALLOCATABLE' components of derived types
|
1799 |
|
|
|
1800 |
|
|
* The `ERRMSG=' tag is now supported in `ALLOCATE' and `DEALLOCATE'
|
1801 |
|
|
statements. The `SOURCE=' tag is supported in an `ALLOCATE'
|
1802 |
|
|
statement. An _intrinsic-type-spec_ can be used as the
|
1803 |
|
|
_type-spec_ in an `ALLOCATE' statement; while the use of a
|
1804 |
|
|
_derived-type-name_ is currently unsupported.
|
1805 |
|
|
|
1806 |
|
|
* The `OPEN' statement supports the `ACCESS='STREAM'' specifier,
|
1807 |
|
|
allowing I/O without any record structure.
|
1808 |
|
|
|
1809 |
|
|
* Namelist input/output for internal files.
|
1810 |
|
|
|
1811 |
|
|
* The `PROTECTED' statement and attribute.
|
1812 |
|
|
|
1813 |
|
|
* The `VALUE' statement and attribute.
|
1814 |
|
|
|
1815 |
|
|
* The `VOLATILE' statement and attribute.
|
1816 |
|
|
|
1817 |
|
|
* The `IMPORT' statement, allowing to import host-associated derived
|
1818 |
|
|
types.
|
1819 |
|
|
|
1820 |
|
|
* `USE' statement with `INTRINSIC' and `NON_INTRINSIC' attribute;
|
1821 |
|
|
supported intrinsic modules: `ISO_FORTRAN_ENV', `OMP_LIB' and
|
1822 |
|
|
`OMP_LIB_KINDS'.
|
1823 |
|
|
|
1824 |
|
|
* Renaming of operators in the `USE' statement.
|
1825 |
|
|
|
1826 |
|
|
* Interoperability with C (ISO C Bindings)
|
1827 |
|
|
|
1828 |
|
|
* BOZ as argument of `INT', `REAL', `DBLE' and `CMPLX'.
|
1829 |
|
|
|
1830 |
|
|
* Type-bound procedures with `PROCEDURE' or `GENERIC', and operators
|
1831 |
|
|
bound to a derived-type.
|
1832 |
|
|
|
1833 |
|
|
* Extension of derived-types (the `EXTENDS(...)' syntax).
|
1834 |
|
|
|
1835 |
|
|
* `ABSTRACT' derived-types and declaring procedure bindings
|
1836 |
|
|
`DEFERRED'.
|
1837 |
|
|
|
1838 |
|
|
|
1839 |
|
|
|
1840 |
|
|
File: gfortran.info, Node: Fortran 2008 status, Prev: Fortran 2003 status, Up: Fortran 2003 and 2008 status
|
1841 |
|
|
|
1842 |
|
|
4.2 Fortran 2008 status
|
1843 |
|
|
=======================
|
1844 |
|
|
|
1845 |
|
|
The next version of the Fortran standard after Fortran 2003 is currently
|
1846 |
|
|
being worked on by the Working Group 5 of Sub-Committee 22 of the Joint
|
1847 |
|
|
Technical Committee 1 of the International Organization for
|
1848 |
|
|
Standardization (ISO) and the International Electrotechnical Commission
|
1849 |
|
|
(IEC). This group is known as WG5 (http://www.nag.co.uk/sc22wg5/). The
|
1850 |
|
|
next revision of the Fortran standard is informally referred to as
|
1851 |
|
|
Fortran 2008, reflecting its planned release year. The GNU Fortran
|
1852 |
|
|
compiler has support for some of the new features in Fortran 2008. This
|
1853 |
|
|
support is based on the latest draft, available from
|
1854 |
|
|
`http://www.nag.co.uk/sc22wg5/'. However, as the final standard may
|
1855 |
|
|
differ from the drafts, no guarantee of backward compatibility can be
|
1856 |
|
|
made and you should only use it for experimental purposes.
|
1857 |
|
|
|
1858 |
|
|
The wiki (http://gcc.gnu.org/wiki/Fortran2008Status) has some
|
1859 |
|
|
information about the current Fortran 2008 implementation status.
|
1860 |
|
|
|
1861 |
|
|
|
1862 |
|
|
File: gfortran.info, Node: Compiler Characteristics, Next: Mixed-Language Programming, Prev: Fortran 2003 and 2008 status, Up: Top
|
1863 |
|
|
|
1864 |
|
|
5 Compiler Characteristics
|
1865 |
|
|
**************************
|
1866 |
|
|
|
1867 |
|
|
This chapter describes certain characteristics of the GNU Fortran
|
1868 |
|
|
compiler, that are not specified by the Fortran standard, but which
|
1869 |
|
|
might in some way or another become visible to the programmer.
|
1870 |
|
|
|
1871 |
|
|
* Menu:
|
1872 |
|
|
|
1873 |
|
|
* KIND Type Parameters::
|
1874 |
|
|
* Internal representation of LOGICAL variables::
|
1875 |
|
|
|
1876 |
|
|
|
1877 |
|
|
File: gfortran.info, Node: KIND Type Parameters, Next: Internal representation of LOGICAL variables, Up: Compiler Characteristics
|
1878 |
|
|
|
1879 |
|
|
5.1 KIND Type Parameters
|
1880 |
|
|
========================
|
1881 |
|
|
|
1882 |
|
|
The `KIND' type parameters supported by GNU Fortran for the primitive
|
1883 |
|
|
data types are:
|
1884 |
|
|
|
1885 |
|
|
`INTEGER'
|
1886 |
|
|
1, 2, 4, 8*, 16*, default: 4 (1)
|
1887 |
|
|
|
1888 |
|
|
`LOGICAL'
|
1889 |
|
|
1, 2, 4, 8*, 16*, default: 4 (1)
|
1890 |
|
|
|
1891 |
|
|
`REAL'
|
1892 |
|
|
4, 8, 10**, 16**, default: 4 (2)
|
1893 |
|
|
|
1894 |
|
|
`COMPLEX'
|
1895 |
|
|
4, 8, 10**, 16**, default: 4 (2)
|
1896 |
|
|
|
1897 |
|
|
`CHARACTER'
|
1898 |
|
|
1, 4, default: 1
|
1899 |
|
|
|
1900 |
|
|
|
1901 |
|
|
* = not available on all systems
|
1902 |
|
|
** = not available on all systems; additionally 10 and 16 are never
|
1903 |
|
|
available at the same time
|
1904 |
|
|
(1) Unless -fdefault-integer-8 is used
|
1905 |
|
|
(2) Unless -fdefault-real-8 is used
|
1906 |
|
|
|
1907 |
|
|
The `KIND' value matches the storage size in bytes, except for
|
1908 |
|
|
`COMPLEX' where the storage size is twice as much (or both real and
|
1909 |
|
|
imaginary part are a real value of the given size). It is recommended
|
1910 |
|
|
to use the `SELECT_*_KIND' intrinsics instead of the concrete values.
|
1911 |
|
|
|
1912 |
|
|
|
1913 |
|
|
File: gfortran.info, Node: Internal representation of LOGICAL variables, Prev: KIND Type Parameters, Up: Compiler Characteristics
|
1914 |
|
|
|
1915 |
|
|
5.2 Internal representation of LOGICAL variables
|
1916 |
|
|
================================================
|
1917 |
|
|
|
1918 |
|
|
The Fortran standard does not specify how variables of `LOGICAL' type
|
1919 |
|
|
are represented, beyond requiring that `LOGICAL' variables of default
|
1920 |
|
|
kind have the same storage size as default `INTEGER' and `REAL'
|
1921 |
|
|
variables. The GNU Fortran internal representation is as follows.
|
1922 |
|
|
|
1923 |
|
|
A `LOGICAL(KIND=N)' variable is represented as an `INTEGER(KIND=N)'
|
1924 |
|
|
variable, however, with only two permissible values: `1' for `.TRUE.'
|
1925 |
|
|
and `0' for `.FALSE.'. Any other integer value results in undefined
|
1926 |
|
|
behavior.
|
1927 |
|
|
|
1928 |
|
|
Note that for mixed-language programming using the `ISO_C_BINDING'
|
1929 |
|
|
feature, there is a `C_BOOL' kind that can be used to create
|
1930 |
|
|
`LOGICAL(KIND=C_BOOL)' variables which are interoperable with the C99
|
1931 |
|
|
_Bool type. The C99 _Bool type has an internal representation
|
1932 |
|
|
described in the C99 standard, which is identical to the above
|
1933 |
|
|
description, i.e. with 1 for true and 0 for false being the only
|
1934 |
|
|
permissible values. Thus the internal representation of `LOGICAL'
|
1935 |
|
|
variables in GNU Fortran is identical to C99 _Bool, except for a
|
1936 |
|
|
possible difference in storage size depending on the kind.
|
1937 |
|
|
|
1938 |
|
|
|
1939 |
|
|
File: gfortran.info, Node: Extensions, Next: Intrinsic Procedures, Prev: Mixed-Language Programming, Up: Top
|
1940 |
|
|
|
1941 |
|
|
6 Extensions
|
1942 |
|
|
************
|
1943 |
|
|
|
1944 |
|
|
The two sections below detail the extensions to standard Fortran that
|
1945 |
|
|
are implemented in GNU Fortran, as well as some of the popular or
|
1946 |
|
|
historically important extensions that are not (or not yet) implemented.
|
1947 |
|
|
For the latter case, we explain the alternatives available to GNU
|
1948 |
|
|
Fortran users, including replacement by standard-conforming code or GNU
|
1949 |
|
|
extensions.
|
1950 |
|
|
|
1951 |
|
|
* Menu:
|
1952 |
|
|
|
1953 |
|
|
* Extensions implemented in GNU Fortran::
|
1954 |
|
|
* Extensions not implemented in GNU Fortran::
|
1955 |
|
|
|
1956 |
|
|
|
1957 |
|
|
File: gfortran.info, Node: Extensions implemented in GNU Fortran, Next: Extensions not implemented in GNU Fortran, Up: Extensions
|
1958 |
|
|
|
1959 |
|
|
6.1 Extensions implemented in GNU Fortran
|
1960 |
|
|
=========================================
|
1961 |
|
|
|
1962 |
|
|
GNU Fortran implements a number of extensions over standard Fortran.
|
1963 |
|
|
This chapter contains information on their syntax and meaning. There
|
1964 |
|
|
are currently two categories of GNU Fortran extensions, those that
|
1965 |
|
|
provide functionality beyond that provided by any standard, and those
|
1966 |
|
|
that are supported by GNU Fortran purely for backward compatibility
|
1967 |
|
|
with legacy compilers. By default, `-std=gnu' allows the compiler to
|
1968 |
|
|
accept both types of extensions, but to warn about the use of the
|
1969 |
|
|
latter. Specifying either `-std=f95', `-std=f2003' or `-std=f2008'
|
1970 |
|
|
disables both types of extensions, and `-std=legacy' allows both
|
1971 |
|
|
without warning.
|
1972 |
|
|
|
1973 |
|
|
* Menu:
|
1974 |
|
|
|
1975 |
|
|
* Old-style kind specifications::
|
1976 |
|
|
* Old-style variable initialization::
|
1977 |
|
|
* Extensions to namelist::
|
1978 |
|
|
* X format descriptor without count field::
|
1979 |
|
|
* Commas in FORMAT specifications::
|
1980 |
|
|
* Missing period in FORMAT specifications::
|
1981 |
|
|
* I/O item lists::
|
1982 |
|
|
* BOZ literal constants::
|
1983 |
|
|
* Real array indices::
|
1984 |
|
|
* Unary operators::
|
1985 |
|
|
* Implicitly convert LOGICAL and INTEGER values::
|
1986 |
|
|
* Hollerith constants support::
|
1987 |
|
|
* Cray pointers::
|
1988 |
|
|
* CONVERT specifier::
|
1989 |
|
|
* OpenMP::
|
1990 |
|
|
* Argument list functions::
|
1991 |
|
|
|
1992 |
|
|
|
1993 |
|
|
File: gfortran.info, Node: Old-style kind specifications, Next: Old-style variable initialization, Up: Extensions implemented in GNU Fortran
|
1994 |
|
|
|
1995 |
|
|
6.1.1 Old-style kind specifications
|
1996 |
|
|
-----------------------------------
|
1997 |
|
|
|
1998 |
|
|
GNU Fortran allows old-style kind specifications in declarations. These
|
1999 |
|
|
look like:
|
2000 |
|
|
TYPESPEC*size x,y,z
|
2001 |
|
|
where `TYPESPEC' is a basic type (`INTEGER', `REAL', etc.), and
|
2002 |
|
|
where `size' is a byte count corresponding to the storage size of a
|
2003 |
|
|
valid kind for that type. (For `COMPLEX' variables, `size' is the
|
2004 |
|
|
total size of the real and imaginary parts.) The statement then
|
2005 |
|
|
declares `x', `y' and `z' to be of type `TYPESPEC' with the appropriate
|
2006 |
|
|
kind. This is equivalent to the standard-conforming declaration
|
2007 |
|
|
TYPESPEC(k) x,y,z
|
2008 |
|
|
where `k' is the kind parameter suitable for the intended precision.
|
2009 |
|
|
As kind parameters are implementation-dependent, use the `KIND',
|
2010 |
|
|
`SELECTED_INT_KIND' and `SELECTED_REAL_KIND' intrinsics to retrieve the
|
2011 |
|
|
correct value, for instance `REAL*8 x' can be replaced by:
|
2012 |
|
|
INTEGER, PARAMETER :: dbl = KIND(1.0d0)
|
2013 |
|
|
REAL(KIND=dbl) :: x
|
2014 |
|
|
|
2015 |
|
|
|
2016 |
|
|
File: gfortran.info, Node: Old-style variable initialization, Next: Extensions to namelist, Prev: Old-style kind specifications, Up: Extensions implemented in GNU Fortran
|
2017 |
|
|
|
2018 |
|
|
6.1.2 Old-style variable initialization
|
2019 |
|
|
---------------------------------------
|
2020 |
|
|
|
2021 |
|
|
GNU Fortran allows old-style initialization of variables of the form:
|
2022 |
|
|
INTEGER i/1/,j/2/
|
2023 |
|
|
REAL x(2,2) /3*0.,1./
|
2024 |
|
|
The syntax for the initializers is as for the `DATA' statement, but
|
2025 |
|
|
unlike in a `DATA' statement, an initializer only applies to the
|
2026 |
|
|
variable immediately preceding the initialization. In other words,
|
2027 |
|
|
something like `INTEGER I,J/2,3/' is not valid. This style of
|
2028 |
|
|
initialization is only allowed in declarations without double colons
|
2029 |
|
|
(`::'); the double colons were introduced in Fortran 90, which also
|
2030 |
|
|
introduced a standard syntax for initializing variables in type
|
2031 |
|
|
declarations.
|
2032 |
|
|
|
2033 |
|
|
Examples of standard-conforming code equivalent to the above example
|
2034 |
|
|
are:
|
2035 |
|
|
! Fortran 90
|
2036 |
|
|
INTEGER :: i = 1, j = 2
|
2037 |
|
|
REAL :: x(2,2) = RESHAPE((/0.,0.,0.,1./),SHAPE(x))
|
2038 |
|
|
! Fortran 77
|
2039 |
|
|
INTEGER i, j
|
2040 |
|
|
REAL x(2,2)
|
2041 |
|
|
DATA i/1/, j/2/, x/3*0.,1./
|
2042 |
|
|
|
2043 |
|
|
Note that variables which are explicitly initialized in declarations
|
2044 |
|
|
or in `DATA' statements automatically acquire the `SAVE' attribute.
|
2045 |
|
|
|
2046 |
|
|
|
2047 |
|
|
File: gfortran.info, Node: Extensions to namelist, Next: X format descriptor without count field, Prev: Old-style variable initialization, Up: Extensions implemented in GNU Fortran
|
2048 |
|
|
|
2049 |
|
|
6.1.3 Extensions to namelist
|
2050 |
|
|
----------------------------
|
2051 |
|
|
|
2052 |
|
|
GNU Fortran fully supports the Fortran 95 standard for namelist I/O
|
2053 |
|
|
including array qualifiers, substrings and fully qualified derived
|
2054 |
|
|
types. The output from a namelist write is compatible with namelist
|
2055 |
|
|
read. The output has all names in upper case and indentation to column
|
2056 |
|
|
1 after the namelist name. Two extensions are permitted:
|
2057 |
|
|
|
2058 |
|
|
Old-style use of `$' instead of `&'
|
2059 |
|
|
$MYNML
|
2060 |
|
|
X(:)%Y(2) = 1.0 2.0 3.0
|
2061 |
|
|
CH(1:4) = "abcd"
|
2062 |
|
|
$END
|
2063 |
|
|
|
2064 |
|
|
It should be noted that the default terminator is `/' rather than
|
2065 |
|
|
`&END'.
|
2066 |
|
|
|
2067 |
|
|
Querying of the namelist when inputting from stdin. After at least
|
2068 |
|
|
one space, entering `?' sends to stdout the namelist name and the names
|
2069 |
|
|
of the variables in the namelist:
|
2070 |
|
|
?
|
2071 |
|
|
|
2072 |
|
|
&mynml
|
2073 |
|
|
x
|
2074 |
|
|
x%y
|
2075 |
|
|
ch
|
2076 |
|
|
&end
|
2077 |
|
|
|
2078 |
|
|
Entering `=?' outputs the namelist to stdout, as if `WRITE(*,NML =
|
2079 |
|
|
mynml)' had been called:
|
2080 |
|
|
=?
|
2081 |
|
|
|
2082 |
|
|
&MYNML
|
2083 |
|
|
X(1)%Y= 0.000000 , 1.000000 , 0.000000 ,
|
2084 |
|
|
X(2)%Y= 0.000000 , 2.000000 , 0.000000 ,
|
2085 |
|
|
X(3)%Y= 0.000000 , 3.000000 , 0.000000 ,
|
2086 |
|
|
CH=abcd, /
|
2087 |
|
|
|
2088 |
|
|
To aid this dialog, when input is from stdin, errors send their
|
2089 |
|
|
messages to stderr and execution continues, even if `IOSTAT' is set.
|
2090 |
|
|
|
2091 |
|
|
`PRINT' namelist is permitted. This causes an error if `-std=f95'
|
2092 |
|
|
is used.
|
2093 |
|
|
PROGRAM test_print
|
2094 |
|
|
REAL, dimension (4) :: x = (/1.0, 2.0, 3.0, 4.0/)
|
2095 |
|
|
NAMELIST /mynml/ x
|
2096 |
|
|
PRINT mynml
|
2097 |
|
|
END PROGRAM test_print
|
2098 |
|
|
|
2099 |
|
|
Expanded namelist reads are permitted. This causes an error if
|
2100 |
|
|
`-std=f95' is used. In the following example, the first element of the
|
2101 |
|
|
array will be given the value 0.00 and the two succeeding elements will
|
2102 |
|
|
be given the values 1.00 and 2.00.
|
2103 |
|
|
&MYNML
|
2104 |
|
|
X(1,1) = 0.00 , 1.00 , 2.00
|
2105 |
|
|
/
|
2106 |
|
|
|
2107 |
|
|
|
2108 |
|
|
File: gfortran.info, Node: X format descriptor without count field, Next: Commas in FORMAT specifications, Prev: Extensions to namelist, Up: Extensions implemented in GNU Fortran
|
2109 |
|
|
|
2110 |
|
|
6.1.4 `X' format descriptor without count field
|
2111 |
|
|
-----------------------------------------------
|
2112 |
|
|
|
2113 |
|
|
To support legacy codes, GNU Fortran permits the count field of the `X'
|
2114 |
|
|
edit descriptor in `FORMAT' statements to be omitted. When omitted,
|
2115 |
|
|
the count is implicitly assumed to be one.
|
2116 |
|
|
|
2117 |
|
|
PRINT 10, 2, 3
|
2118 |
|
|
10 FORMAT (I1, X, I1)
|
2119 |
|
|
|
2120 |
|
|
|
2121 |
|
|
File: gfortran.info, Node: Commas in FORMAT specifications, Next: Missing period in FORMAT specifications, Prev: X format descriptor without count field, Up: Extensions implemented in GNU Fortran
|
2122 |
|
|
|
2123 |
|
|
6.1.5 Commas in `FORMAT' specifications
|
2124 |
|
|
---------------------------------------
|
2125 |
|
|
|
2126 |
|
|
To support legacy codes, GNU Fortran allows the comma separator to be
|
2127 |
|
|
omitted immediately before and after character string edit descriptors
|
2128 |
|
|
in `FORMAT' statements.
|
2129 |
|
|
|
2130 |
|
|
PRINT 10, 2, 3
|
2131 |
|
|
10 FORMAT ('FOO='I1' BAR='I2)
|
2132 |
|
|
|
2133 |
|
|
|
2134 |
|
|
File: gfortran.info, Node: Missing period in FORMAT specifications, Next: I/O item lists, Prev: Commas in FORMAT specifications, Up: Extensions implemented in GNU Fortran
|
2135 |
|
|
|
2136 |
|
|
6.1.6 Missing period in `FORMAT' specifications
|
2137 |
|
|
-----------------------------------------------
|
2138 |
|
|
|
2139 |
|
|
To support legacy codes, GNU Fortran allows missing periods in format
|
2140 |
|
|
specifications if and only if `-std=legacy' is given on the command
|
2141 |
|
|
line. This is considered non-conforming code and is discouraged.
|
2142 |
|
|
|
2143 |
|
|
REAL :: value
|
2144 |
|
|
READ(*,10) value
|
2145 |
|
|
10 FORMAT ('F4')
|
2146 |
|
|
|
2147 |
|
|
|
2148 |
|
|
File: gfortran.info, Node: I/O item lists, Next: BOZ literal constants, Prev: Missing period in FORMAT specifications, Up: Extensions implemented in GNU Fortran
|
2149 |
|
|
|
2150 |
|
|
6.1.7 I/O item lists
|
2151 |
|
|
--------------------
|
2152 |
|
|
|
2153 |
|
|
To support legacy codes, GNU Fortran allows the input item list of the
|
2154 |
|
|
`READ' statement, and the output item lists of the `WRITE' and `PRINT'
|
2155 |
|
|
statements, to start with a comma.
|
2156 |
|
|
|
2157 |
|
|
|
2158 |
|
|
File: gfortran.info, Node: BOZ literal constants, Next: Real array indices, Prev: I/O item lists, Up: Extensions implemented in GNU Fortran
|
2159 |
|
|
|
2160 |
|
|
6.1.8 BOZ literal constants
|
2161 |
|
|
---------------------------
|
2162 |
|
|
|
2163 |
|
|
Besides decimal constants, Fortran also supports binary (`b'), octal
|
2164 |
|
|
(`o') and hexadecimal (`z') integer constants. The syntax is: `prefix
|
2165 |
|
|
quote digits quote', were the prefix is either `b', `o' or `z', quote
|
2166 |
|
|
is either `'' or `"' and the digits are for binary `0' or `1', for
|
2167 |
|
|
octal between `0' and `7', and for hexadecimal between `0' and `F'.
|
2168 |
|
|
(Example: `b'01011101''.)
|
2169 |
|
|
|
2170 |
|
|
Up to Fortran 95, BOZ literals were only allowed to initialize
|
2171 |
|
|
integer variables in DATA statements. Since Fortran 2003 BOZ literals
|
2172 |
|
|
are also allowed as argument of `REAL', `DBLE', `INT' and `CMPLX'; the
|
2173 |
|
|
result is the same as if the integer BOZ literal had been converted by
|
2174 |
|
|
`TRANSFER' to, respectively, `real', `double precision', `integer' or
|
2175 |
|
|
`complex'. As GNU Fortran extension the intrinsic procedures `FLOAT',
|
2176 |
|
|
`DFLOAT', `COMPLEX' and `DCMPLX' are treated alike.
|
2177 |
|
|
|
2178 |
|
|
As an extension, GNU Fortran allows hexadecimal BOZ literal
|
2179 |
|
|
constants to be specified using the `X' prefix, in addition to the
|
2180 |
|
|
standard `Z' prefix. The BOZ literal can also be specified by adding a
|
2181 |
|
|
suffix to the string, for example, `Z'ABC'' and `'ABC'Z' are equivalent.
|
2182 |
|
|
|
2183 |
|
|
Furthermore, GNU Fortran allows using BOZ literal constants outside
|
2184 |
|
|
DATA statements and the four intrinsic functions allowed by Fortran
|
2185 |
|
|
2003. In DATA statements, in direct assignments, where the right-hand
|
2186 |
|
|
side only contains a BOZ literal constant, and for old-style
|
2187 |
|
|
initializers of the form `integer i /o'0173'/', the constant is
|
2188 |
|
|
transferred as if `TRANSFER' had been used; for `COMPLEX' numbers, only
|
2189 |
|
|
the real part is initialized unless `CMPLX' is used. In all other
|
2190 |
|
|
cases, the BOZ literal constant is converted to an `INTEGER' value with
|
2191 |
|
|
the largest decimal representation. This value is then converted
|
2192 |
|
|
numerically to the type and kind of the variable in question. (For
|
2193 |
|
|
instance, `real :: r = b'0000001' + 1' initializes `r' with `2.0'.) As
|
2194 |
|
|
different compilers implement the extension differently, one should be
|
2195 |
|
|
careful when doing bitwise initialization of non-integer variables.
|
2196 |
|
|
|
2197 |
|
|
Note that initializing an `INTEGER' variable with a statement such
|
2198 |
|
|
as `DATA i/Z'FFFFFFFF'/' will give an integer overflow error rather
|
2199 |
|
|
than the desired result of -1 when `i' is a 32-bit integer on a system
|
2200 |
|
|
that supports 64-bit integers. The `-fno-range-check' option can be
|
2201 |
|
|
used as a workaround for legacy code that initializes integers in this
|
2202 |
|
|
manner.
|
2203 |
|
|
|
2204 |
|
|
|
2205 |
|
|
File: gfortran.info, Node: Real array indices, Next: Unary operators, Prev: BOZ literal constants, Up: Extensions implemented in GNU Fortran
|
2206 |
|
|
|
2207 |
|
|
6.1.9 Real array indices
|
2208 |
|
|
------------------------
|
2209 |
|
|
|
2210 |
|
|
As an extension, GNU Fortran allows the use of `REAL' expressions or
|
2211 |
|
|
variables as array indices.
|
2212 |
|
|
|
2213 |
|
|
|
2214 |
|
|
File: gfortran.info, Node: Unary operators, Next: Implicitly convert LOGICAL and INTEGER values, Prev: Real array indices, Up: Extensions implemented in GNU Fortran
|
2215 |
|
|
|
2216 |
|
|
6.1.10 Unary operators
|
2217 |
|
|
----------------------
|
2218 |
|
|
|
2219 |
|
|
As an extension, GNU Fortran allows unary plus and unary minus operators
|
2220 |
|
|
to appear as the second operand of binary arithmetic operators without
|
2221 |
|
|
the need for parenthesis.
|
2222 |
|
|
|
2223 |
|
|
X = Y * -Z
|
2224 |
|
|
|
2225 |
|
|
|
2226 |
|
|
File: gfortran.info, Node: Implicitly convert LOGICAL and INTEGER values, Next: Hollerith constants support, Prev: Unary operators, Up: Extensions implemented in GNU Fortran
|
2227 |
|
|
|
2228 |
|
|
6.1.11 Implicitly convert `LOGICAL' and `INTEGER' values
|
2229 |
|
|
--------------------------------------------------------
|
2230 |
|
|
|
2231 |
|
|
As an extension for backwards compatibility with other compilers, GNU
|
2232 |
|
|
Fortran allows the implicit conversion of `LOGICAL' values to `INTEGER'
|
2233 |
|
|
values and vice versa. When converting from a `LOGICAL' to an
|
2234 |
|
|
`INTEGER', `.FALSE.' is interpreted as zero, and `.TRUE.' is
|
2235 |
|
|
interpreted as one. When converting from `INTEGER' to `LOGICAL', the
|
2236 |
|
|
value zero is interpreted as `.FALSE.' and any nonzero value is
|
2237 |
|
|
interpreted as `.TRUE.'.
|
2238 |
|
|
|
2239 |
|
|
LOGICAL :: l
|
2240 |
|
|
l = 1
|
2241 |
|
|
|
2242 |
|
|
INTEGER :: i
|
2243 |
|
|
i = .TRUE.
|
2244 |
|
|
|
2245 |
|
|
However, there is no implicit conversion of `INTEGER' values in
|
2246 |
|
|
`if'-statements, nor of `LOGICAL' or `INTEGER' values in I/O operations.
|
2247 |
|
|
|
2248 |
|
|
|
2249 |
|
|
File: gfortran.info, Node: Hollerith constants support, Next: Cray pointers, Prev: Implicitly convert LOGICAL and INTEGER values, Up: Extensions implemented in GNU Fortran
|
2250 |
|
|
|
2251 |
|
|
6.1.12 Hollerith constants support
|
2252 |
|
|
----------------------------------
|
2253 |
|
|
|
2254 |
|
|
GNU Fortran supports Hollerith constants in assignments, function
|
2255 |
|
|
arguments, and `DATA' and `ASSIGN' statements. A Hollerith constant is
|
2256 |
|
|
written as a string of characters preceded by an integer constant
|
2257 |
|
|
indicating the character count, and the letter `H' or `h', and stored
|
2258 |
|
|
in bytewise fashion in a numeric (`INTEGER', `REAL', or `complex') or
|
2259 |
|
|
`LOGICAL' variable. The constant will be padded or truncated to fit
|
2260 |
|
|
the size of the variable in which it is stored.
|
2261 |
|
|
|
2262 |
|
|
Examples of valid uses of Hollerith constants:
|
2263 |
|
|
complex*16 x(2)
|
2264 |
|
|
data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/
|
2265 |
|
|
x(1) = 16HABCDEFGHIJKLMNOP
|
2266 |
|
|
call foo (4h abc)
|
2267 |
|
|
|
2268 |
|
|
Invalid Hollerith constants examples:
|
2269 |
|
|
integer*4 a
|
2270 |
|
|
a = 8H12345678 ! Valid, but the Hollerith constant will be truncated.
|
2271 |
|
|
a = 0H ! At least one character is needed.
|
2272 |
|
|
|
2273 |
|
|
In general, Hollerith constants were used to provide a rudimentary
|
2274 |
|
|
facility for handling character strings in early Fortran compilers,
|
2275 |
|
|
prior to the introduction of `CHARACTER' variables in Fortran 77; in
|
2276 |
|
|
those cases, the standard-compliant equivalent is to convert the
|
2277 |
|
|
program to use proper character strings. On occasion, there may be a
|
2278 |
|
|
case where the intent is specifically to initialize a numeric variable
|
2279 |
|
|
with a given byte sequence. In these cases, the same result can be
|
2280 |
|
|
obtained by using the `TRANSFER' statement, as in this example.
|
2281 |
|
|
INTEGER(KIND=4) :: a
|
2282 |
|
|
a = TRANSFER ("abcd", a) ! equivalent to: a = 4Habcd
|
2283 |
|
|
|
2284 |
|
|
|
2285 |
|
|
File: gfortran.info, Node: Cray pointers, Next: CONVERT specifier, Prev: Hollerith constants support, Up: Extensions implemented in GNU Fortran
|
2286 |
|
|
|
2287 |
|
|
6.1.13 Cray pointers
|
2288 |
|
|
--------------------
|
2289 |
|
|
|
2290 |
|
|
Cray pointers are part of a non-standard extension that provides a
|
2291 |
|
|
C-like pointer in Fortran. This is accomplished through a pair of
|
2292 |
|
|
variables: an integer "pointer" that holds a memory address, and a
|
2293 |
|
|
"pointee" that is used to dereference the pointer.
|
2294 |
|
|
|
2295 |
|
|
Pointer/pointee pairs are declared in statements of the form:
|
2296 |
|
|
pointer ( , )
|
2297 |
|
|
or,
|
2298 |
|
|
pointer ( , ), ( , ), ...
|
2299 |
|
|
The pointer is an integer that is intended to hold a memory address.
|
2300 |
|
|
The pointee may be an array or scalar. A pointee can be an assumed
|
2301 |
|
|
size array--that is, the last dimension may be left unspecified by
|
2302 |
|
|
using a `*' in place of a value--but a pointee cannot be an assumed
|
2303 |
|
|
shape array. No space is allocated for the pointee.
|
2304 |
|
|
|
2305 |
|
|
The pointee may have its type declared before or after the pointer
|
2306 |
|
|
statement, and its array specification (if any) may be declared before,
|
2307 |
|
|
during, or after the pointer statement. The pointer may be declared as
|
2308 |
|
|
an integer prior to the pointer statement. However, some machines have
|
2309 |
|
|
default integer sizes that are different than the size of a pointer,
|
2310 |
|
|
and so the following code is not portable:
|
2311 |
|
|
integer ipt
|
2312 |
|
|
pointer (ipt, iarr)
|
2313 |
|
|
If a pointer is declared with a kind that is too small, the compiler
|
2314 |
|
|
will issue a warning; the resulting binary will probably not work
|
2315 |
|
|
correctly, because the memory addresses stored in the pointers may be
|
2316 |
|
|
truncated. It is safer to omit the first line of the above example; if
|
2317 |
|
|
explicit declaration of ipt's type is omitted, then the compiler will
|
2318 |
|
|
ensure that ipt is an integer variable large enough to hold a pointer.
|
2319 |
|
|
|
2320 |
|
|
Pointer arithmetic is valid with Cray pointers, but it is not the
|
2321 |
|
|
same as C pointer arithmetic. Cray pointers are just ordinary
|
2322 |
|
|
integers, so the user is responsible for determining how many bytes to
|
2323 |
|
|
add to a pointer in order to increment it. Consider the following
|
2324 |
|
|
example:
|
2325 |
|
|
real target(10)
|
2326 |
|
|
real pointee(10)
|
2327 |
|
|
pointer (ipt, pointee)
|
2328 |
|
|
ipt = loc (target)
|
2329 |
|
|
ipt = ipt + 1
|
2330 |
|
|
The last statement does not set `ipt' to the address of `target(1)',
|
2331 |
|
|
as it would in C pointer arithmetic. Adding `1' to `ipt' just adds one
|
2332 |
|
|
byte to the address stored in `ipt'.
|
2333 |
|
|
|
2334 |
|
|
Any expression involving the pointee will be translated to use the
|
2335 |
|
|
value stored in the pointer as the base address.
|
2336 |
|
|
|
2337 |
|
|
To get the address of elements, this extension provides an intrinsic
|
2338 |
|
|
function `LOC()'. The `LOC()' function is equivalent to the `&'
|
2339 |
|
|
operator in C, except the address is cast to an integer type:
|
2340 |
|
|
real ar(10)
|
2341 |
|
|
pointer(ipt, arpte(10))
|
2342 |
|
|
real arpte
|
2343 |
|
|
ipt = loc(ar) ! Makes arpte is an alias for ar
|
2344 |
|
|
arpte(1) = 1.0 ! Sets ar(1) to 1.0
|
2345 |
|
|
The pointer can also be set by a call to the `MALLOC' intrinsic (see
|
2346 |
|
|
*note MALLOC::).
|
2347 |
|
|
|
2348 |
|
|
Cray pointees often are used to alias an existing variable. For
|
2349 |
|
|
example:
|
2350 |
|
|
integer target(10)
|
2351 |
|
|
integer iarr(10)
|
2352 |
|
|
pointer (ipt, iarr)
|
2353 |
|
|
ipt = loc(target)
|
2354 |
|
|
As long as `ipt' remains unchanged, `iarr' is now an alias for
|
2355 |
|
|
`target'. The optimizer, however, will not detect this aliasing, so it
|
2356 |
|
|
is unsafe to use `iarr' and `target' simultaneously. Using a pointee
|
2357 |
|
|
in any way that violates the Fortran aliasing rules or assumptions is
|
2358 |
|
|
illegal. It is the user's responsibility to avoid doing this; the
|
2359 |
|
|
compiler works under the assumption that no such aliasing occurs.
|
2360 |
|
|
|
2361 |
|
|
Cray pointers will work correctly when there is no aliasing (i.e.,
|
2362 |
|
|
when they are used to access a dynamically allocated block of memory),
|
2363 |
|
|
and also in any routine where a pointee is used, but any variable with
|
2364 |
|
|
which it shares storage is not used. Code that violates these rules
|
2365 |
|
|
may not run as the user intends. This is not a bug in the optimizer;
|
2366 |
|
|
any code that violates the aliasing rules is illegal. (Note that this
|
2367 |
|
|
is not unique to GNU Fortran; any Fortran compiler that supports Cray
|
2368 |
|
|
pointers will "incorrectly" optimize code with illegal aliasing.)
|
2369 |
|
|
|
2370 |
|
|
There are a number of restrictions on the attributes that can be
|
2371 |
|
|
applied to Cray pointers and pointees. Pointees may not have the
|
2372 |
|
|
`ALLOCATABLE', `INTENT', `OPTIONAL', `DUMMY', `TARGET', `INTRINSIC', or
|
2373 |
|
|
`POINTER' attributes. Pointers may not have the `DIMENSION', `POINTER',
|
2374 |
|
|
`TARGET', `ALLOCATABLE', `EXTERNAL', or `INTRINSIC' attributes.
|
2375 |
|
|
Pointees may not occur in more than one pointer statement. A pointee
|
2376 |
|
|
cannot be a pointer. Pointees cannot occur in equivalence, common, or
|
2377 |
|
|
data statements.
|
2378 |
|
|
|
2379 |
|
|
A Cray pointer may also point to a function or a subroutine. For
|
2380 |
|
|
example, the following excerpt is valid:
|
2381 |
|
|
implicit none
|
2382 |
|
|
external sub
|
2383 |
|
|
pointer (subptr,subpte)
|
2384 |
|
|
external subpte
|
2385 |
|
|
subptr = loc(sub)
|
2386 |
|
|
call subpte()
|
2387 |
|
|
[...]
|
2388 |
|
|
subroutine sub
|
2389 |
|
|
[...]
|
2390 |
|
|
end subroutine sub
|
2391 |
|
|
|
2392 |
|
|
A pointer may be modified during the course of a program, and this
|
2393 |
|
|
will change the location to which the pointee refers. However, when
|
2394 |
|
|
pointees are passed as arguments, they are treated as ordinary
|
2395 |
|
|
variables in the invoked function. Subsequent changes to the pointer
|
2396 |
|
|
will not change the base address of the array that was passed.
|
2397 |
|
|
|
2398 |
|
|
|
2399 |
|
|
File: gfortran.info, Node: CONVERT specifier, Next: OpenMP, Prev: Cray pointers, Up: Extensions implemented in GNU Fortran
|
2400 |
|
|
|
2401 |
|
|
6.1.14 `CONVERT' specifier
|
2402 |
|
|
--------------------------
|
2403 |
|
|
|
2404 |
|
|
GNU Fortran allows the conversion of unformatted data between little-
|
2405 |
|
|
and big-endian representation to facilitate moving of data between
|
2406 |
|
|
different systems. The conversion can be indicated with the `CONVERT'
|
2407 |
|
|
specifier on the `OPEN' statement. *Note GFORTRAN_CONVERT_UNIT::, for
|
2408 |
|
|
an alternative way of specifying the data format via an environment
|
2409 |
|
|
variable.
|
2410 |
|
|
|
2411 |
|
|
Valid values for `CONVERT' are:
|
2412 |
|
|
`CONVERT='NATIVE'' Use the native format. This is the default.
|
2413 |
|
|
|
2414 |
|
|
`CONVERT='SWAP'' Swap between little- and big-endian.
|
2415 |
|
|
|
2416 |
|
|
`CONVERT='LITTLE_ENDIAN'' Use the little-endian representation for
|
2417 |
|
|
unformatted files.
|
2418 |
|
|
|
2419 |
|
|
`CONVERT='BIG_ENDIAN'' Use the big-endian representation for
|
2420 |
|
|
unformatted files.
|
2421 |
|
|
|
2422 |
|
|
Using the option could look like this:
|
2423 |
|
|
open(file='big.dat',form='unformatted',access='sequential', &
|
2424 |
|
|
convert='big_endian')
|
2425 |
|
|
|
2426 |
|
|
The value of the conversion can be queried by using
|
2427 |
|
|
`INQUIRE(CONVERT=ch)'. The values returned are `'BIG_ENDIAN'' and
|
2428 |
|
|
`'LITTLE_ENDIAN''.
|
2429 |
|
|
|
2430 |
|
|
`CONVERT' works between big- and little-endian for `INTEGER' values
|
2431 |
|
|
of all supported kinds and for `REAL' on IEEE systems of kinds 4 and 8.
|
2432 |
|
|
Conversion between different "extended double" types on different
|
2433 |
|
|
architectures such as m68k and x86_64, which GNU Fortran supports as
|
2434 |
|
|
`REAL(KIND=10)' and `REAL(KIND=16)', will probably not work.
|
2435 |
|
|
|
2436 |
|
|
_Note that the values specified via the GFORTRAN_CONVERT_UNIT
|
2437 |
|
|
environment variable will override the CONVERT specifier in the open
|
2438 |
|
|
statement_. This is to give control over data formats to users who do
|
2439 |
|
|
not have the source code of their program available.
|
2440 |
|
|
|
2441 |
|
|
Using anything but the native representation for unformatted data
|
2442 |
|
|
carries a significant speed overhead. If speed in this area matters to
|
2443 |
|
|
you, it is best if you use this only for data that needs to be portable.
|
2444 |
|
|
|
2445 |
|
|
|
2446 |
|
|
File: gfortran.info, Node: OpenMP, Next: Argument list functions, Prev: CONVERT specifier, Up: Extensions implemented in GNU Fortran
|
2447 |
|
|
|
2448 |
|
|
6.1.15 OpenMP
|
2449 |
|
|
-------------
|
2450 |
|
|
|
2451 |
|
|
OpenMP (Open Multi-Processing) is an application programming interface
|
2452 |
|
|
(API) that supports multi-platform shared memory multiprocessing
|
2453 |
|
|
programming in C/C++ and Fortran on many architectures, including Unix
|
2454 |
|
|
and Microsoft Windows platforms. It consists of a set of compiler
|
2455 |
|
|
directives, library routines, and environment variables that influence
|
2456 |
|
|
run-time behavior.
|
2457 |
|
|
|
2458 |
|
|
GNU Fortran strives to be compatible to the OpenMP Application
|
2459 |
|
|
Program Interface v3.0 (http://www.openmp.org/mp-documents/spec30.pdf).
|
2460 |
|
|
|
2461 |
|
|
To enable the processing of the OpenMP directive `!$omp' in
|
2462 |
|
|
free-form source code; the `c$omp', `*$omp' and `!$omp' directives in
|
2463 |
|
|
fixed form; the `!$' conditional compilation sentinels in free form;
|
2464 |
|
|
and the `c$', `*$' and `!$' sentinels in fixed form, `gfortran' needs
|
2465 |
|
|
to be invoked with the `-fopenmp'. This also arranges for automatic
|
2466 |
|
|
linking of the GNU OpenMP runtime library *note libgomp: (libgomp)Top.
|
2467 |
|
|
|
2468 |
|
|
The OpenMP Fortran runtime library routines are provided both in a
|
2469 |
|
|
form of a Fortran 90 module named `omp_lib' and in a form of a Fortran
|
2470 |
|
|
`include' file named `omp_lib.h'.
|
2471 |
|
|
|
2472 |
|
|
An example of a parallelized loop taken from Appendix A.1 of the
|
2473 |
|
|
OpenMP Application Program Interface v2.5:
|
2474 |
|
|
SUBROUTINE A1(N, A, B)
|
2475 |
|
|
INTEGER I, N
|
2476 |
|
|
REAL B(N), A(N)
|
2477 |
|
|
!$OMP PARALLEL DO !I is private by default
|
2478 |
|
|
DO I=2,N
|
2479 |
|
|
B(I) = (A(I) + A(I-1)) / 2.0
|
2480 |
|
|
ENDDO
|
2481 |
|
|
!$OMP END PARALLEL DO
|
2482 |
|
|
END SUBROUTINE A1
|
2483 |
|
|
|
2484 |
|
|
Please note:
|
2485 |
|
|
* `-fopenmp' implies `-frecursive', i.e., all local arrays will be
|
2486 |
|
|
allocated on the stack. When porting existing code to OpenMP, this
|
2487 |
|
|
may lead to surprising results, especially to segmentation faults
|
2488 |
|
|
if the stacksize is limited.
|
2489 |
|
|
|
2490 |
|
|
* On glibc-based systems, OpenMP enabled applications cannot be
|
2491 |
|
|
statically linked due to limitations of the underlying
|
2492 |
|
|
pthreads-implementation. It might be possible to get a working
|
2493 |
|
|
solution if `-Wl,--whole-archive -lpthread -Wl,--no-whole-archive'
|
2494 |
|
|
is added to the command line. However, this is not supported by
|
2495 |
|
|
`gcc' and thus not recommended.
|
2496 |
|
|
|
2497 |
|
|
|
2498 |
|
|
File: gfortran.info, Node: Argument list functions, Prev: OpenMP, Up: Extensions implemented in GNU Fortran
|
2499 |
|
|
|
2500 |
|
|
6.1.16 Argument list functions `%VAL', `%REF' and `%LOC'
|
2501 |
|
|
--------------------------------------------------------
|
2502 |
|
|
|
2503 |
|
|
GNU Fortran supports argument list functions `%VAL', `%REF' and `%LOC'
|
2504 |
|
|
statements, for backward compatibility with g77. It is recommended
|
2505 |
|
|
that these should be used only for code that is accessing facilities
|
2506 |
|
|
outside of GNU Fortran, such as operating system or windowing
|
2507 |
|
|
facilities. It is best to constrain such uses to isolated portions of a
|
2508 |
|
|
program-portions that deal specifically and exclusively with low-level,
|
2509 |
|
|
system-dependent facilities. Such portions might well provide a
|
2510 |
|
|
portable interface for use by the program as a whole, but are
|
2511 |
|
|
themselves not portable, and should be thoroughly tested each time they
|
2512 |
|
|
are rebuilt using a new compiler or version of a compiler.
|
2513 |
|
|
|
2514 |
|
|
`%VAL' passes a scalar argument by value, `%REF' passes it by
|
2515 |
|
|
reference and `%LOC' passes its memory location. Since gfortran
|
2516 |
|
|
already passes scalar arguments by reference, `%REF' is in effect a
|
2517 |
|
|
do-nothing. `%LOC' has the same effect as a Fortran pointer.
|
2518 |
|
|
|
2519 |
|
|
An example of passing an argument by value to a C subroutine foo.:
|
2520 |
|
|
C
|
2521 |
|
|
C prototype void foo_ (float x);
|
2522 |
|
|
C
|
2523 |
|
|
external foo
|
2524 |
|
|
real*4 x
|
2525 |
|
|
x = 3.14159
|
2526 |
|
|
call foo (%VAL (x))
|
2527 |
|
|
end
|
2528 |
|
|
|
2529 |
|
|
For details refer to the g77 manual
|
2530 |
|
|
`http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/index.html#Top'.
|
2531 |
|
|
|
2532 |
|
|
Also, `c_by_val.f' and its partner `c_by_val.c' of the GNU Fortran
|
2533 |
|
|
testsuite are worth a look.
|
2534 |
|
|
|
2535 |
|
|
|
2536 |
|
|
File: gfortran.info, Node: Extensions not implemented in GNU Fortran, Prev: Extensions implemented in GNU Fortran, Up: Extensions
|
2537 |
|
|
|
2538 |
|
|
6.2 Extensions not implemented in GNU Fortran
|
2539 |
|
|
=============================================
|
2540 |
|
|
|
2541 |
|
|
The long history of the Fortran language, its wide use and broad
|
2542 |
|
|
userbase, the large number of different compiler vendors and the lack of
|
2543 |
|
|
some features crucial to users in the first standards have lead to the
|
2544 |
|
|
existence of a number of important extensions to the language. While
|
2545 |
|
|
some of the most useful or popular extensions are supported by the GNU
|
2546 |
|
|
Fortran compiler, not all existing extensions are supported. This
|
2547 |
|
|
section aims at listing these extensions and offering advice on how
|
2548 |
|
|
best make code that uses them running with the GNU Fortran compiler.
|
2549 |
|
|
|
2550 |
|
|
* Menu:
|
2551 |
|
|
|
2552 |
|
|
* STRUCTURE and RECORD::
|
2553 |
|
|
* ENCODE and DECODE statements::
|
2554 |
|
|
* Variable FORMAT expressions::
|
2555 |
|
|
|
2556 |
|
|
|
2557 |
|
|
File: gfortran.info, Node: STRUCTURE and RECORD, Next: ENCODE and DECODE statements, Up: Extensions not implemented in GNU Fortran
|
2558 |
|
|
|
2559 |
|
|
6.2.1 `STRUCTURE' and `RECORD'
|
2560 |
|
|
------------------------------
|
2561 |
|
|
|
2562 |
|
|
Structures are user-defined aggregate data types; this functionality was
|
2563 |
|
|
standardized in Fortran 90 with an different syntax, under the name of
|
2564 |
|
|
"derived types". Here is an example of code using the non portable
|
2565 |
|
|
structure syntax:
|
2566 |
|
|
|
2567 |
|
|
! Declaring a structure named ``item'' and containing three fields:
|
2568 |
|
|
! an integer ID, an description string and a floating-point price.
|
2569 |
|
|
STRUCTURE /item/
|
2570 |
|
|
INTEGER id
|
2571 |
|
|
CHARACTER(LEN=200) description
|
2572 |
|
|
REAL price
|
2573 |
|
|
END STRUCTURE
|
2574 |
|
|
|
2575 |
|
|
! Define two variables, an single record of type ``item''
|
2576 |
|
|
! named ``pear'', and an array of items named ``store_catalog''
|
2577 |
|
|
RECORD /item/ pear, store_catalog(100)
|
2578 |
|
|
|
2579 |
|
|
! We can directly access the fields of both variables
|
2580 |
|
|
pear.id = 92316
|
2581 |
|
|
pear.description = "juicy D'Anjou pear"
|
2582 |
|
|
pear.price = 0.15
|
2583 |
|
|
store_catalog(7).id = 7831
|
2584 |
|
|
store_catalog(7).description = "milk bottle"
|
2585 |
|
|
store_catalog(7).price = 1.2
|
2586 |
|
|
|
2587 |
|
|
! We can also manipulate the whole structure
|
2588 |
|
|
store_catalog(12) = pear
|
2589 |
|
|
print *, store_catalog(12)
|
2590 |
|
|
|
2591 |
|
|
This code can easily be rewritten in the Fortran 90 syntax as following:
|
2592 |
|
|
|
2593 |
|
|
! ``STRUCTURE /name/ ... END STRUCTURE'' becomes
|
2594 |
|
|
! ``TYPE name ... END TYPE''
|
2595 |
|
|
TYPE item
|
2596 |
|
|
INTEGER id
|
2597 |
|
|
CHARACTER(LEN=200) description
|
2598 |
|
|
REAL price
|
2599 |
|
|
END TYPE
|
2600 |
|
|
|
2601 |
|
|
! ``RECORD /name/ variable'' becomes ``TYPE(name) variable''
|
2602 |
|
|
TYPE(item) pear, store_catalog(100)
|
2603 |
|
|
|
2604 |
|
|
! Instead of using a dot (.) to access fields of a record, the
|
2605 |
|
|
! standard syntax uses a percent sign (%)
|
2606 |
|
|
pear%id = 92316
|
2607 |
|
|
pear%description = "juicy D'Anjou pear"
|
2608 |
|
|
pear%price = 0.15
|
2609 |
|
|
store_catalog(7)%id = 7831
|
2610 |
|
|
store_catalog(7)%description = "milk bottle"
|
2611 |
|
|
store_catalog(7)%price = 1.2
|
2612 |
|
|
|
2613 |
|
|
! Assignments of a whole variable don't change
|
2614 |
|
|
store_catalog(12) = pear
|
2615 |
|
|
print *, store_catalog(12)
|
2616 |
|
|
|
2617 |
|
|
|
2618 |
|
|
File: gfortran.info, Node: ENCODE and DECODE statements, Next: Variable FORMAT expressions, Prev: STRUCTURE and RECORD, Up: Extensions not implemented in GNU Fortran
|
2619 |
|
|
|
2620 |
|
|
6.2.2 `ENCODE' and `DECODE' statements
|
2621 |
|
|
--------------------------------------
|
2622 |
|
|
|
2623 |
|
|
GNU Fortran doesn't support the `ENCODE' and `DECODE' statements.
|
2624 |
|
|
These statements are best replaced by `READ' and `WRITE' statements
|
2625 |
|
|
involving internal files (`CHARACTER' variables and arrays), which have
|
2626 |
|
|
been part of the Fortran standard since Fortran 77. For example,
|
2627 |
|
|
replace a code fragment like
|
2628 |
|
|
|
2629 |
|
|
INTEGER*1 LINE(80)
|
2630 |
|
|
REAL A, B, C
|
2631 |
|
|
c ... Code that sets LINE
|
2632 |
|
|
DECODE (80, 9000, LINE) A, B, C
|
2633 |
|
|
9000 FORMAT (1X, 3(F10.5))
|
2634 |
|
|
|
2635 |
|
|
with the following:
|
2636 |
|
|
|
2637 |
|
|
CHARACTER(LEN=80) LINE
|
2638 |
|
|
REAL A, B, C
|
2639 |
|
|
c ... Code that sets LINE
|
2640 |
|
|
READ (UNIT=LINE, FMT=9000) A, B, C
|
2641 |
|
|
9000 FORMAT (1X, 3(F10.5))
|
2642 |
|
|
|
2643 |
|
|
Similarly, replace a code fragment like
|
2644 |
|
|
|
2645 |
|
|
INTEGER*1 LINE(80)
|
2646 |
|
|
REAL A, B, C
|
2647 |
|
|
c ... Code that sets A, B and C
|
2648 |
|
|
ENCODE (80, 9000, LINE) A, B, C
|
2649 |
|
|
9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
|
2650 |
|
|
|
2651 |
|
|
with the following:
|
2652 |
|
|
|
2653 |
|
|
CHARACTER(LEN=80) LINE
|
2654 |
|
|
REAL A, B, C
|
2655 |
|
|
c ... Code that sets A, B and C
|
2656 |
|
|
WRITE (UNIT=LINE, FMT=9000) A, B, C
|
2657 |
|
|
9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
|
2658 |
|
|
|
2659 |
|
|
|
2660 |
|
|
File: gfortran.info, Node: Variable FORMAT expressions, Prev: ENCODE and DECODE statements, Up: Extensions not implemented in GNU Fortran
|
2661 |
|
|
|
2662 |
|
|
6.2.3 Variable `FORMAT' expressions
|
2663 |
|
|
-----------------------------------
|
2664 |
|
|
|
2665 |
|
|
A variable `FORMAT' expression is format statement which includes angle
|
2666 |
|
|
brackets enclosing a Fortran expression: `FORMAT(I)'. GNU Fortran
|
2667 |
|
|
does not support this legacy extension. The effect of variable format
|
2668 |
|
|
expressions can be reproduced by using the more powerful (and standard)
|
2669 |
|
|
combination of internal output and string formats. For example, replace
|
2670 |
|
|
a code fragment like this:
|
2671 |
|
|
|
2672 |
|
|
WRITE(6,20) INT1
|
2673 |
|
|
20 FORMAT(I)
|
2674 |
|
|
|
2675 |
|
|
with the following:
|
2676 |
|
|
|
2677 |
|
|
c Variable declaration
|
2678 |
|
|
CHARACTER(LEN=20) F
|
2679 |
|
|
c
|
2680 |
|
|
c Other code here...
|
2681 |
|
|
c
|
2682 |
|
|
WRITE(FMT,'("(I", I0, ")")') N+1
|
2683 |
|
|
WRITE(6,FM) INT1
|
2684 |
|
|
|
2685 |
|
|
or with:
|
2686 |
|
|
|
2687 |
|
|
c Variable declaration
|
2688 |
|
|
CHARACTER(LEN=20) FMT
|
2689 |
|
|
c
|
2690 |
|
|
c Other code here...
|
2691 |
|
|
c
|
2692 |
|
|
WRITE(FMT,*) N+1
|
2693 |
|
|
WRITE(6,"(I" // ADJUSTL(FMT) // ")") INT1
|
2694 |
|
|
|
2695 |
|
|
|
2696 |
|
|
File: gfortran.info, Node: Mixed-Language Programming, Next: Extensions, Prev: Compiler Characteristics, Up: Top
|
2697 |
|
|
|
2698 |
|
|
7 Mixed-Language Programming
|
2699 |
|
|
****************************
|
2700 |
|
|
|
2701 |
|
|
* Menu:
|
2702 |
|
|
|
2703 |
|
|
* Interoperability with C::
|
2704 |
|
|
* GNU Fortran Compiler Directives::
|
2705 |
|
|
* Non-Fortran Main Program::
|
2706 |
|
|
|
2707 |
|
|
This chapter is about mixed-language interoperability, but also
|
2708 |
|
|
applies if one links Fortran code compiled by different compilers. In
|
2709 |
|
|
most cases, use of the C Binding features of the Fortran 2003 standard
|
2710 |
|
|
is sufficient, and their use is highly recommended.
|
2711 |
|
|
|
2712 |
|
|
|
2713 |
|
|
File: gfortran.info, Node: Interoperability with C, Next: GNU Fortran Compiler Directives, Up: Mixed-Language Programming
|
2714 |
|
|
|
2715 |
|
|
7.1 Interoperability with C
|
2716 |
|
|
===========================
|
2717 |
|
|
|
2718 |
|
|
* Menu:
|
2719 |
|
|
|
2720 |
|
|
* Intrinsic Types::
|
2721 |
|
|
* Further Interoperability of Fortran with C::
|
2722 |
|
|
* Derived Types and struct::
|
2723 |
|
|
* Interoperable Global Variables::
|
2724 |
|
|
* Interoperable Subroutines and Functions::
|
2725 |
|
|
|
2726 |
|
|
Since Fortran 2003 (ISO/IEC 1539-1:2004(E)) there is a standardized
|
2727 |
|
|
way to generate procedure and derived-type declarations and global
|
2728 |
|
|
variables which are interoperable with C (ISO/IEC 9899:1999). The
|
2729 |
|
|
`bind(C)' attribute has been added to inform the compiler that a symbol
|
2730 |
|
|
shall be interoperable with C; also, some constraints are added. Note,
|
2731 |
|
|
however, that not all C features have a Fortran equivalent or vice
|
2732 |
|
|
versa. For instance, neither C's unsigned integers nor C's functions
|
2733 |
|
|
with variable number of arguments have an equivalent in Fortran.
|
2734 |
|
|
|
2735 |
|
|
Note that array dimensions are reversely ordered in C and that
|
2736 |
|
|
arrays in C always start with index 0 while in Fortran they start by
|
2737 |
|
|
default with 1. Thus, an array declaration `A(n,m)' in Fortran matches
|
2738 |
|
|
`A[m][n]' in C and accessing the element `A(i,j)' matches
|
2739 |
|
|
`A[j-1][i-1]'. The element following `A(i,j)' (C: `A[j-1][i-1]';
|
2740 |
|
|
assuming i < n) in memory is `A(i+1,j)' (C: `A[j-1][i]').
|
2741 |
|
|
|
2742 |
|
|
|
2743 |
|
|
File: gfortran.info, Node: Intrinsic Types, Next: Further Interoperability of Fortran with C, Up: Interoperability with C
|
2744 |
|
|
|
2745 |
|
|
7.1.1 Intrinsic Types
|
2746 |
|
|
---------------------
|
2747 |
|
|
|
2748 |
|
|
In order to ensure that exactly the same variable type and kind is used
|
2749 |
|
|
in C and Fortran, the named constants shall be used which are defined
|
2750 |
|
|
in the `ISO_C_BINDING' intrinsic module. That module contains named
|
2751 |
|
|
constants for kind parameters and character named constants for the
|
2752 |
|
|
escape sequences in C. For a list of the constants, see *note
|
2753 |
|
|
ISO_C_BINDING::.
|
2754 |
|
|
|
2755 |
|
|
|
2756 |
|
|
File: gfortran.info, Node: Derived Types and struct, Next: Interoperable Global Variables, Prev: Further Interoperability of Fortran with C, Up: Interoperability with C
|
2757 |
|
|
|
2758 |
|
|
7.1.2 Derived Types and struct
|
2759 |
|
|
------------------------------
|
2760 |
|
|
|
2761 |
|
|
For compatibility of derived types with `struct', one needs to use the
|
2762 |
|
|
`BIND(C)' attribute in the type declaration. For instance, the
|
2763 |
|
|
following type declaration
|
2764 |
|
|
|
2765 |
|
|
USE ISO_C_BINDING
|
2766 |
|
|
TYPE, BIND(C) :: myType
|
2767 |
|
|
INTEGER(C_INT) :: i1, i2
|
2768 |
|
|
INTEGER(C_SIGNED_CHAR) :: i3
|
2769 |
|
|
REAL(C_DOUBLE) :: d1
|
2770 |
|
|
COMPLEX(C_FLOAT_COMPLEX) :: c1
|
2771 |
|
|
CHARACTER(KIND=C_CHAR) :: str(5)
|
2772 |
|
|
END TYPE
|
2773 |
|
|
|
2774 |
|
|
matches the following `struct' declaration in C
|
2775 |
|
|
|
2776 |
|
|
struct {
|
2777 |
|
|
int i1, i2;
|
2778 |
|
|
/* Note: "char" might be signed or unsigned. */
|
2779 |
|
|
signed char i3;
|
2780 |
|
|
double d1;
|
2781 |
|
|
float _Complex c1;
|
2782 |
|
|
char str[5];
|
2783 |
|
|
} myType;
|
2784 |
|
|
|
2785 |
|
|
Derived types with the C binding attribute shall not have the
|
2786 |
|
|
`sequence' attribute, type parameters, the `extends' attribute, nor
|
2787 |
|
|
type-bound procedures. Every component must be of interoperable type
|
2788 |
|
|
and kind and may not have the `pointer' or `allocatable' attribute. The
|
2789 |
|
|
names of the variables are irrelevant for interoperability.
|
2790 |
|
|
|
2791 |
|
|
As there exist no direct Fortran equivalents, neither unions nor
|
2792 |
|
|
structs with bit field or variable-length array members are
|
2793 |
|
|
interoperable.
|
2794 |
|
|
|
2795 |
|
|
|
2796 |
|
|
File: gfortran.info, Node: Interoperable Global Variables, Next: Interoperable Subroutines and Functions, Prev: Derived Types and struct, Up: Interoperability with C
|
2797 |
|
|
|
2798 |
|
|
7.1.3 Interoperable Global Variables
|
2799 |
|
|
------------------------------------
|
2800 |
|
|
|
2801 |
|
|
Variables can be made accessible from C using the C binding attribute,
|
2802 |
|
|
optionally together with specifying a binding name. Those variables
|
2803 |
|
|
have to be declared in the declaration part of a `MODULE', be of
|
2804 |
|
|
interoperable type, and have neither the `pointer' nor the
|
2805 |
|
|
`allocatable' attribute.
|
2806 |
|
|
|
2807 |
|
|
MODULE m
|
2808 |
|
|
USE myType_module
|
2809 |
|
|
USE ISO_C_BINDING
|
2810 |
|
|
integer(C_INT), bind(C, name="_MyProject_flags") :: global_flag
|
2811 |
|
|
type(myType), bind(C) :: tp
|
2812 |
|
|
END MODULE
|
2813 |
|
|
|
2814 |
|
|
Here, `_MyProject_flags' is the case-sensitive name of the variable
|
2815 |
|
|
as seen from C programs while `global_flag' is the case-insensitive
|
2816 |
|
|
name as seen from Fortran. If no binding name is specified, as for TP,
|
2817 |
|
|
the C binding name is the (lowercase) Fortran binding name. If a
|
2818 |
|
|
binding name is specified, only a single variable may be after the
|
2819 |
|
|
double colon. Note of warning: You cannot use a global variable to
|
2820 |
|
|
access ERRNO of the C library as the C standard allows it to be a
|
2821 |
|
|
macro. Use the `IERRNO' intrinsic (GNU extension) instead.
|
2822 |
|
|
|
2823 |
|
|
|
2824 |
|
|
File: gfortran.info, Node: Interoperable Subroutines and Functions, Prev: Interoperable Global Variables, Up: Interoperability with C
|
2825 |
|
|
|
2826 |
|
|
7.1.4 Interoperable Subroutines and Functions
|
2827 |
|
|
---------------------------------------------
|
2828 |
|
|
|
2829 |
|
|
Subroutines and functions have to have the `BIND(C)' attribute to be
|
2830 |
|
|
compatible with C. The dummy argument declaration is relatively
|
2831 |
|
|
straightforward. However, one needs to be careful because C uses
|
2832 |
|
|
call-by-value by default while Fortran behaves usually similar to
|
2833 |
|
|
call-by-reference. Furthermore, strings and pointers are handled
|
2834 |
|
|
differently. Note that only explicit size and assumed-size arrays are
|
2835 |
|
|
supported but not assumed-shape or allocatable arrays.
|
2836 |
|
|
|
2837 |
|
|
To pass a variable by value, use the `VALUE' attribute. Thus the
|
2838 |
|
|
following C prototype
|
2839 |
|
|
|
2840 |
|
|
`int func(int i, int *j)'
|
2841 |
|
|
|
2842 |
|
|
matches the Fortran declaration
|
2843 |
|
|
|
2844 |
|
|
integer(c_int) function func(i,j)
|
2845 |
|
|
use iso_c_binding, only: c_int
|
2846 |
|
|
integer(c_int), VALUE :: i
|
2847 |
|
|
integer(c_int) :: j
|
2848 |
|
|
|
2849 |
|
|
Note that pointer arguments also frequently need the `VALUE'
|
2850 |
|
|
attribute.
|
2851 |
|
|
|
2852 |
|
|
Strings are handled quite differently in C and Fortran. In C a string
|
2853 |
|
|
is a `NUL'-terminated array of characters while in Fortran each string
|
2854 |
|
|
has a length associated with it and is thus not terminated (by e.g.
|
2855 |
|
|
`NUL'). For example, if one wants to use the following C function,
|
2856 |
|
|
|
2857 |
|
|
#include
|
2858 |
|
|
void print_C(char *string) /* equivalent: char string[] */
|
2859 |
|
|
{
|
2860 |
|
|
printf("%s\n", string);
|
2861 |
|
|
}
|
2862 |
|
|
|
2863 |
|
|
to print "Hello World" from Fortran, one can call it using
|
2864 |
|
|
|
2865 |
|
|
use iso_c_binding, only: C_CHAR, C_NULL_CHAR
|
2866 |
|
|
interface
|
2867 |
|
|
subroutine print_c(string) bind(C, name="print_C")
|
2868 |
|
|
use iso_c_binding, only: c_char
|
2869 |
|
|
character(kind=c_char) :: string(*)
|
2870 |
|
|
end subroutine print_c
|
2871 |
|
|
end interface
|
2872 |
|
|
call print_c(C_CHAR_"Hello World"//C_NULL_CHAR)
|
2873 |
|
|
|
2874 |
|
|
As the example shows, one needs to ensure that the string is `NUL'
|
2875 |
|
|
terminated. Additionally, the dummy argument STRING of `print_C' is a
|
2876 |
|
|
length-one assumed-size array; using `character(len=*)' is not allowed.
|
2877 |
|
|
The example above uses `c_char_"Hello World"' to ensure the string
|
2878 |
|
|
literal has the right type; typically the default character kind and
|
2879 |
|
|
`c_char' are the same and thus `"Hello World"' is equivalent. However,
|
2880 |
|
|
the standard does not guarantee this.
|
2881 |
|
|
|
2882 |
|
|
The use of pointers is now illustrated using the C library function
|
2883 |
|
|
`strncpy', whose prototype is
|
2884 |
|
|
|
2885 |
|
|
char *strncpy(char *restrict s1, const char *restrict s2, size_t n);
|
2886 |
|
|
|
2887 |
|
|
The function `strncpy' copies at most N characters from string S2 to
|
2888 |
|
|
S1 and returns S1. In the following example, we ignore the return value:
|
2889 |
|
|
|
2890 |
|
|
use iso_c_binding
|
2891 |
|
|
implicit none
|
2892 |
|
|
character(len=30) :: str,str2
|
2893 |
|
|
interface
|
2894 |
|
|
! Ignore the return value of strncpy -> subroutine
|
2895 |
|
|
! "restrict" is always assumed if we do not pass a pointer
|
2896 |
|
|
subroutine strncpy(dest, src, n) bind(C)
|
2897 |
|
|
import
|
2898 |
|
|
character(kind=c_char), intent(out) :: dest(*)
|
2899 |
|
|
character(kind=c_char), intent(in) :: src(*)
|
2900 |
|
|
integer(c_size_t), value, intent(in) :: n
|
2901 |
|
|
end subroutine strncpy
|
2902 |
|
|
end interface
|
2903 |
|
|
str = repeat('X',30) ! Initialize whole string with 'X'
|
2904 |
|
|
call strncpy(str, c_char_"Hello World"//C_NULL_CHAR, &
|
2905 |
|
|
len(c_char_"Hello World",kind=c_size_t))
|
2906 |
|
|
print '(a)', str ! prints: "Hello WorldXXXXXXXXXXXXXXXXXXX"
|
2907 |
|
|
end
|
2908 |
|
|
|
2909 |
|
|
C pointers are represented in Fortran via the special derived type
|
2910 |
|
|
`type(c_ptr)', with private components. Thus one needs to use intrinsic
|
2911 |
|
|
conversion procedures to convert from or to C pointers. For example,
|
2912 |
|
|
|
2913 |
|
|
use iso_c_binding
|
2914 |
|
|
type(c_ptr) :: cptr1, cptr2
|
2915 |
|
|
integer, target :: array(7), scalar
|
2916 |
|
|
integer, pointer :: pa(:), ps
|
2917 |
|
|
cptr1 = c_loc(array(1)) ! The programmer needs to ensure that the
|
2918 |
|
|
! array is contiguous if required by the C
|
2919 |
|
|
! procedure
|
2920 |
|
|
cptr2 = c_loc(scalar)
|
2921 |
|
|
call c_f_pointer(cptr2, ps)
|
2922 |
|
|
call c_f_pointer(cptr2, pa, shape=[7])
|
2923 |
|
|
|
2924 |
|
|
When converting C to Fortran arrays, the one-dimensional `SHAPE'
|
2925 |
|
|
argument has to be passed. Note: A pointer argument `void *' matches
|
2926 |
|
|
`TYPE(C_PTR), VALUE' while `TYPE(C_PTR)' matches `void **'.
|
2927 |
|
|
|
2928 |
|
|
Procedure pointers are handled analogously to pointers; the C type is
|
2929 |
|
|
`TYPE(C_FUNPTR)' and the intrinsic conversion procedures are
|
2930 |
|
|
`C_F_PROC_POINTER' and `C_FUNLOC'.
|
2931 |
|
|
|
2932 |
|
|
The intrinsic procedures are described in *note Intrinsic
|
2933 |
|
|
Procedures::.
|
2934 |
|
|
|
2935 |
|
|
|
2936 |
|
|
File: gfortran.info, Node: Further Interoperability of Fortran with C, Next: Derived Types and struct, Prev: Intrinsic Types, Up: Interoperability with C
|
2937 |
|
|
|
2938 |
|
|
7.1.5 Further Interoperability of Fortran with C
|
2939 |
|
|
------------------------------------------------
|
2940 |
|
|
|
2941 |
|
|
Assumed-shape and allocatable arrays are passed using an array
|
2942 |
|
|
descriptor (dope vector). The internal structure of the array
|
2943 |
|
|
descriptor used by GNU Fortran is not yet documented and will change.
|
2944 |
|
|
There will also be a Technical Report (TR 29113) which standardizes an
|
2945 |
|
|
interoperable array descriptor. Until then, you can use the Chasm
|
2946 |
|
|
Language Interoperability Tools,
|
2947 |
|
|
`http://chasm-interop.sourceforge.net/', which provide an interface to
|
2948 |
|
|
GNU Fortran's array descriptor.
|
2949 |
|
|
|
2950 |
|
|
The technical report 29113 will presumably also include support for
|
2951 |
|
|
C-interoperable `OPTIONAL' and for assumed-rank and assumed-type dummy
|
2952 |
|
|
arguments. However, the TR has neither been approved nor implemented in
|
2953 |
|
|
GNU Fortran; therefore, these features are not yet available.
|
2954 |
|
|
|
2955 |
|
|
|
2956 |
|
|
File: gfortran.info, Node: GNU Fortran Compiler Directives, Next: Non-Fortran Main Program, Prev: Interoperability with C, Up: Mixed-Language Programming
|
2957 |
|
|
|
2958 |
|
|
7.2 GNU Fortran Compiler Directives
|
2959 |
|
|
===================================
|
2960 |
|
|
|
2961 |
|
|
The Fortran standard standard describes how a conforming program shall
|
2962 |
|
|
behave; however, the exact implementation is not standardized. In order
|
2963 |
|
|
to allow the user to choose specific implementation details, compiler
|
2964 |
|
|
directives can be used to set attributes of variables and procedures
|
2965 |
|
|
which are not part of the standard. Whether a given attribute is
|
2966 |
|
|
supported and its exact effects depend on both the operating system and
|
2967 |
|
|
on the processor; see *note C Extensions: (gcc)Top. for details.
|
2968 |
|
|
|
2969 |
|
|
For procedures and procedure pointers, the following attributes can
|
2970 |
|
|
be used to change the calling convention:
|
2971 |
|
|
|
2972 |
|
|
* `CDECL' - standard C calling convention
|
2973 |
|
|
|
2974 |
|
|
* `STDCALL' - convention where the called procedure pops the stack
|
2975 |
|
|
|
2976 |
|
|
* `FASTCALL' - part of the arguments are passed via registers
|
2977 |
|
|
instead using the stack
|
2978 |
|
|
|
2979 |
|
|
Besides changing the calling convention, the attributes also
|
2980 |
|
|
influence the decoration of the symbol name, e.g., by a leading
|
2981 |
|
|
underscore or by a trailing at-sign followed by the number of bytes on
|
2982 |
|
|
the stack. When assigning a procedure to a procedure pointer, both
|
2983 |
|
|
should use the same calling convention.
|
2984 |
|
|
|
2985 |
|
|
On some systems, procedures and global variables (module variables
|
2986 |
|
|
and `COMMON' blocks) need special handling to be accessible when they
|
2987 |
|
|
are in a shared library. The following attributes are available:
|
2988 |
|
|
|
2989 |
|
|
* `DLLEXPORT' - provide a global pointer to a pointer in the DLL
|
2990 |
|
|
|
2991 |
|
|
* `DLLIMPORT' - reference the function or variable using a global
|
2992 |
|
|
pointer
|
2993 |
|
|
|
2994 |
|
|
The attributes are specified using the syntax
|
2995 |
|
|
|
2996 |
|
|
`!GCC$ ATTRIBUTES' ATTRIBUTE-LIST `::' VARIABLE-LIST
|
2997 |
|
|
|
2998 |
|
|
where in free-form source code only whitespace is allowed before
|
2999 |
|
|
`!GCC$' and in fixed-form source code `!GCC$', `cGCC$' or `*GCC$' shall
|
3000 |
|
|
start in the first column.
|
3001 |
|
|
|
3002 |
|
|
For procedures, the compiler directives shall be placed into the body
|
3003 |
|
|
of the procedure; for variables and procedure pointers, they shall be in
|
3004 |
|
|
the same declaration part as the variable or procedure pointer.
|
3005 |
|
|
|
3006 |
|
|
|
3007 |
|
|
File: gfortran.info, Node: Non-Fortran Main Program, Prev: GNU Fortran Compiler Directives, Up: Mixed-Language Programming
|
3008 |
|
|
|
3009 |
|
|
7.3 Non-Fortran Main Program
|
3010 |
|
|
============================
|
3011 |
|
|
|
3012 |
|
|
* Menu:
|
3013 |
|
|
|
3014 |
|
|
* _gfortran_set_args:: Save command-line arguments
|
3015 |
|
|
* _gfortran_set_options:: Set library option flags
|
3016 |
|
|
* _gfortran_set_convert:: Set endian conversion
|
3017 |
|
|
* _gfortran_set_record_marker:: Set length of record markers
|
3018 |
|
|
* _gfortran_set_max_subrecord_length:: Set subrecord length
|
3019 |
|
|
* _gfortran_set_fpe:: Set when a Floating Point Exception should be raised
|
3020 |
|
|
|
3021 |
|
|
Even if you are doing mixed-language programming, it is very likely
|
3022 |
|
|
that you do not need to know or use the information in this section.
|
3023 |
|
|
Since it is about the internal structure of GNU Fortran, it may also
|
3024 |
|
|
change in GCC minor releases.
|
3025 |
|
|
|
3026 |
|
|
When you compile a `PROGRAM' with GNU Fortran, a function with the
|
3027 |
|
|
name `main' (in the symbol table of the object file) is generated,
|
3028 |
|
|
which initializes the libgfortran library and then calls the actual
|
3029 |
|
|
program which uses the name `MAIN__', for historic reasons. If you link
|
3030 |
|
|
GNU Fortran compiled procedures to, e.g., a C or C++ program or to a
|
3031 |
|
|
Fortran program compiled by a different compiler, the libgfortran
|
3032 |
|
|
library is not initialized and thus a few intrinsic procedures do not
|
3033 |
|
|
work properly, e.g. those for obtaining the command-line arguments.
|
3034 |
|
|
|
3035 |
|
|
Therefore, if your `PROGRAM' is not compiled with GNU Fortran and
|
3036 |
|
|
the GNU Fortran compiled procedures require intrinsics relying on the
|
3037 |
|
|
library initialization, you need to initialize the library yourself.
|
3038 |
|
|
Using the default options, gfortran calls `_gfortran_set_args' and
|
3039 |
|
|
`_gfortran_set_options'. The initialization of the former is needed if
|
3040 |
|
|
the called procedures access the command line (and for backtracing);
|
3041 |
|
|
the latter sets some flags based on the standard chosen or to enable
|
3042 |
|
|
backtracing. In typical programs, it is not necessary to call any
|
3043 |
|
|
initialization function.
|
3044 |
|
|
|
3045 |
|
|
If your `PROGRAM' is compiled with GNU Fortran, you shall not call
|
3046 |
|
|
any of the following functions. The libgfortran initialization
|
3047 |
|
|
functions are shown in C syntax but using C bindings they are also
|
3048 |
|
|
accessible from Fortran.
|
3049 |
|
|
|
3050 |
|
|
|
3051 |
|
|
File: gfortran.info, Node: _gfortran_set_args, Next: _gfortran_set_options, Up: Non-Fortran Main Program
|
3052 |
|
|
|
3053 |
|
|
7.3.1 `_gfortran_set_args' -- Save command-line arguments
|
3054 |
|
|
---------------------------------------------------------
|
3055 |
|
|
|
3056 |
|
|
_Description_:
|
3057 |
|
|
`_gfortran_set_args' saves the command-line arguments; this
|
3058 |
|
|
initialization is required if any of the command-line intrinsics
|
3059 |
|
|
is called. Additionally, it shall be called if backtracing is
|
3060 |
|
|
enabled (see `_gfortran_set_options').
|
3061 |
|
|
|
3062 |
|
|
_Syntax_:
|
3063 |
|
|
`void _gfortran_set_args (int argc, char *argv[])'
|
3064 |
|
|
|
3065 |
|
|
_Arguments_:
|
3066 |
|
|
ARGC number of command line argument strings
|
3067 |
|
|
ARGV the command-line argument strings; argv[0] is
|
3068 |
|
|
the pathname of the executable itself.
|
3069 |
|
|
|
3070 |
|
|
_Example_:
|
3071 |
|
|
int main (int argc, char *argv[])
|
3072 |
|
|
{
|
3073 |
|
|
/* Initialize libgfortran. */
|
3074 |
|
|
_gfortran_set_args (argc, argv);
|
3075 |
|
|
return 0;
|
3076 |
|
|
}
|
3077 |
|
|
|
3078 |
|
|
|
3079 |
|
|
File: gfortran.info, Node: _gfortran_set_options, Next: _gfortran_set_convert, Prev: _gfortran_set_args, Up: Non-Fortran Main Program
|
3080 |
|
|
|
3081 |
|
|
7.3.2 `_gfortran_set_options' -- Set library option flags
|
3082 |
|
|
---------------------------------------------------------
|
3083 |
|
|
|
3084 |
|
|
_Description_:
|
3085 |
|
|
`_gfortran_set_options' sets several flags related to the Fortran
|
3086 |
|
|
standard to be used, whether backtracing or core dumps should be
|
3087 |
|
|
enabled and whether range checks should be performed. The syntax
|
3088 |
|
|
allows for upward compatibility since the number of passed flags
|
3089 |
|
|
is specified; for non-passed flags, the default value is used. See
|
3090 |
|
|
also *note Code Gen Options::. Please note that not all flags are
|
3091 |
|
|
actually used.
|
3092 |
|
|
|
3093 |
|
|
_Syntax_:
|
3094 |
|
|
`void _gfortran_set_options (int num, int options[])'
|
3095 |
|
|
|
3096 |
|
|
_Arguments_:
|
3097 |
|
|
NUM number of options passed
|
3098 |
|
|
ARGV The list of flag values
|
3099 |
|
|
|
3100 |
|
|
_option flag list_:
|
3101 |
|
|
OPTION[0] Allowed standard; can give run-time errors if
|
3102 |
|
|
e.g. an input-output edit descriptor is
|
3103 |
|
|
invalid in a given standard. Possible values
|
3104 |
|
|
are (bitwise or-ed) `GFC_STD_F77' (1),
|
3105 |
|
|
`GFC_STD_F95_OBS' (2), `GFC_STD_F95_DEL' (4),
|
3106 |
|
|
`GFC_STD_F95' (8), `GFC_STD_F2003' (16),
|
3107 |
|
|
`GFC_STD_GNU' (32), `GFC_STD_LEGACY' (64), and
|
3108 |
|
|
`GFC_STD_F2008' (128). Default:
|
3109 |
|
|
`GFC_STD_F95_OBS | GFC_STD_F95_DEL |
|
3110 |
|
|
GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 |
|
3111 |
|
|
GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY'.
|
3112 |
|
|
OPTION[1] Standard-warning flag; prints a warning to
|
3113 |
|
|
standard error. Default: `GFC_STD_F95_DEL |
|
3114 |
|
|
GFC_STD_LEGACY'.
|
3115 |
|
|
OPTION[2] If non zero, enable pedantic checking.
|
3116 |
|
|
Default: off.
|
3117 |
|
|
OPTION[3] If non zero, enable core dumps on run-time
|
3118 |
|
|
errors. Default: off.
|
3119 |
|
|
OPTION[4] If non zero, enable backtracing on run-time
|
3120 |
|
|
errors. Default: off. Note: Installs a signal
|
3121 |
|
|
handler and requires command-line
|
3122 |
|
|
initialization using `_gfortran_set_args'.
|
3123 |
|
|
OPTION[5] If non zero, supports signed zeros. Default:
|
3124 |
|
|
enabled.
|
3125 |
|
|
OPTION[6] Enables run-time checking. Possible values are
|
3126 |
|
|
(bitwise or-ed): GFC_RTCHECK_BOUNDS (1),
|
3127 |
|
|
GFC_RTCHECK_ARRAY_TEMPS (2),
|
3128 |
|
|
GFC_RTCHECK_RECURSION (4), GFC_RTCHECK_DO
|
3129 |
|
|
(16), GFC_RTCHECK_POINTER (32). Default:
|
3130 |
|
|
disabled.
|
3131 |
|
|
OPTION[7] If non zero, range checking is enabled.
|
3132 |
|
|
Default: enabled. See -frange-check (*note
|
3133 |
|
|
Code Gen Options::).
|
3134 |
|
|
|
3135 |
|
|
_Example_:
|
3136 |
|
|
/* Use gfortran 4.5 default options. */
|
3137 |
|
|
static int options[] = {68, 255, 0, 0, 0, 1, 0, 1};
|
3138 |
|
|
_gfortran_set_options (8, &options);
|
3139 |
|
|
|
3140 |
|
|
|
3141 |
|
|
File: gfortran.info, Node: _gfortran_set_convert, Next: _gfortran_set_record_marker, Prev: _gfortran_set_options, Up: Non-Fortran Main Program
|
3142 |
|
|
|
3143 |
|
|
7.3.3 `_gfortran_set_convert' -- Set endian conversion
|
3144 |
|
|
------------------------------------------------------
|
3145 |
|
|
|
3146 |
|
|
_Description_:
|
3147 |
|
|
`_gfortran_set_convert' set the representation of data for
|
3148 |
|
|
unformatted files.
|
3149 |
|
|
|
3150 |
|
|
_Syntax_:
|
3151 |
|
|
`void _gfortran_set_convert (int conv)'
|
3152 |
|
|
|
3153 |
|
|
_Arguments_:
|
3154 |
|
|
CONV Endian conversion, possible values:
|
3155 |
|
|
GFC_CONVERT_NATIVE (0, default),
|
3156 |
|
|
GFC_CONVERT_SWAP (1), GFC_CONVERT_BIG (2),
|
3157 |
|
|
GFC_CONVERT_LITTLE (3).
|
3158 |
|
|
|
3159 |
|
|
_Example_:
|
3160 |
|
|
int main (int argc, char *argv[])
|
3161 |
|
|
{
|
3162 |
|
|
/* Initialize libgfortran. */
|
3163 |
|
|
_gfortran_set_args (argc, argv);
|
3164 |
|
|
_gfortran_set_convert (1);
|
3165 |
|
|
return 0;
|
3166 |
|
|
}
|
3167 |
|
|
|
3168 |
|
|
|
3169 |
|
|
File: gfortran.info, Node: _gfortran_set_record_marker, Next: _gfortran_set_max_subrecord_length, Prev: _gfortran_set_convert, Up: Non-Fortran Main Program
|
3170 |
|
|
|
3171 |
|
|
7.3.4 `_gfortran_set_record_marker' -- Set length of record markers
|
3172 |
|
|
-------------------------------------------------------------------
|
3173 |
|
|
|
3174 |
|
|
_Description_:
|
3175 |
|
|
`_gfortran_set_record_marker' sets the length of record markers
|
3176 |
|
|
for unformatted files.
|
3177 |
|
|
|
3178 |
|
|
_Syntax_:
|
3179 |
|
|
`void _gfortran_set_record_marker (int val)'
|
3180 |
|
|
|
3181 |
|
|
_Arguments_:
|
3182 |
|
|
VAL Length of the record marker; valid values are
|
3183 |
|
|
4 and 8. Default is 4.
|
3184 |
|
|
|
3185 |
|
|
_Example_:
|
3186 |
|
|
int main (int argc, char *argv[])
|
3187 |
|
|
{
|
3188 |
|
|
/* Initialize libgfortran. */
|
3189 |
|
|
_gfortran_set_args (argc, argv);
|
3190 |
|
|
_gfortran_set_record_marker (8);
|
3191 |
|
|
return 0;
|
3192 |
|
|
}
|
3193 |
|
|
|
3194 |
|
|
|
3195 |
|
|
File: gfortran.info, Node: _gfortran_set_fpe, Prev: _gfortran_set_max_subrecord_length, Up: Non-Fortran Main Program
|
3196 |
|
|
|
3197 |
|
|
7.3.5 `_gfortran_set_fpe' -- Set when a Floating Point Exception should be raised
|
3198 |
|
|
---------------------------------------------------------------------------------
|
3199 |
|
|
|
3200 |
|
|
_Description_:
|
3201 |
|
|
`_gfortran_set_fpe' sets the IEEE exceptions for which a Floating
|
3202 |
|
|
Point Exception (FPE) should be raised. On most systems, this will
|
3203 |
|
|
result in a SIGFPE signal being sent and the program being
|
3204 |
|
|
interrupted.
|
3205 |
|
|
|
3206 |
|
|
_Syntax_:
|
3207 |
|
|
`void _gfortran_set_fpe (int val)'
|
3208 |
|
|
|
3209 |
|
|
_Arguments_:
|
3210 |
|
|
OPTION[0] IEEE exceptions. Possible values are (bitwise
|
3211 |
|
|
or-ed) zero (0, default) no trapping,
|
3212 |
|
|
`GFC_FPE_INVALID' (1), `GFC_FPE_DENORMAL' (2),
|
3213 |
|
|
`GFC_FPE_ZERO' (4), `GFC_FPE_OVERFLOW' (8),
|
3214 |
|
|
`GFC_FPE_UNDERFLOW' (16), and
|
3215 |
|
|
`GFC_FPE_PRECISION' (32).
|
3216 |
|
|
|
3217 |
|
|
_Example_:
|
3218 |
|
|
int main (int argc, char *argv[])
|
3219 |
|
|
{
|
3220 |
|
|
/* Initialize libgfortran. */
|
3221 |
|
|
_gfortran_set_args (argc, argv);
|
3222 |
|
|
/* FPE for invalid operations such as SQRT(-1.0). */
|
3223 |
|
|
_gfortran_set_fpe (1);
|
3224 |
|
|
return 0;
|
3225 |
|
|
}
|
3226 |
|
|
|
3227 |
|
|
|
3228 |
|
|
File: gfortran.info, Node: _gfortran_set_max_subrecord_length, Next: _gfortran_set_fpe, Prev: _gfortran_set_record_marker, Up: Non-Fortran Main Program
|
3229 |
|
|
|
3230 |
|
|
7.3.6 `_gfortran_set_max_subrecord_length' -- Set subrecord length
|
3231 |
|
|
------------------------------------------------------------------
|
3232 |
|
|
|
3233 |
|
|
_Description_:
|
3234 |
|
|
`_gfortran_set_max_subrecord_length' set the maximum length for a
|
3235 |
|
|
subrecord. This option only makes sense for testing and debugging
|
3236 |
|
|
of unformatted I/O.
|
3237 |
|
|
|
3238 |
|
|
_Syntax_:
|
3239 |
|
|
`void _gfortran_set_max_subrecord_length (int val)'
|
3240 |
|
|
|
3241 |
|
|
_Arguments_:
|
3242 |
|
|
VAL the maximum length for a subrecord; the
|
3243 |
|
|
maximum permitted value is 2147483639, which
|
3244 |
|
|
is also the default.
|
3245 |
|
|
|
3246 |
|
|
_Example_:
|
3247 |
|
|
int main (int argc, char *argv[])
|
3248 |
|
|
{
|
3249 |
|
|
/* Initialize libgfortran. */
|
3250 |
|
|
_gfortran_set_args (argc, argv);
|
3251 |
|
|
_gfortran_set_max_subrecord_length (8);
|
3252 |
|
|
return 0;
|
3253 |
|
|
}
|
3254 |
|
|
|
3255 |
|
|
|
3256 |
|
|
File: gfortran.info, Node: Intrinsic Procedures, Next: Intrinsic Modules, Prev: Extensions, Up: Top
|
3257 |
|
|
|
3258 |
|
|
8 Intrinsic Procedures
|
3259 |
|
|
**********************
|
3260 |
|
|
|
3261 |
|
|
* Menu:
|
3262 |
|
|
|
3263 |
|
|
* Introduction: Introduction to Intrinsics
|
3264 |
|
|
* `ABORT': ABORT, Abort the program
|
3265 |
|
|
* `ABS': ABS, Absolute value
|
3266 |
|
|
* `ACCESS': ACCESS, Checks file access modes
|
3267 |
|
|
* `ACHAR': ACHAR, Character in ASCII collating sequence
|
3268 |
|
|
* `ACOS': ACOS, Arccosine function
|
3269 |
|
|
* `ACOSH': ACOSH, Hyperbolic arccosine function
|
3270 |
|
|
* `ADJUSTL': ADJUSTL, Left adjust a string
|
3271 |
|
|
* `ADJUSTR': ADJUSTR, Right adjust a string
|
3272 |
|
|
* `AIMAG': AIMAG, Imaginary part of complex number
|
3273 |
|
|
* `AINT': AINT, Truncate to a whole number
|
3274 |
|
|
* `ALARM': ALARM, Set an alarm clock
|
3275 |
|
|
* `ALL': ALL, Determine if all values are true
|
3276 |
|
|
* `ALLOCATED': ALLOCATED, Status of allocatable entity
|
3277 |
|
|
* `AND': AND, Bitwise logical AND
|
3278 |
|
|
* `ANINT': ANINT, Nearest whole number
|
3279 |
|
|
* `ANY': ANY, Determine if any values are true
|
3280 |
|
|
* `ASIN': ASIN, Arcsine function
|
3281 |
|
|
* `ASINH': ASINH, Hyperbolic arcsine function
|
3282 |
|
|
* `ASSOCIATED': ASSOCIATED, Status of a pointer or pointer/target pair
|
3283 |
|
|
* `ATAN': ATAN, Arctangent function
|
3284 |
|
|
* `ATAN2': ATAN2, Arctangent function
|
3285 |
|
|
* `ATANH': ATANH, Hyperbolic arctangent function
|
3286 |
|
|
* `BESSEL_J0': BESSEL_J0, Bessel function of the first kind of order 0
|
3287 |
|
|
* `BESSEL_J1': BESSEL_J1, Bessel function of the first kind of order 1
|
3288 |
|
|
* `BESSEL_JN': BESSEL_JN, Bessel function of the first kind
|
3289 |
|
|
* `BESSEL_Y0': BESSEL_Y0, Bessel function of the second kind of order 0
|
3290 |
|
|
* `BESSEL_Y1': BESSEL_Y1, Bessel function of the second kind of order 1
|
3291 |
|
|
* `BESSEL_YN': BESSEL_YN, Bessel function of the second kind
|
3292 |
|
|
* `BIT_SIZE': BIT_SIZE, Bit size inquiry function
|
3293 |
|
|
* `BTEST': BTEST, Bit test function
|
3294 |
|
|
* `C_ASSOCIATED': C_ASSOCIATED, Status of a C pointer
|
3295 |
|
|
* `C_F_POINTER': C_F_POINTER, Convert C into Fortran pointer
|
3296 |
|
|
* `C_F_PROCPOINTER': C_F_PROCPOINTER, Convert C into Fortran procedure pointer
|
3297 |
|
|
* `C_FUNLOC': C_FUNLOC, Obtain the C address of a procedure
|
3298 |
|
|
* `C_LOC': C_LOC, Obtain the C address of an object
|
3299 |
|
|
* `C_SIZEOF': C_SIZEOF, Size in bytes of an expression
|
3300 |
|
|
* `CEILING': CEILING, Integer ceiling function
|
3301 |
|
|
* `CHAR': CHAR, Integer-to-character conversion function
|
3302 |
|
|
* `CHDIR': CHDIR, Change working directory
|
3303 |
|
|
* `CHMOD': CHMOD, Change access permissions of files
|
3304 |
|
|
* `CMPLX': CMPLX, Complex conversion function
|
3305 |
|
|
* `COMMAND_ARGUMENT_COUNT': COMMAND_ARGUMENT_COUNT, Get number of command line arguments
|
3306 |
|
|
* `COMPLEX': COMPLEX, Complex conversion function
|
3307 |
|
|
* `CONJG': CONJG, Complex conjugate function
|
3308 |
|
|
* `COS': COS, Cosine function
|
3309 |
|
|
* `COSH': COSH, Hyperbolic cosine function
|
3310 |
|
|
* `COUNT': COUNT, Count occurrences of TRUE in an array
|
3311 |
|
|
* `CPU_TIME': CPU_TIME, CPU time subroutine
|
3312 |
|
|
* `CSHIFT': CSHIFT, Circular shift elements of an array
|
3313 |
|
|
* `CTIME': CTIME, Subroutine (or function) to convert a time into a string
|
3314 |
|
|
* `DATE_AND_TIME': DATE_AND_TIME, Date and time subroutine
|
3315 |
|
|
* `DBLE': DBLE, Double precision conversion function
|
3316 |
|
|
* `DCMPLX': DCMPLX, Double complex conversion function
|
3317 |
|
|
* `DFLOAT': DFLOAT, Double precision conversion function
|
3318 |
|
|
* `DIGITS': DIGITS, Significant digits function
|
3319 |
|
|
* `DIM': DIM, Positive difference
|
3320 |
|
|
* `DOT_PRODUCT': DOT_PRODUCT, Dot product function
|
3321 |
|
|
* `DPROD': DPROD, Double product function
|
3322 |
|
|
* `DREAL': DREAL, Double real part function
|
3323 |
|
|
* `DTIME': DTIME, Execution time subroutine (or function)
|
3324 |
|
|
* `EOSHIFT': EOSHIFT, End-off shift elements of an array
|
3325 |
|
|
* `EPSILON': EPSILON, Epsilon function
|
3326 |
|
|
* `ERF': ERF, Error function
|
3327 |
|
|
* `ERFC': ERFC, Complementary error function
|
3328 |
|
|
* `ERFC_SCALED': ERFC_SCALED, Exponentially-scaled complementary error function
|
3329 |
|
|
* `ETIME': ETIME, Execution time subroutine (or function)
|
3330 |
|
|
* `EXIT': EXIT, Exit the program with status.
|
3331 |
|
|
* `EXP': EXP, Exponential function
|
3332 |
|
|
* `EXPONENT': EXPONENT, Exponent function
|
3333 |
|
|
* `FDATE': FDATE, Subroutine (or function) to get the current time as a string
|
3334 |
|
|
* `FGET': FGET, Read a single character in stream mode from stdin
|
3335 |
|
|
* `FGETC': FGETC, Read a single character in stream mode
|
3336 |
|
|
* `FLOAT': FLOAT, Convert integer to default real
|
3337 |
|
|
* `FLOOR': FLOOR, Integer floor function
|
3338 |
|
|
* `FLUSH': FLUSH, Flush I/O unit(s)
|
3339 |
|
|
* `FNUM': FNUM, File number function
|
3340 |
|
|
* `FPUT': FPUT, Write a single character in stream mode to stdout
|
3341 |
|
|
* `FPUTC': FPUTC, Write a single character in stream mode
|
3342 |
|
|
* `FRACTION': FRACTION, Fractional part of the model representation
|
3343 |
|
|
* `FREE': FREE, Memory de-allocation subroutine
|
3344 |
|
|
* `FSEEK': FSEEK, Low level file positioning subroutine
|
3345 |
|
|
* `FSTAT': FSTAT, Get file status
|
3346 |
|
|
* `FTELL': FTELL, Current stream position
|
3347 |
|
|
* `GAMMA': GAMMA, Gamma function
|
3348 |
|
|
* `GERROR': GERROR, Get last system error message
|
3349 |
|
|
* `GETARG': GETARG, Get command line arguments
|
3350 |
|
|
* `GET_COMMAND': GET_COMMAND, Get the entire command line
|
3351 |
|
|
* `GET_COMMAND_ARGUMENT': GET_COMMAND_ARGUMENT, Get command line arguments
|
3352 |
|
|
* `GETCWD': GETCWD, Get current working directory
|
3353 |
|
|
* `GETENV': GETENV, Get an environmental variable
|
3354 |
|
|
* `GET_ENVIRONMENT_VARIABLE': GET_ENVIRONMENT_VARIABLE, Get an environmental variable
|
3355 |
|
|
* `GETGID': GETGID, Group ID function
|
3356 |
|
|
* `GETLOG': GETLOG, Get login name
|
3357 |
|
|
* `GETPID': GETPID, Process ID function
|
3358 |
|
|
* `GETUID': GETUID, User ID function
|
3359 |
|
|
* `GMTIME': GMTIME, Convert time to GMT info
|
3360 |
|
|
* `HOSTNM': HOSTNM, Get system host name
|
3361 |
|
|
* `HUGE': HUGE, Largest number of a kind
|
3362 |
|
|
* `HYPOT': HYPOT, Euclidian distance function
|
3363 |
|
|
* `IACHAR': IACHAR, Code in ASCII collating sequence
|
3364 |
|
|
* `IAND': IAND, Bitwise logical and
|
3365 |
|
|
* `IARGC': IARGC, Get the number of command line arguments
|
3366 |
|
|
* `IBCLR': IBCLR, Clear bit
|
3367 |
|
|
* `IBITS': IBITS, Bit extraction
|
3368 |
|
|
* `IBSET': IBSET, Set bit
|
3369 |
|
|
* `ICHAR': ICHAR, Character-to-integer conversion function
|
3370 |
|
|
* `IDATE': IDATE, Current local time (day/month/year)
|
3371 |
|
|
* `IEOR': IEOR, Bitwise logical exclusive or
|
3372 |
|
|
* `IERRNO': IERRNO, Function to get the last system error number
|
3373 |
|
|
* `INDEX': INDEX intrinsic, Position of a substring within a string
|
3374 |
|
|
* `INT': INT, Convert to integer type
|
3375 |
|
|
* `INT2': INT2, Convert to 16-bit integer type
|
3376 |
|
|
* `INT8': INT8, Convert to 64-bit integer type
|
3377 |
|
|
* `IOR': IOR, Bitwise logical or
|
3378 |
|
|
* `IRAND': IRAND, Integer pseudo-random number
|
3379 |
|
|
* `IS_IOSTAT_END': IS_IOSTAT_END, Test for end-of-file value
|
3380 |
|
|
* `IS_IOSTAT_EOR': IS_IOSTAT_EOR, Test for end-of-record value
|
3381 |
|
|
* `ISATTY': ISATTY, Whether a unit is a terminal device
|
3382 |
|
|
* `ISHFT': ISHFT, Shift bits
|
3383 |
|
|
* `ISHFTC': ISHFTC, Shift bits circularly
|
3384 |
|
|
* `ISNAN': ISNAN, Tests for a NaN
|
3385 |
|
|
* `ITIME': ITIME, Current local time (hour/minutes/seconds)
|
3386 |
|
|
* `KILL': KILL, Send a signal to a process
|
3387 |
|
|
* `KIND': KIND, Kind of an entity
|
3388 |
|
|
* `LBOUND': LBOUND, Lower dimension bounds of an array
|
3389 |
|
|
* `LEADZ': LEADZ, Number of leading zero bits of an integer
|
3390 |
|
|
* `LEN': LEN, Length of a character entity
|
3391 |
|
|
* `LEN_TRIM': LEN_TRIM, Length of a character entity without trailing blank characters
|
3392 |
|
|
* `LGE': LGE, Lexical greater than or equal
|
3393 |
|
|
* `LGT': LGT, Lexical greater than
|
3394 |
|
|
* `LINK': LINK, Create a hard link
|
3395 |
|
|
* `LLE': LLE, Lexical less than or equal
|
3396 |
|
|
* `LLT': LLT, Lexical less than
|
3397 |
|
|
* `LNBLNK': LNBLNK, Index of the last non-blank character in a string
|
3398 |
|
|
* `LOC': LOC, Returns the address of a variable
|
3399 |
|
|
* `LOG': LOG, Logarithm function
|
3400 |
|
|
* `LOG10': LOG10, Base 10 logarithm function
|
3401 |
|
|
* `LOG_GAMMA': LOG_GAMMA, Logarithm of the Gamma function
|
3402 |
|
|
* `LOGICAL': LOGICAL, Convert to logical type
|
3403 |
|
|
* `LONG': LONG, Convert to integer type
|
3404 |
|
|
* `LSHIFT': LSHIFT, Left shift bits
|
3405 |
|
|
* `LSTAT': LSTAT, Get file status
|
3406 |
|
|
* `LTIME': LTIME, Convert time to local time info
|
3407 |
|
|
* `MALLOC': MALLOC, Dynamic memory allocation function
|
3408 |
|
|
* `MATMUL': MATMUL, matrix multiplication
|
3409 |
|
|
* `MAX': MAX, Maximum value of an argument list
|
3410 |
|
|
* `MAXEXPONENT': MAXEXPONENT, Maximum exponent of a real kind
|
3411 |
|
|
* `MAXLOC': MAXLOC, Location of the maximum value within an array
|
3412 |
|
|
* `MAXVAL': MAXVAL, Maximum value of an array
|
3413 |
|
|
* `MCLOCK': MCLOCK, Time function
|
3414 |
|
|
* `MCLOCK8': MCLOCK8, Time function (64-bit)
|
3415 |
|
|
* `MERGE': MERGE, Merge arrays
|
3416 |
|
|
* `MIN': MIN, Minimum value of an argument list
|
3417 |
|
|
* `MINEXPONENT': MINEXPONENT, Minimum exponent of a real kind
|
3418 |
|
|
* `MINLOC': MINLOC, Location of the minimum value within an array
|
3419 |
|
|
* `MINVAL': MINVAL, Minimum value of an array
|
3420 |
|
|
* `MOD': MOD, Remainder function
|
3421 |
|
|
* `MODULO': MODULO, Modulo function
|
3422 |
|
|
* `MOVE_ALLOC': MOVE_ALLOC, Move allocation from one object to another
|
3423 |
|
|
* `MVBITS': MVBITS, Move bits from one integer to another
|
3424 |
|
|
* `NEAREST': NEAREST, Nearest representable number
|
3425 |
|
|
* `NEW_LINE': NEW_LINE, New line character
|
3426 |
|
|
* `NINT': NINT, Nearest whole number
|
3427 |
|
|
* `NOT': NOT, Logical negation
|
3428 |
|
|
* `NULL': NULL, Function that returns an disassociated pointer
|
3429 |
|
|
* `OR': OR, Bitwise logical OR
|
3430 |
|
|
* `PACK': PACK, Pack an array into an array of rank one
|
3431 |
|
|
* `PERROR': PERROR, Print system error message
|
3432 |
|
|
* `PRECISION': PRECISION, Decimal precision of a real kind
|
3433 |
|
|
* `PRESENT': PRESENT, Determine whether an optional dummy argument is specified
|
3434 |
|
|
* `PRODUCT': PRODUCT, Product of array elements
|
3435 |
|
|
* `RADIX': RADIX, Base of a data model
|
3436 |
|
|
* `RANDOM_NUMBER': RANDOM_NUMBER, Pseudo-random number
|
3437 |
|
|
* `RANDOM_SEED': RANDOM_SEED, Initialize a pseudo-random number sequence
|
3438 |
|
|
* `RAND': RAND, Real pseudo-random number
|
3439 |
|
|
* `RANGE': RANGE, Decimal exponent range
|
3440 |
|
|
* `RAN': RAN, Real pseudo-random number
|
3441 |
|
|
* `REAL': REAL, Convert to real type
|
3442 |
|
|
* `RENAME': RENAME, Rename a file
|
3443 |
|
|
* `REPEAT': REPEAT, Repeated string concatenation
|
3444 |
|
|
* `RESHAPE': RESHAPE, Function to reshape an array
|
3445 |
|
|
* `RRSPACING': RRSPACING, Reciprocal of the relative spacing
|
3446 |
|
|
* `RSHIFT': RSHIFT, Right shift bits
|
3447 |
|
|
* `SCALE': SCALE, Scale a real value
|
3448 |
|
|
* `SCAN': SCAN, Scan a string for the presence of a set of characters
|
3449 |
|
|
* `SECNDS': SECNDS, Time function
|
3450 |
|
|
* `SECOND': SECOND, CPU time function
|
3451 |
|
|
* `SELECTED_CHAR_KIND': SELECTED_CHAR_KIND, Choose character kind
|
3452 |
|
|
* `SELECTED_INT_KIND': SELECTED_INT_KIND, Choose integer kind
|
3453 |
|
|
* `SELECTED_REAL_KIND': SELECTED_REAL_KIND, Choose real kind
|
3454 |
|
|
* `SET_EXPONENT': SET_EXPONENT, Set the exponent of the model
|
3455 |
|
|
* `SHAPE': SHAPE, Determine the shape of an array
|
3456 |
|
|
* `SIGN': SIGN, Sign copying function
|
3457 |
|
|
* `SIGNAL': SIGNAL, Signal handling subroutine (or function)
|
3458 |
|
|
* `SIN': SIN, Sine function
|
3459 |
|
|
* `SINH': SINH, Hyperbolic sine function
|
3460 |
|
|
* `SIZE': SIZE, Function to determine the size of an array
|
3461 |
|
|
* `SIZEOF': SIZEOF, Determine the size in bytes of an expression
|
3462 |
|
|
* `SLEEP': SLEEP, Sleep for the specified number of seconds
|
3463 |
|
|
* `SNGL': SNGL, Convert double precision real to default real
|
3464 |
|
|
* `SPACING': SPACING, Smallest distance between two numbers of a given type
|
3465 |
|
|
* `SPREAD': SPREAD, Add a dimension to an array
|
3466 |
|
|
* `SQRT': SQRT, Square-root function
|
3467 |
|
|
* `SRAND': SRAND, Reinitialize the random number generator
|
3468 |
|
|
* `STAT': STAT, Get file status
|
3469 |
|
|
* `SUM': SUM, Sum of array elements
|
3470 |
|
|
* `SYMLNK': SYMLNK, Create a symbolic link
|
3471 |
|
|
* `SYSTEM': SYSTEM, Execute a shell command
|
3472 |
|
|
* `SYSTEM_CLOCK': SYSTEM_CLOCK, Time function
|
3473 |
|
|
* `TAN': TAN, Tangent function
|
3474 |
|
|
* `TANH': TANH, Hyperbolic tangent function
|
3475 |
|
|
* `TIME': TIME, Time function
|
3476 |
|
|
* `TIME8': TIME8, Time function (64-bit)
|
3477 |
|
|
* `TINY': TINY, Smallest positive number of a real kind
|
3478 |
|
|
* `TRAILZ': TRAILZ, Number of trailing zero bits of an integer
|
3479 |
|
|
* `TRANSFER': TRANSFER, Transfer bit patterns
|
3480 |
|
|
* `TRANSPOSE': TRANSPOSE, Transpose an array of rank two
|
3481 |
|
|
* `TRIM': TRIM, Remove trailing blank characters of a string
|
3482 |
|
|
* `TTYNAM': TTYNAM, Get the name of a terminal device.
|
3483 |
|
|
* `UBOUND': UBOUND, Upper dimension bounds of an array
|
3484 |
|
|
* `UMASK': UMASK, Set the file creation mask
|
3485 |
|
|
* `UNLINK': UNLINK, Remove a file from the file system
|
3486 |
|
|
* `UNPACK': UNPACK, Unpack an array of rank one into an array
|
3487 |
|
|
* `VERIFY': VERIFY, Scan a string for the absence of a set of characters
|
3488 |
|
|
* `XOR': XOR, Bitwise logical exclusive or
|
3489 |
|
|
|
3490 |
|
|
|
3491 |
|
|
File: gfortran.info, Node: Introduction to Intrinsics, Next: ABORT, Up: Intrinsic Procedures
|
3492 |
|
|
|
3493 |
|
|
8.1 Introduction to intrinsic procedures
|
3494 |
|
|
========================================
|
3495 |
|
|
|
3496 |
|
|
The intrinsic procedures provided by GNU Fortran include all of the
|
3497 |
|
|
intrinsic procedures required by the Fortran 95 standard, a set of
|
3498 |
|
|
intrinsic procedures for backwards compatibility with G77, and a
|
3499 |
|
|
selection of intrinsic procedures from the Fortran 2003 and Fortran 2008
|
3500 |
|
|
standards. Any conflict between a description here and a description in
|
3501 |
|
|
either the Fortran 95 standard, the Fortran 2003 standard or the Fortran
|
3502 |
|
|
2008 standard is unintentional, and the standard(s) should be considered
|
3503 |
|
|
authoritative.
|
3504 |
|
|
|
3505 |
|
|
The enumeration of the `KIND' type parameter is processor defined in
|
3506 |
|
|
the Fortran 95 standard. GNU Fortran defines the default integer type
|
3507 |
|
|
and default real type by `INTEGER(KIND=4)' and `REAL(KIND=4)',
|
3508 |
|
|
respectively. The standard mandates that both data types shall have
|
3509 |
|
|
another kind, which have more precision. On typical target
|
3510 |
|
|
architectures supported by `gfortran', this kind type parameter is
|
3511 |
|
|
`KIND=8'. Hence, `REAL(KIND=8)' and `DOUBLE PRECISION' are equivalent.
|
3512 |
|
|
In the description of generic intrinsic procedures, the kind type
|
3513 |
|
|
parameter will be specified by `KIND=*', and in the description of
|
3514 |
|
|
specific names for an intrinsic procedure the kind type parameter will
|
3515 |
|
|
be explicitly given (e.g., `REAL(KIND=4)' or `REAL(KIND=8)'). Finally,
|
3516 |
|
|
for brevity the optional `KIND=' syntax will be omitted.
|
3517 |
|
|
|
3518 |
|
|
Many of the intrinsic procedures take one or more optional arguments.
|
3519 |
|
|
This document follows the convention used in the Fortran 95 standard,
|
3520 |
|
|
and denotes such arguments by square brackets.
|
3521 |
|
|
|
3522 |
|
|
GNU Fortran offers the `-std=f95' and `-std=gnu' options, which can
|
3523 |
|
|
be used to restrict the set of intrinsic procedures to a given
|
3524 |
|
|
standard. By default, `gfortran' sets the `-std=gnu' option, and so
|
3525 |
|
|
all intrinsic procedures described here are accepted. There is one
|
3526 |
|
|
caveat. For a select group of intrinsic procedures, `g77' implemented
|
3527 |
|
|
both a function and a subroutine. Both classes have been implemented
|
3528 |
|
|
in `gfortran' for backwards compatibility with `g77'. It is noted here
|
3529 |
|
|
that these functions and subroutines cannot be intermixed in a given
|
3530 |
|
|
subprogram. In the descriptions that follow, the applicable standard
|
3531 |
|
|
for each intrinsic procedure is noted.
|
3532 |
|
|
|
3533 |
|
|
|
3534 |
|
|
File: gfortran.info, Node: ABORT, Next: ABS, Prev: Introduction to Intrinsics, Up: Intrinsic Procedures
|
3535 |
|
|
|
3536 |
|
|
8.2 `ABORT' -- Abort the program
|
3537 |
|
|
================================
|
3538 |
|
|
|
3539 |
|
|
_Description_:
|
3540 |
|
|
`ABORT' causes immediate termination of the program. On operating
|
3541 |
|
|
systems that support a core dump, `ABORT' will produce a core dump
|
3542 |
|
|
even if the option `-fno-dump-core' is in effect, which is
|
3543 |
|
|
suitable for debugging purposes.
|
3544 |
|
|
|
3545 |
|
|
_Standard_:
|
3546 |
|
|
GNU extension
|
3547 |
|
|
|
3548 |
|
|
_Class_:
|
3549 |
|
|
Subroutine
|
3550 |
|
|
|
3551 |
|
|
_Syntax_:
|
3552 |
|
|
`CALL ABORT'
|
3553 |
|
|
|
3554 |
|
|
_Return value_:
|
3555 |
|
|
Does not return.
|
3556 |
|
|
|
3557 |
|
|
_Example_:
|
3558 |
|
|
program test_abort
|
3559 |
|
|
integer :: i = 1, j = 2
|
3560 |
|
|
if (i /= j) call abort
|
3561 |
|
|
end program test_abort
|
3562 |
|
|
|
3563 |
|
|
_See also_:
|
3564 |
|
|
*note EXIT::, *note KILL::
|
3565 |
|
|
|
3566 |
|
|
|
3567 |
|
|
|
3568 |
|
|
File: gfortran.info, Node: ABS, Next: ACCESS, Prev: ABORT, Up: Intrinsic Procedures
|
3569 |
|
|
|
3570 |
|
|
8.3 `ABS' -- Absolute value
|
3571 |
|
|
===========================
|
3572 |
|
|
|
3573 |
|
|
_Description_:
|
3574 |
|
|
`ABS(A)' computes the absolute value of `A'.
|
3575 |
|
|
|
3576 |
|
|
_Standard_:
|
3577 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
3578 |
|
|
|
3579 |
|
|
_Class_:
|
3580 |
|
|
Elemental function
|
3581 |
|
|
|
3582 |
|
|
_Syntax_:
|
3583 |
|
|
`RESULT = ABS(A)'
|
3584 |
|
|
|
3585 |
|
|
_Arguments_:
|
3586 |
|
|
A The type of the argument shall be an `INTEGER',
|
3587 |
|
|
`REAL', or `COMPLEX'.
|
3588 |
|
|
|
3589 |
|
|
_Return value_:
|
3590 |
|
|
The return value is of the same type and kind as the argument
|
3591 |
|
|
except the return value is `REAL' for a `COMPLEX' argument.
|
3592 |
|
|
|
3593 |
|
|
_Example_:
|
3594 |
|
|
program test_abs
|
3595 |
|
|
integer :: i = -1
|
3596 |
|
|
real :: x = -1.e0
|
3597 |
|
|
complex :: z = (-1.e0,0.e0)
|
3598 |
|
|
i = abs(i)
|
3599 |
|
|
x = abs(x)
|
3600 |
|
|
x = abs(z)
|
3601 |
|
|
end program test_abs
|
3602 |
|
|
|
3603 |
|
|
_Specific names_:
|
3604 |
|
|
Name Argument Return type Standard
|
3605 |
|
|
`CABS(A)' `COMPLEX(4) `REAL(4)' Fortran 77 and
|
3606 |
|
|
Z' later
|
3607 |
|
|
`DABS(A)' `REAL(8) `REAL(8)' Fortran 77 and
|
3608 |
|
|
X' later
|
3609 |
|
|
`IABS(A)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
|
3610 |
|
|
I' later
|
3611 |
|
|
`ZABS(A)' `COMPLEX(8) `COMPLEX(8)' GNU extension
|
3612 |
|
|
Z'
|
3613 |
|
|
`CDABS(A)' `COMPLEX(8) `COMPLEX(8)' GNU extension
|
3614 |
|
|
Z'
|
3615 |
|
|
|
3616 |
|
|
|
3617 |
|
|
File: gfortran.info, Node: ACCESS, Next: ACHAR, Prev: ABS, Up: Intrinsic Procedures
|
3618 |
|
|
|
3619 |
|
|
8.4 `ACCESS' -- Checks file access modes
|
3620 |
|
|
========================================
|
3621 |
|
|
|
3622 |
|
|
_Description_:
|
3623 |
|
|
`ACCESS(NAME, MODE)' checks whether the file NAME exists, is
|
3624 |
|
|
readable, writable or executable. Except for the executable check,
|
3625 |
|
|
`ACCESS' can be replaced by Fortran 95's `INQUIRE'.
|
3626 |
|
|
|
3627 |
|
|
_Standard_:
|
3628 |
|
|
GNU extension
|
3629 |
|
|
|
3630 |
|
|
_Class_:
|
3631 |
|
|
Inquiry function
|
3632 |
|
|
|
3633 |
|
|
_Syntax_:
|
3634 |
|
|
`RESULT = ACCESS(NAME, MODE)'
|
3635 |
|
|
|
3636 |
|
|
_Arguments_:
|
3637 |
|
|
NAME Scalar `CHARACTER' of default kind with the
|
3638 |
|
|
file name. Tailing blank are ignored unless
|
3639 |
|
|
the character `achar(0)' is present, then all
|
3640 |
|
|
characters up to and excluding `achar(0)' are
|
3641 |
|
|
used as file name.
|
3642 |
|
|
MODE Scalar `CHARACTER' of default kind with the
|
3643 |
|
|
file access mode, may be any concatenation of
|
3644 |
|
|
`"r"' (readable), `"w"' (writable) and `"x"'
|
3645 |
|
|
(executable), or `" "' to check for existence.
|
3646 |
|
|
|
3647 |
|
|
_Return value_:
|
3648 |
|
|
Returns a scalar `INTEGER', which is `0' if the file is accessible
|
3649 |
|
|
in the given mode; otherwise or if an invalid argument has been
|
3650 |
|
|
given for `MODE' the value `1' is returned.
|
3651 |
|
|
|
3652 |
|
|
_Example_:
|
3653 |
|
|
program access_test
|
3654 |
|
|
implicit none
|
3655 |
|
|
character(len=*), parameter :: file = 'test.dat'
|
3656 |
|
|
character(len=*), parameter :: file2 = 'test.dat '//achar(0)
|
3657 |
|
|
if(access(file,' ') == 0) print *, trim(file),' is exists'
|
3658 |
|
|
if(access(file,'r') == 0) print *, trim(file),' is readable'
|
3659 |
|
|
if(access(file,'w') == 0) print *, trim(file),' is writable'
|
3660 |
|
|
if(access(file,'x') == 0) print *, trim(file),' is executable'
|
3661 |
|
|
if(access(file2,'rwx') == 0) &
|
3662 |
|
|
print *, trim(file2),' is readable, writable and executable'
|
3663 |
|
|
end program access_test
|
3664 |
|
|
|
3665 |
|
|
_Specific names_:
|
3666 |
|
|
|
3667 |
|
|
_See also_:
|
3668 |
|
|
|
3669 |
|
|
|
3670 |
|
|
File: gfortran.info, Node: ACHAR, Next: ACOS, Prev: ACCESS, Up: Intrinsic Procedures
|
3671 |
|
|
|
3672 |
|
|
8.5 `ACHAR' -- Character in ASCII collating sequence
|
3673 |
|
|
====================================================
|
3674 |
|
|
|
3675 |
|
|
_Description_:
|
3676 |
|
|
`ACHAR(I)' returns the character located at position `I' in the
|
3677 |
|
|
ASCII collating sequence.
|
3678 |
|
|
|
3679 |
|
|
_Standard_:
|
3680 |
|
|
Fortran 77 and later, with KIND argument Fortran 2003 and later
|
3681 |
|
|
|
3682 |
|
|
_Class_:
|
3683 |
|
|
Elemental function
|
3684 |
|
|
|
3685 |
|
|
_Syntax_:
|
3686 |
|
|
`RESULT = ACHAR(I [, KIND])'
|
3687 |
|
|
|
3688 |
|
|
_Arguments_:
|
3689 |
|
|
I The type shall be `INTEGER'.
|
3690 |
|
|
KIND (Optional) An `INTEGER' initialization
|
3691 |
|
|
expression indicating the kind parameter of
|
3692 |
|
|
the result.
|
3693 |
|
|
|
3694 |
|
|
_Return value_:
|
3695 |
|
|
The return value is of type `CHARACTER' with a length of one. If
|
3696 |
|
|
the KIND argument is present, the return value is of the specified
|
3697 |
|
|
kind and of the default kind otherwise.
|
3698 |
|
|
|
3699 |
|
|
_Example_:
|
3700 |
|
|
program test_achar
|
3701 |
|
|
character c
|
3702 |
|
|
c = achar(32)
|
3703 |
|
|
end program test_achar
|
3704 |
|
|
|
3705 |
|
|
_Note_:
|
3706 |
|
|
See *note ICHAR:: for a discussion of converting between numerical
|
3707 |
|
|
values and formatted string representations.
|
3708 |
|
|
|
3709 |
|
|
_See also_:
|
3710 |
|
|
*note CHAR::, *note IACHAR::, *note ICHAR::
|
3711 |
|
|
|
3712 |
|
|
|
3713 |
|
|
|
3714 |
|
|
File: gfortran.info, Node: ACOS, Next: ACOSH, Prev: ACHAR, Up: Intrinsic Procedures
|
3715 |
|
|
|
3716 |
|
|
8.6 `ACOS' -- Arccosine function
|
3717 |
|
|
================================
|
3718 |
|
|
|
3719 |
|
|
_Description_:
|
3720 |
|
|
`ACOS(X)' computes the arccosine of X (inverse of `COS(X)').
|
3721 |
|
|
|
3722 |
|
|
_Standard_:
|
3723 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
3724 |
|
|
|
3725 |
|
|
_Class_:
|
3726 |
|
|
Elemental function
|
3727 |
|
|
|
3728 |
|
|
_Syntax_:
|
3729 |
|
|
`RESULT = ACOS(X)'
|
3730 |
|
|
|
3731 |
|
|
_Arguments_:
|
3732 |
|
|
X The type shall either be `REAL' with a
|
3733 |
|
|
magnitude that is less than or equal to one -
|
3734 |
|
|
or the type shall be `COMPLEX'.
|
3735 |
|
|
|
3736 |
|
|
_Return value_:
|
3737 |
|
|
The return value is of the same type and kind as X. The real part
|
3738 |
|
|
of the result is in radians and lies in the range 0 \leq \Re
|
3739 |
|
|
\acos(x) \leq \pi.
|
3740 |
|
|
|
3741 |
|
|
_Example_:
|
3742 |
|
|
program test_acos
|
3743 |
|
|
real(8) :: x = 0.866_8
|
3744 |
|
|
x = acos(x)
|
3745 |
|
|
end program test_acos
|
3746 |
|
|
|
3747 |
|
|
_Specific names_:
|
3748 |
|
|
Name Argument Return type Standard
|
3749 |
|
|
`DACOS(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
|
3750 |
|
|
later
|
3751 |
|
|
|
3752 |
|
|
_See also_:
|
3753 |
|
|
Inverse function: *note COS::
|
3754 |
|
|
|
3755 |
|
|
|
3756 |
|
|
|
3757 |
|
|
File: gfortran.info, Node: ACOSH, Next: ADJUSTL, Prev: ACOS, Up: Intrinsic Procedures
|
3758 |
|
|
|
3759 |
|
|
8.7 `ACOSH' -- Hyperbolic arccosine function
|
3760 |
|
|
============================================
|
3761 |
|
|
|
3762 |
|
|
_Description_:
|
3763 |
|
|
`ACOSH(X)' computes the hyperbolic arccosine of X (inverse of
|
3764 |
|
|
`COSH(X)').
|
3765 |
|
|
|
3766 |
|
|
_Standard_:
|
3767 |
|
|
Fortran 2008 and later
|
3768 |
|
|
|
3769 |
|
|
_Class_:
|
3770 |
|
|
Elemental function
|
3771 |
|
|
|
3772 |
|
|
_Syntax_:
|
3773 |
|
|
`RESULT = ACOSH(X)'
|
3774 |
|
|
|
3775 |
|
|
_Arguments_:
|
3776 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
3777 |
|
|
|
3778 |
|
|
_Return value_:
|
3779 |
|
|
The return value has the same type and kind as X. If X is complex,
|
3780 |
|
|
the imaginary part of the result is in radians and lies between 0
|
3781 |
|
|
\leq \Im \acosh(x) \leq \pi.
|
3782 |
|
|
|
3783 |
|
|
_Example_:
|
3784 |
|
|
PROGRAM test_acosh
|
3785 |
|
|
REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /)
|
3786 |
|
|
WRITE (*,*) ACOSH(x)
|
3787 |
|
|
END PROGRAM
|
3788 |
|
|
|
3789 |
|
|
_Specific names_:
|
3790 |
|
|
Name Argument Return type Standard
|
3791 |
|
|
`DACOSH(X)' `REAL(8) X' `REAL(8)' GNU extension
|
3792 |
|
|
|
3793 |
|
|
_See also_:
|
3794 |
|
|
Inverse function: *note COSH::
|
3795 |
|
|
|
3796 |
|
|
|
3797 |
|
|
File: gfortran.info, Node: ADJUSTL, Next: ADJUSTR, Prev: ACOSH, Up: Intrinsic Procedures
|
3798 |
|
|
|
3799 |
|
|
8.8 `ADJUSTL' -- Left adjust a string
|
3800 |
|
|
=====================================
|
3801 |
|
|
|
3802 |
|
|
_Description_:
|
3803 |
|
|
`ADJUSTL(STRING)' will left adjust a string by removing leading
|
3804 |
|
|
spaces. Spaces are inserted at the end of the string as needed.
|
3805 |
|
|
|
3806 |
|
|
_Standard_:
|
3807 |
|
|
Fortran 90 and later
|
3808 |
|
|
|
3809 |
|
|
_Class_:
|
3810 |
|
|
Elemental function
|
3811 |
|
|
|
3812 |
|
|
_Syntax_:
|
3813 |
|
|
`RESULT = ADJUSTL(STRING)'
|
3814 |
|
|
|
3815 |
|
|
_Arguments_:
|
3816 |
|
|
STRING The type shall be `CHARACTER'.
|
3817 |
|
|
|
3818 |
|
|
_Return value_:
|
3819 |
|
|
The return value is of type `CHARACTER' and of the same kind as
|
3820 |
|
|
STRING where leading spaces are removed and the same number of
|
3821 |
|
|
spaces are inserted on the end of STRING.
|
3822 |
|
|
|
3823 |
|
|
_Example_:
|
3824 |
|
|
program test_adjustl
|
3825 |
|
|
character(len=20) :: str = ' gfortran'
|
3826 |
|
|
str = adjustl(str)
|
3827 |
|
|
print *, str
|
3828 |
|
|
end program test_adjustl
|
3829 |
|
|
|
3830 |
|
|
_See also_:
|
3831 |
|
|
*note ADJUSTR::, *note TRIM::
|
3832 |
|
|
|
3833 |
|
|
|
3834 |
|
|
File: gfortran.info, Node: ADJUSTR, Next: AIMAG, Prev: ADJUSTL, Up: Intrinsic Procedures
|
3835 |
|
|
|
3836 |
|
|
8.9 `ADJUSTR' -- Right adjust a string
|
3837 |
|
|
======================================
|
3838 |
|
|
|
3839 |
|
|
_Description_:
|
3840 |
|
|
`ADJUSTR(STRING)' will right adjust a string by removing trailing
|
3841 |
|
|
spaces. Spaces are inserted at the start of the string as needed.
|
3842 |
|
|
|
3843 |
|
|
_Standard_:
|
3844 |
|
|
Fortran 95 and later
|
3845 |
|
|
|
3846 |
|
|
_Class_:
|
3847 |
|
|
Elemental function
|
3848 |
|
|
|
3849 |
|
|
_Syntax_:
|
3850 |
|
|
`RESULT = ADJUSTR(STRING)'
|
3851 |
|
|
|
3852 |
|
|
_Arguments_:
|
3853 |
|
|
STR The type shall be `CHARACTER'.
|
3854 |
|
|
|
3855 |
|
|
_Return value_:
|
3856 |
|
|
The return value is of type `CHARACTER' and of the same kind as
|
3857 |
|
|
STRING where trailing spaces are removed and the same number of
|
3858 |
|
|
spaces are inserted at the start of STRING.
|
3859 |
|
|
|
3860 |
|
|
_Example_:
|
3861 |
|
|
program test_adjustr
|
3862 |
|
|
character(len=20) :: str = 'gfortran'
|
3863 |
|
|
str = adjustr(str)
|
3864 |
|
|
print *, str
|
3865 |
|
|
end program test_adjustr
|
3866 |
|
|
|
3867 |
|
|
_See also_:
|
3868 |
|
|
*note ADJUSTL::, *note TRIM::
|
3869 |
|
|
|
3870 |
|
|
|
3871 |
|
|
File: gfortran.info, Node: AIMAG, Next: AINT, Prev: ADJUSTR, Up: Intrinsic Procedures
|
3872 |
|
|
|
3873 |
|
|
8.10 `AIMAG' -- Imaginary part of complex number
|
3874 |
|
|
================================================
|
3875 |
|
|
|
3876 |
|
|
_Description_:
|
3877 |
|
|
`AIMAG(Z)' yields the imaginary part of complex argument `Z'. The
|
3878 |
|
|
`IMAG(Z)' and `IMAGPART(Z)' intrinsic functions are provided for
|
3879 |
|
|
compatibility with `g77', and their use in new code is strongly
|
3880 |
|
|
discouraged.
|
3881 |
|
|
|
3882 |
|
|
_Standard_:
|
3883 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
3884 |
|
|
|
3885 |
|
|
_Class_:
|
3886 |
|
|
Elemental function
|
3887 |
|
|
|
3888 |
|
|
_Syntax_:
|
3889 |
|
|
`RESULT = AIMAG(Z)'
|
3890 |
|
|
|
3891 |
|
|
_Arguments_:
|
3892 |
|
|
Z The type of the argument shall be `COMPLEX'.
|
3893 |
|
|
|
3894 |
|
|
_Return value_:
|
3895 |
|
|
The return value is of type `REAL' with the kind type parameter of
|
3896 |
|
|
the argument.
|
3897 |
|
|
|
3898 |
|
|
_Example_:
|
3899 |
|
|
program test_aimag
|
3900 |
|
|
complex(4) z4
|
3901 |
|
|
complex(8) z8
|
3902 |
|
|
z4 = cmplx(1.e0_4, 0.e0_4)
|
3903 |
|
|
z8 = cmplx(0.e0_8, 1.e0_8)
|
3904 |
|
|
print *, aimag(z4), dimag(z8)
|
3905 |
|
|
end program test_aimag
|
3906 |
|
|
|
3907 |
|
|
_Specific names_:
|
3908 |
|
|
Name Argument Return type Standard
|
3909 |
|
|
`DIMAG(Z)' `COMPLEX(8) `REAL(8)' GNU extension
|
3910 |
|
|
Z'
|
3911 |
|
|
`IMAG(Z)' `COMPLEX Z' `REAL' GNU extension
|
3912 |
|
|
`IMAGPART(Z)' `COMPLEX Z' `REAL' GNU extension
|
3913 |
|
|
|
3914 |
|
|
|
3915 |
|
|
File: gfortran.info, Node: AINT, Next: ALARM, Prev: AIMAG, Up: Intrinsic Procedures
|
3916 |
|
|
|
3917 |
|
|
8.11 `AINT' -- Truncate to a whole number
|
3918 |
|
|
=========================================
|
3919 |
|
|
|
3920 |
|
|
_Description_:
|
3921 |
|
|
`AINT(A [, KIND])' truncates its argument to a whole number.
|
3922 |
|
|
|
3923 |
|
|
_Standard_:
|
3924 |
|
|
Fortran 77 and later
|
3925 |
|
|
|
3926 |
|
|
_Class_:
|
3927 |
|
|
Elemental function
|
3928 |
|
|
|
3929 |
|
|
_Syntax_:
|
3930 |
|
|
`RESULT = AINT(A [, KIND])'
|
3931 |
|
|
|
3932 |
|
|
_Arguments_:
|
3933 |
|
|
A The type of the argument shall be `REAL'.
|
3934 |
|
|
KIND (Optional) An `INTEGER' initialization
|
3935 |
|
|
expression indicating the kind parameter of
|
3936 |
|
|
the result.
|
3937 |
|
|
|
3938 |
|
|
_Return value_:
|
3939 |
|
|
The return value is of type `REAL' with the kind type parameter of
|
3940 |
|
|
the argument if the optional KIND is absent; otherwise, the kind
|
3941 |
|
|
type parameter will be given by KIND. If the magnitude of X is
|
3942 |
|
|
less than one, `AINT(X)' returns zero. If the magnitude is equal
|
3943 |
|
|
to or greater than one then it returns the largest whole number
|
3944 |
|
|
that does not exceed its magnitude. The sign is the same as the
|
3945 |
|
|
sign of X.
|
3946 |
|
|
|
3947 |
|
|
_Example_:
|
3948 |
|
|
program test_aint
|
3949 |
|
|
real(4) x4
|
3950 |
|
|
real(8) x8
|
3951 |
|
|
x4 = 1.234E0_4
|
3952 |
|
|
x8 = 4.321_8
|
3953 |
|
|
print *, aint(x4), dint(x8)
|
3954 |
|
|
x8 = aint(x4,8)
|
3955 |
|
|
end program test_aint
|
3956 |
|
|
|
3957 |
|
|
_Specific names_:
|
3958 |
|
|
Name Argument Return type Standard
|
3959 |
|
|
`DINT(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
|
3960 |
|
|
later
|
3961 |
|
|
|
3962 |
|
|
|
3963 |
|
|
File: gfortran.info, Node: ALARM, Next: ALL, Prev: AINT, Up: Intrinsic Procedures
|
3964 |
|
|
|
3965 |
|
|
8.12 `ALARM' -- Execute a routine after a given delay
|
3966 |
|
|
=====================================================
|
3967 |
|
|
|
3968 |
|
|
_Description_:
|
3969 |
|
|
`ALARM(SECONDS, HANDLER [, STATUS])' causes external subroutine
|
3970 |
|
|
HANDLER to be executed after a delay of SECONDS by using
|
3971 |
|
|
`alarm(2)' to set up a signal and `signal(2)' to catch it. If
|
3972 |
|
|
STATUS is supplied, it will be returned with the number of seconds
|
3973 |
|
|
remaining until any previously scheduled alarm was due to be
|
3974 |
|
|
delivered, or zero if there was no previously scheduled alarm.
|
3975 |
|
|
|
3976 |
|
|
_Standard_:
|
3977 |
|
|
GNU extension
|
3978 |
|
|
|
3979 |
|
|
_Class_:
|
3980 |
|
|
Subroutine
|
3981 |
|
|
|
3982 |
|
|
_Syntax_:
|
3983 |
|
|
`CALL ALARM(SECONDS, HANDLER [, STATUS])'
|
3984 |
|
|
|
3985 |
|
|
_Arguments_:
|
3986 |
|
|
SECONDS The type of the argument shall be a scalar
|
3987 |
|
|
`INTEGER'. It is `INTENT(IN)'.
|
3988 |
|
|
HANDLER Signal handler (`INTEGER FUNCTION' or
|
3989 |
|
|
`SUBROUTINE') or dummy/global `INTEGER'
|
3990 |
|
|
scalar. The scalar values may be either
|
3991 |
|
|
`SIG_IGN=1' to ignore the alarm generated or
|
3992 |
|
|
`SIG_DFL=0' to set the default action. It is
|
3993 |
|
|
`INTENT(IN)'.
|
3994 |
|
|
STATUS (Optional) STATUS shall be a scalar variable
|
3995 |
|
|
of the default `INTEGER' kind. It is
|
3996 |
|
|
`INTENT(OUT)'.
|
3997 |
|
|
|
3998 |
|
|
_Example_:
|
3999 |
|
|
program test_alarm
|
4000 |
|
|
external handler_print
|
4001 |
|
|
integer i
|
4002 |
|
|
call alarm (3, handler_print, i)
|
4003 |
|
|
print *, i
|
4004 |
|
|
call sleep(10)
|
4005 |
|
|
end program test_alarm
|
4006 |
|
|
This will cause the external routine HANDLER_PRINT to be called
|
4007 |
|
|
after 3 seconds.
|
4008 |
|
|
|
4009 |
|
|
|
4010 |
|
|
File: gfortran.info, Node: ALL, Next: ALLOCATED, Prev: ALARM, Up: Intrinsic Procedures
|
4011 |
|
|
|
4012 |
|
|
8.13 `ALL' -- All values in MASK along DIM are true
|
4013 |
|
|
===================================================
|
4014 |
|
|
|
4015 |
|
|
_Description_:
|
4016 |
|
|
`ALL(MASK [, DIM])' determines if all the values are true in MASK
|
4017 |
|
|
in the array along dimension DIM.
|
4018 |
|
|
|
4019 |
|
|
_Standard_:
|
4020 |
|
|
Fortran 95 and later
|
4021 |
|
|
|
4022 |
|
|
_Class_:
|
4023 |
|
|
Transformational function
|
4024 |
|
|
|
4025 |
|
|
_Syntax_:
|
4026 |
|
|
`RESULT = ALL(MASK [, DIM])'
|
4027 |
|
|
|
4028 |
|
|
_Arguments_:
|
4029 |
|
|
MASK The type of the argument shall be `LOGICAL' and
|
4030 |
|
|
it shall not be scalar.
|
4031 |
|
|
DIM (Optional) DIM shall be a scalar integer with
|
4032 |
|
|
a value that lies between one and the rank of
|
4033 |
|
|
MASK.
|
4034 |
|
|
|
4035 |
|
|
_Return value_:
|
4036 |
|
|
`ALL(MASK)' returns a scalar value of type `LOGICAL' where the
|
4037 |
|
|
kind type parameter is the same as the kind type parameter of
|
4038 |
|
|
MASK. If DIM is present, then `ALL(MASK, DIM)' returns an array
|
4039 |
|
|
with the rank of MASK minus 1. The shape is determined from the
|
4040 |
|
|
shape of MASK where the DIM dimension is elided.
|
4041 |
|
|
|
4042 |
|
|
(A)
|
4043 |
|
|
`ALL(MASK)' is true if all elements of MASK are true. It
|
4044 |
|
|
also is true if MASK has zero size; otherwise, it is false.
|
4045 |
|
|
|
4046 |
|
|
(B)
|
4047 |
|
|
If the rank of MASK is one, then `ALL(MASK,DIM)' is equivalent
|
4048 |
|
|
to `ALL(MASK)'. If the rank is greater than one, then
|
4049 |
|
|
`ALL(MASK,DIM)' is determined by applying `ALL' to the array
|
4050 |
|
|
sections.
|
4051 |
|
|
|
4052 |
|
|
_Example_:
|
4053 |
|
|
program test_all
|
4054 |
|
|
logical l
|
4055 |
|
|
l = all((/.true., .true., .true./))
|
4056 |
|
|
print *, l
|
4057 |
|
|
call section
|
4058 |
|
|
contains
|
4059 |
|
|
subroutine section
|
4060 |
|
|
integer a(2,3), b(2,3)
|
4061 |
|
|
a = 1
|
4062 |
|
|
b = 1
|
4063 |
|
|
b(2,2) = 2
|
4064 |
|
|
print *, all(a .eq. b, 1)
|
4065 |
|
|
print *, all(a .eq. b, 2)
|
4066 |
|
|
end subroutine section
|
4067 |
|
|
end program test_all
|
4068 |
|
|
|
4069 |
|
|
|
4070 |
|
|
File: gfortran.info, Node: ALLOCATED, Next: AND, Prev: ALL, Up: Intrinsic Procedures
|
4071 |
|
|
|
4072 |
|
|
8.14 `ALLOCATED' -- Status of an allocatable entity
|
4073 |
|
|
===================================================
|
4074 |
|
|
|
4075 |
|
|
_Description_:
|
4076 |
|
|
`ALLOCATED(ARRAY)' checks the status of whether X is allocated.
|
4077 |
|
|
|
4078 |
|
|
_Standard_:
|
4079 |
|
|
Fortran 95 and later
|
4080 |
|
|
|
4081 |
|
|
_Class_:
|
4082 |
|
|
Inquiry function
|
4083 |
|
|
|
4084 |
|
|
_Syntax_:
|
4085 |
|
|
`RESULT = ALLOCATED(ARRAY)'
|
4086 |
|
|
|
4087 |
|
|
_Arguments_:
|
4088 |
|
|
ARRAY The argument shall be an `ALLOCATABLE' array.
|
4089 |
|
|
|
4090 |
|
|
_Return value_:
|
4091 |
|
|
The return value is a scalar `LOGICAL' with the default logical
|
4092 |
|
|
kind type parameter. If ARRAY is allocated, `ALLOCATED(ARRAY)' is
|
4093 |
|
|
`.TRUE.'; otherwise, it returns `.FALSE.'
|
4094 |
|
|
|
4095 |
|
|
_Example_:
|
4096 |
|
|
program test_allocated
|
4097 |
|
|
integer :: i = 4
|
4098 |
|
|
real(4), allocatable :: x(:)
|
4099 |
|
|
if (.not. allocated(x)) allocate(x(i))
|
4100 |
|
|
end program test_allocated
|
4101 |
|
|
|
4102 |
|
|
|
4103 |
|
|
File: gfortran.info, Node: AND, Next: ANINT, Prev: ALLOCATED, Up: Intrinsic Procedures
|
4104 |
|
|
|
4105 |
|
|
8.15 `AND' -- Bitwise logical AND
|
4106 |
|
|
=================================
|
4107 |
|
|
|
4108 |
|
|
_Description_:
|
4109 |
|
|
Bitwise logical `AND'.
|
4110 |
|
|
|
4111 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
4112 |
|
|
GNU Fortran 77. For integer arguments, programmers should consider
|
4113 |
|
|
the use of the *note IAND:: intrinsic defined by the Fortran
|
4114 |
|
|
standard.
|
4115 |
|
|
|
4116 |
|
|
_Standard_:
|
4117 |
|
|
GNU extension
|
4118 |
|
|
|
4119 |
|
|
_Class_:
|
4120 |
|
|
Function
|
4121 |
|
|
|
4122 |
|
|
_Syntax_:
|
4123 |
|
|
`RESULT = AND(I, J)'
|
4124 |
|
|
|
4125 |
|
|
_Arguments_:
|
4126 |
|
|
I The type shall be either a scalar `INTEGER'
|
4127 |
|
|
type or a scalar `LOGICAL' type.
|
4128 |
|
|
J The type shall be the same as the type of I.
|
4129 |
|
|
|
4130 |
|
|
_Return value_:
|
4131 |
|
|
The return type is either a scalar `INTEGER' or a scalar
|
4132 |
|
|
`LOGICAL'. If the kind type parameters differ, then the smaller
|
4133 |
|
|
kind type is implicitly converted to larger kind, and the return
|
4134 |
|
|
has the larger kind.
|
4135 |
|
|
|
4136 |
|
|
_Example_:
|
4137 |
|
|
PROGRAM test_and
|
4138 |
|
|
LOGICAL :: T = .TRUE., F = .FALSE.
|
4139 |
|
|
INTEGER :: a, b
|
4140 |
|
|
DATA a / Z'F' /, b / Z'3' /
|
4141 |
|
|
|
4142 |
|
|
WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F)
|
4143 |
|
|
WRITE (*,*) AND(a, b)
|
4144 |
|
|
END PROGRAM
|
4145 |
|
|
|
4146 |
|
|
_See also_:
|
4147 |
|
|
Fortran 95 elemental function: *note IAND::
|
4148 |
|
|
|
4149 |
|
|
|
4150 |
|
|
File: gfortran.info, Node: ANINT, Next: ANY, Prev: AND, Up: Intrinsic Procedures
|
4151 |
|
|
|
4152 |
|
|
8.16 `ANINT' -- Nearest whole number
|
4153 |
|
|
====================================
|
4154 |
|
|
|
4155 |
|
|
_Description_:
|
4156 |
|
|
`ANINT(A [, KIND])' rounds its argument to the nearest whole
|
4157 |
|
|
number.
|
4158 |
|
|
|
4159 |
|
|
_Standard_:
|
4160 |
|
|
Fortran 77 and later
|
4161 |
|
|
|
4162 |
|
|
_Class_:
|
4163 |
|
|
Elemental function
|
4164 |
|
|
|
4165 |
|
|
_Syntax_:
|
4166 |
|
|
`RESULT = ANINT(A [, KIND])'
|
4167 |
|
|
|
4168 |
|
|
_Arguments_:
|
4169 |
|
|
A The type of the argument shall be `REAL'.
|
4170 |
|
|
KIND (Optional) An `INTEGER' initialization
|
4171 |
|
|
expression indicating the kind parameter of
|
4172 |
|
|
the result.
|
4173 |
|
|
|
4174 |
|
|
_Return value_:
|
4175 |
|
|
The return value is of type real with the kind type parameter of
|
4176 |
|
|
the argument if the optional KIND is absent; otherwise, the kind
|
4177 |
|
|
type parameter will be given by KIND. If A is greater than zero,
|
4178 |
|
|
`ANINT(A)' returns `AINT(X+0.5)'. If A is less than or equal to
|
4179 |
|
|
zero then it returns `AINT(X-0.5)'.
|
4180 |
|
|
|
4181 |
|
|
_Example_:
|
4182 |
|
|
program test_anint
|
4183 |
|
|
real(4) x4
|
4184 |
|
|
real(8) x8
|
4185 |
|
|
x4 = 1.234E0_4
|
4186 |
|
|
x8 = 4.321_8
|
4187 |
|
|
print *, anint(x4), dnint(x8)
|
4188 |
|
|
x8 = anint(x4,8)
|
4189 |
|
|
end program test_anint
|
4190 |
|
|
|
4191 |
|
|
_Specific names_:
|
4192 |
|
|
Name Argument Return type Standard
|
4193 |
|
|
`DNINT(A)' `REAL(8) A' `REAL(8)' Fortran 77 and
|
4194 |
|
|
later
|
4195 |
|
|
|
4196 |
|
|
|
4197 |
|
|
File: gfortran.info, Node: ANY, Next: ASIN, Prev: ANINT, Up: Intrinsic Procedures
|
4198 |
|
|
|
4199 |
|
|
8.17 `ANY' -- Any value in MASK along DIM is true
|
4200 |
|
|
=================================================
|
4201 |
|
|
|
4202 |
|
|
_Description_:
|
4203 |
|
|
`ANY(MASK [, DIM])' determines if any of the values in the logical
|
4204 |
|
|
array MASK along dimension DIM are `.TRUE.'.
|
4205 |
|
|
|
4206 |
|
|
_Standard_:
|
4207 |
|
|
Fortran 95 and later
|
4208 |
|
|
|
4209 |
|
|
_Class_:
|
4210 |
|
|
Transformational function
|
4211 |
|
|
|
4212 |
|
|
_Syntax_:
|
4213 |
|
|
`RESULT = ANY(MASK [, DIM])'
|
4214 |
|
|
|
4215 |
|
|
_Arguments_:
|
4216 |
|
|
MASK The type of the argument shall be `LOGICAL' and
|
4217 |
|
|
it shall not be scalar.
|
4218 |
|
|
DIM (Optional) DIM shall be a scalar integer with
|
4219 |
|
|
a value that lies between one and the rank of
|
4220 |
|
|
MASK.
|
4221 |
|
|
|
4222 |
|
|
_Return value_:
|
4223 |
|
|
`ANY(MASK)' returns a scalar value of type `LOGICAL' where the
|
4224 |
|
|
kind type parameter is the same as the kind type parameter of
|
4225 |
|
|
MASK. If DIM is present, then `ANY(MASK, DIM)' returns an array
|
4226 |
|
|
with the rank of MASK minus 1. The shape is determined from the
|
4227 |
|
|
shape of MASK where the DIM dimension is elided.
|
4228 |
|
|
|
4229 |
|
|
(A)
|
4230 |
|
|
`ANY(MASK)' is true if any element of MASK is true;
|
4231 |
|
|
otherwise, it is false. It also is false if MASK has zero
|
4232 |
|
|
size.
|
4233 |
|
|
|
4234 |
|
|
(B)
|
4235 |
|
|
If the rank of MASK is one, then `ANY(MASK,DIM)' is equivalent
|
4236 |
|
|
to `ANY(MASK)'. If the rank is greater than one, then
|
4237 |
|
|
`ANY(MASK,DIM)' is determined by applying `ANY' to the array
|
4238 |
|
|
sections.
|
4239 |
|
|
|
4240 |
|
|
_Example_:
|
4241 |
|
|
program test_any
|
4242 |
|
|
logical l
|
4243 |
|
|
l = any((/.true., .true., .true./))
|
4244 |
|
|
print *, l
|
4245 |
|
|
call section
|
4246 |
|
|
contains
|
4247 |
|
|
subroutine section
|
4248 |
|
|
integer a(2,3), b(2,3)
|
4249 |
|
|
a = 1
|
4250 |
|
|
b = 1
|
4251 |
|
|
b(2,2) = 2
|
4252 |
|
|
print *, any(a .eq. b, 1)
|
4253 |
|
|
print *, any(a .eq. b, 2)
|
4254 |
|
|
end subroutine section
|
4255 |
|
|
end program test_any
|
4256 |
|
|
|
4257 |
|
|
|
4258 |
|
|
File: gfortran.info, Node: ASIN, Next: ASINH, Prev: ANY, Up: Intrinsic Procedures
|
4259 |
|
|
|
4260 |
|
|
8.18 `ASIN' -- Arcsine function
|
4261 |
|
|
===============================
|
4262 |
|
|
|
4263 |
|
|
_Description_:
|
4264 |
|
|
`ASIN(X)' computes the arcsine of its X (inverse of `SIN(X)').
|
4265 |
|
|
|
4266 |
|
|
_Standard_:
|
4267 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
4268 |
|
|
|
4269 |
|
|
_Class_:
|
4270 |
|
|
Elemental function
|
4271 |
|
|
|
4272 |
|
|
_Syntax_:
|
4273 |
|
|
`RESULT = ASIN(X)'
|
4274 |
|
|
|
4275 |
|
|
_Arguments_:
|
4276 |
|
|
X The type shall be either `REAL' and a
|
4277 |
|
|
magnitude that is less than or equal to one -
|
4278 |
|
|
or be `COMPLEX'.
|
4279 |
|
|
|
4280 |
|
|
_Return value_:
|
4281 |
|
|
The return value is of the same type and kind as X. The real part
|
4282 |
|
|
of the result is in radians and lies in the range -\pi/2 \leq \Re
|
4283 |
|
|
\asin(x) \leq \pi/2.
|
4284 |
|
|
|
4285 |
|
|
_Example_:
|
4286 |
|
|
program test_asin
|
4287 |
|
|
real(8) :: x = 0.866_8
|
4288 |
|
|
x = asin(x)
|
4289 |
|
|
end program test_asin
|
4290 |
|
|
|
4291 |
|
|
_Specific names_:
|
4292 |
|
|
Name Argument Return type Standard
|
4293 |
|
|
`DASIN(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
|
4294 |
|
|
later
|
4295 |
|
|
|
4296 |
|
|
_See also_:
|
4297 |
|
|
Inverse function: *note SIN::
|
4298 |
|
|
|
4299 |
|
|
|
4300 |
|
|
|
4301 |
|
|
File: gfortran.info, Node: ASINH, Next: ASSOCIATED, Prev: ASIN, Up: Intrinsic Procedures
|
4302 |
|
|
|
4303 |
|
|
8.19 `ASINH' -- Hyperbolic arcsine function
|
4304 |
|
|
===========================================
|
4305 |
|
|
|
4306 |
|
|
_Description_:
|
4307 |
|
|
`ASINH(X)' computes the hyperbolic arcsine of X (inverse of
|
4308 |
|
|
`SINH(X)').
|
4309 |
|
|
|
4310 |
|
|
_Standard_:
|
4311 |
|
|
Fortran 2008 and later
|
4312 |
|
|
|
4313 |
|
|
_Class_:
|
4314 |
|
|
Elemental function
|
4315 |
|
|
|
4316 |
|
|
_Syntax_:
|
4317 |
|
|
`RESULT = ASINH(X)'
|
4318 |
|
|
|
4319 |
|
|
_Arguments_:
|
4320 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
4321 |
|
|
|
4322 |
|
|
_Return value_:
|
4323 |
|
|
The return value is of the same type and kind as X. If X is
|
4324 |
|
|
complex, the imaginary part of the result is in radians and lies
|
4325 |
|
|
between -\pi/2 \leq \Im \asinh(x) \leq \pi/2.
|
4326 |
|
|
|
4327 |
|
|
_Example_:
|
4328 |
|
|
PROGRAM test_asinh
|
4329 |
|
|
REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
|
4330 |
|
|
WRITE (*,*) ASINH(x)
|
4331 |
|
|
END PROGRAM
|
4332 |
|
|
|
4333 |
|
|
_Specific names_:
|
4334 |
|
|
Name Argument Return type Standard
|
4335 |
|
|
`DASINH(X)' `REAL(8) X' `REAL(8)' GNU extension.
|
4336 |
|
|
|
4337 |
|
|
_See also_:
|
4338 |
|
|
Inverse function: *note SINH::
|
4339 |
|
|
|
4340 |
|
|
|
4341 |
|
|
File: gfortran.info, Node: ASSOCIATED, Next: ATAN, Prev: ASINH, Up: Intrinsic Procedures
|
4342 |
|
|
|
4343 |
|
|
8.20 `ASSOCIATED' -- Status of a pointer or pointer/target pair
|
4344 |
|
|
===============================================================
|
4345 |
|
|
|
4346 |
|
|
_Description_:
|
4347 |
|
|
`ASSOCIATED(POINTER [, TARGET])' determines the status of the
|
4348 |
|
|
pointer POINTER or if POINTER is associated with the target TARGET.
|
4349 |
|
|
|
4350 |
|
|
_Standard_:
|
4351 |
|
|
Fortran 95 and later
|
4352 |
|
|
|
4353 |
|
|
_Class_:
|
4354 |
|
|
Inquiry function
|
4355 |
|
|
|
4356 |
|
|
_Syntax_:
|
4357 |
|
|
`RESULT = ASSOCIATED(POINTER [, TARGET])'
|
4358 |
|
|
|
4359 |
|
|
_Arguments_:
|
4360 |
|
|
POINTER POINTER shall have the `POINTER' attribute and
|
4361 |
|
|
it can be of any type.
|
4362 |
|
|
TARGET (Optional) TARGET shall be a pointer or a
|
4363 |
|
|
target. It must have the same type, kind type
|
4364 |
|
|
parameter, and array rank as POINTER.
|
4365 |
|
|
The association status of neither POINTER nor TARGET shall be
|
4366 |
|
|
undefined.
|
4367 |
|
|
|
4368 |
|
|
_Return value_:
|
4369 |
|
|
`ASSOCIATED(POINTER)' returns a scalar value of type `LOGICAL(4)'.
|
4370 |
|
|
There are several cases:
|
4371 |
|
|
(A) When the optional TARGET is not present then
|
4372 |
|
|
`ASSOCIATED(POINTER)' is true if POINTER is associated with a
|
4373 |
|
|
target; otherwise, it returns false.
|
4374 |
|
|
|
4375 |
|
|
(B) If TARGET is present and a scalar target, the result is true if
|
4376 |
|
|
TARGET is not a zero-sized storage sequence and the target
|
4377 |
|
|
associated with POINTER occupies the same storage units. If
|
4378 |
|
|
POINTER is disassociated, the result is false.
|
4379 |
|
|
|
4380 |
|
|
(C) If TARGET is present and an array target, the result is true if
|
4381 |
|
|
TARGET and POINTER have the same shape, are not zero-sized
|
4382 |
|
|
arrays, are arrays whose elements are not zero-sized storage
|
4383 |
|
|
sequences, and TARGET and POINTER occupy the same storage
|
4384 |
|
|
units in array element order. As in case(B), the result is
|
4385 |
|
|
false, if POINTER is disassociated.
|
4386 |
|
|
|
4387 |
|
|
(D) If TARGET is present and an scalar pointer, the result is true
|
4388 |
|
|
if TARGET is associated with POINTER, the target associated
|
4389 |
|
|
with TARGET are not zero-sized storage sequences and occupy
|
4390 |
|
|
the same storage units. The result is false, if either
|
4391 |
|
|
TARGET or POINTER is disassociated.
|
4392 |
|
|
|
4393 |
|
|
(E) If TARGET is present and an array pointer, the result is true if
|
4394 |
|
|
target associated with POINTER and the target associated with
|
4395 |
|
|
TARGET have the same shape, are not zero-sized arrays, are
|
4396 |
|
|
arrays whose elements are not zero-sized storage sequences,
|
4397 |
|
|
and TARGET and POINTER occupy the same storage units in array
|
4398 |
|
|
element order. The result is false, if either TARGET or
|
4399 |
|
|
POINTER is disassociated.
|
4400 |
|
|
|
4401 |
|
|
_Example_:
|
4402 |
|
|
program test_associated
|
4403 |
|
|
implicit none
|
4404 |
|
|
real, target :: tgt(2) = (/1., 2./)
|
4405 |
|
|
real, pointer :: ptr(:)
|
4406 |
|
|
ptr => tgt
|
4407 |
|
|
if (associated(ptr) .eqv. .false.) call abort
|
4408 |
|
|
if (associated(ptr,tgt) .eqv. .false.) call abort
|
4409 |
|
|
end program test_associated
|
4410 |
|
|
|
4411 |
|
|
_See also_:
|
4412 |
|
|
*note NULL::
|
4413 |
|
|
|
4414 |
|
|
|
4415 |
|
|
File: gfortran.info, Node: ATAN, Next: ATAN2, Prev: ASSOCIATED, Up: Intrinsic Procedures
|
4416 |
|
|
|
4417 |
|
|
8.21 `ATAN' -- Arctangent function
|
4418 |
|
|
==================================
|
4419 |
|
|
|
4420 |
|
|
_Description_:
|
4421 |
|
|
`ATAN(X)' computes the arctangent of X.
|
4422 |
|
|
|
4423 |
|
|
_Standard_:
|
4424 |
|
|
Fortran 77 and later, for a complex argument and for two arguments
|
4425 |
|
|
Fortran 2008 or later
|
4426 |
|
|
|
4427 |
|
|
_Class_:
|
4428 |
|
|
Elemental function
|
4429 |
|
|
|
4430 |
|
|
_Syntax_:
|
4431 |
|
|
`RESULT = ATAN(X)' `RESULT = ATAN(Y, X)'
|
4432 |
|
|
|
4433 |
|
|
_Arguments_:
|
4434 |
|
|
X The type shall be `REAL' or `COMPLEX'; if Y is
|
4435 |
|
|
present, X shall be REAL.
|
4436 |
|
|
Y shall
|
4437 |
|
|
be of the
|
4438 |
|
|
same type
|
4439 |
|
|
and kind
|
4440 |
|
|
as X.
|
4441 |
|
|
|
4442 |
|
|
_Return value_:
|
4443 |
|
|
The return value is of the same type and kind as X. If Y is
|
4444 |
|
|
present, the result is identical to `ATAN2(Y,X)'. Otherwise, it
|
4445 |
|
|
the arcus tangent of X, where the real part of the result is in
|
4446 |
|
|
radians and lies in the range -\pi/2 \leq \Re \atan(x) \leq \pi/2.
|
4447 |
|
|
|
4448 |
|
|
_Example_:
|
4449 |
|
|
program test_atan
|
4450 |
|
|
real(8) :: x = 2.866_8
|
4451 |
|
|
x = atan(x)
|
4452 |
|
|
end program test_atan
|
4453 |
|
|
|
4454 |
|
|
_Specific names_:
|
4455 |
|
|
Name Argument Return type Standard
|
4456 |
|
|
`DATAN(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
|
4457 |
|
|
later
|
4458 |
|
|
|
4459 |
|
|
_See also_:
|
4460 |
|
|
Inverse function: *note TAN::
|
4461 |
|
|
|
4462 |
|
|
|
4463 |
|
|
|
4464 |
|
|
File: gfortran.info, Node: ATAN2, Next: ATANH, Prev: ATAN, Up: Intrinsic Procedures
|
4465 |
|
|
|
4466 |
|
|
8.22 `ATAN2' -- Arctangent function
|
4467 |
|
|
===================================
|
4468 |
|
|
|
4469 |
|
|
_Description_:
|
4470 |
|
|
`ATAN2(Y, X)' computes the principal value of the argument
|
4471 |
|
|
function of the complex number X + i Y. This function can be used
|
4472 |
|
|
to transform from carthesian into polar coordinates and allows to
|
4473 |
|
|
determine the angle in the correct quadrant.
|
4474 |
|
|
|
4475 |
|
|
_Standard_:
|
4476 |
|
|
Fortran 77 and later
|
4477 |
|
|
|
4478 |
|
|
_Class_:
|
4479 |
|
|
Elemental function
|
4480 |
|
|
|
4481 |
|
|
_Syntax_:
|
4482 |
|
|
`RESULT = ATAN2(Y, X)'
|
4483 |
|
|
|
4484 |
|
|
_Arguments_:
|
4485 |
|
|
Y The type shall be `REAL'.
|
4486 |
|
|
X The type and kind type parameter shall be the
|
4487 |
|
|
same as Y. If Y is zero, then X must be
|
4488 |
|
|
nonzero.
|
4489 |
|
|
|
4490 |
|
|
_Return value_:
|
4491 |
|
|
The return value has the same type and kind type parameter as Y.
|
4492 |
|
|
It is the principal value of the complex number X + i Y. If X is
|
4493 |
|
|
nonzero, then it lies in the range -\pi \le \atan (x) \leq \pi.
|
4494 |
|
|
The sign is positive if Y is positive. If Y is zero, then the
|
4495 |
|
|
return value is zero if X is positive and \pi if X is negative.
|
4496 |
|
|
Finally, if X is zero, then the magnitude of the result is \pi/2.
|
4497 |
|
|
|
4498 |
|
|
_Example_:
|
4499 |
|
|
program test_atan2
|
4500 |
|
|
real(4) :: x = 1.e0_4, y = 0.5e0_4
|
4501 |
|
|
x = atan2(y,x)
|
4502 |
|
|
end program test_atan2
|
4503 |
|
|
|
4504 |
|
|
_Specific names_:
|
4505 |
|
|
Name Argument Return type Standard
|
4506 |
|
|
`DATAN2(X, `REAL(8) X', `REAL(8)' Fortran 77 and
|
4507 |
|
|
Y)' `REAL(8) Y' later
|
4508 |
|
|
|
4509 |
|
|
|
4510 |
|
|
File: gfortran.info, Node: ATANH, Next: BESSEL_J0, Prev: ATAN2, Up: Intrinsic Procedures
|
4511 |
|
|
|
4512 |
|
|
8.23 `ATANH' -- Hyperbolic arctangent function
|
4513 |
|
|
==============================================
|
4514 |
|
|
|
4515 |
|
|
_Description_:
|
4516 |
|
|
`ATANH(X)' computes the hyperbolic arctangent of X (inverse of
|
4517 |
|
|
`TANH(X)').
|
4518 |
|
|
|
4519 |
|
|
_Standard_:
|
4520 |
|
|
Fortran 2008 and later
|
4521 |
|
|
|
4522 |
|
|
_Class_:
|
4523 |
|
|
Elemental function
|
4524 |
|
|
|
4525 |
|
|
_Syntax_:
|
4526 |
|
|
`RESULT = ATANH(X)'
|
4527 |
|
|
|
4528 |
|
|
_Arguments_:
|
4529 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
4530 |
|
|
|
4531 |
|
|
_Return value_:
|
4532 |
|
|
The return value has same type and kind as X. If X is complex, the
|
4533 |
|
|
imaginary part of the result is in radians and lies between -\pi/2
|
4534 |
|
|
\leq \Im \atanh(x) \leq \pi/2.
|
4535 |
|
|
|
4536 |
|
|
_Example_:
|
4537 |
|
|
PROGRAM test_atanh
|
4538 |
|
|
REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /)
|
4539 |
|
|
WRITE (*,*) ATANH(x)
|
4540 |
|
|
END PROGRAM
|
4541 |
|
|
|
4542 |
|
|
_Specific names_:
|
4543 |
|
|
Name Argument Return type Standard
|
4544 |
|
|
`DATANH(X)' `REAL(8) X' `REAL(8)' GNU extension
|
4545 |
|
|
|
4546 |
|
|
_See also_:
|
4547 |
|
|
Inverse function: *note TANH::
|
4548 |
|
|
|
4549 |
|
|
|
4550 |
|
|
File: gfortran.info, Node: BESSEL_J0, Next: BESSEL_J1, Prev: ATANH, Up: Intrinsic Procedures
|
4551 |
|
|
|
4552 |
|
|
8.24 `BESSEL_J0' -- Bessel function of the first kind of order 0
|
4553 |
|
|
================================================================
|
4554 |
|
|
|
4555 |
|
|
_Description_:
|
4556 |
|
|
`BESSEL_J0(X)' computes the Bessel function of the first kind of
|
4557 |
|
|
order 0 of X. This function is available under the name `BESJ0' as
|
4558 |
|
|
a GNU extension.
|
4559 |
|
|
|
4560 |
|
|
_Standard_:
|
4561 |
|
|
Fortran 2008 and later
|
4562 |
|
|
|
4563 |
|
|
_Class_:
|
4564 |
|
|
Elemental function
|
4565 |
|
|
|
4566 |
|
|
_Syntax_:
|
4567 |
|
|
`RESULT = BESSEL_J0(X)'
|
4568 |
|
|
|
4569 |
|
|
_Arguments_:
|
4570 |
|
|
X The type shall be `REAL', and it shall be
|
4571 |
|
|
scalar.
|
4572 |
|
|
|
4573 |
|
|
_Return value_:
|
4574 |
|
|
The return value is of type `REAL' and lies in the range -
|
4575 |
|
|
0.4027... \leq Bessel (0,x) \leq 1. It has the same kind as X.
|
4576 |
|
|
|
4577 |
|
|
_Example_:
|
4578 |
|
|
program test_besj0
|
4579 |
|
|
real(8) :: x = 0.0_8
|
4580 |
|
|
x = bessel_j0(x)
|
4581 |
|
|
end program test_besj0
|
4582 |
|
|
|
4583 |
|
|
_Specific names_:
|
4584 |
|
|
Name Argument Return type Standard
|
4585 |
|
|
`DBESJ0(X)' `REAL(8) X' `REAL(8)' GNU extension
|
4586 |
|
|
|
4587 |
|
|
|
4588 |
|
|
File: gfortran.info, Node: BESSEL_J1, Next: BESSEL_JN, Prev: BESSEL_J0, Up: Intrinsic Procedures
|
4589 |
|
|
|
4590 |
|
|
8.25 `BESSEL_J1' -- Bessel function of the first kind of order 1
|
4591 |
|
|
================================================================
|
4592 |
|
|
|
4593 |
|
|
_Description_:
|
4594 |
|
|
`BESSEL_J1(X)' computes the Bessel function of the first kind of
|
4595 |
|
|
order 1 of X. This function is available under the name `BESJ1' as
|
4596 |
|
|
a GNU extension.
|
4597 |
|
|
|
4598 |
|
|
_Standard_:
|
4599 |
|
|
Fortran 2008
|
4600 |
|
|
|
4601 |
|
|
_Class_:
|
4602 |
|
|
Elemental function
|
4603 |
|
|
|
4604 |
|
|
_Syntax_:
|
4605 |
|
|
`RESULT = BESSEL_J1(X)'
|
4606 |
|
|
|
4607 |
|
|
_Arguments_:
|
4608 |
|
|
X The type shall be `REAL', and it shall be
|
4609 |
|
|
scalar.
|
4610 |
|
|
|
4611 |
|
|
_Return value_:
|
4612 |
|
|
The return value is of type `REAL' and it lies in the range -
|
4613 |
|
|
0.5818... \leq Bessel (0,x) \leq 0.5818 . It has the same kind as
|
4614 |
|
|
X.
|
4615 |
|
|
|
4616 |
|
|
_Example_:
|
4617 |
|
|
program test_besj1
|
4618 |
|
|
real(8) :: x = 1.0_8
|
4619 |
|
|
x = bessel_j1(x)
|
4620 |
|
|
end program test_besj1
|
4621 |
|
|
|
4622 |
|
|
_Specific names_:
|
4623 |
|
|
Name Argument Return type Standard
|
4624 |
|
|
`DBESJ1(X)' `REAL(8) X' `REAL(8)' GNU extension
|
4625 |
|
|
|
4626 |
|
|
|
4627 |
|
|
File: gfortran.info, Node: BESSEL_JN, Next: BESSEL_Y0, Prev: BESSEL_J1, Up: Intrinsic Procedures
|
4628 |
|
|
|
4629 |
|
|
8.26 `BESSEL_JN' -- Bessel function of the first kind
|
4630 |
|
|
=====================================================
|
4631 |
|
|
|
4632 |
|
|
_Description_:
|
4633 |
|
|
`BESSEL_JN(N, X)' computes the Bessel function of the first kind of
|
4634 |
|
|
order N of X. This function is available under the name `BESJN' as
|
4635 |
|
|
a GNU extension.
|
4636 |
|
|
|
4637 |
|
|
If both arguments are arrays, their ranks and shapes shall conform.
|
4638 |
|
|
|
4639 |
|
|
_Standard_:
|
4640 |
|
|
Fortran 2008 and later
|
4641 |
|
|
|
4642 |
|
|
_Class_:
|
4643 |
|
|
Elemental function
|
4644 |
|
|
|
4645 |
|
|
_Syntax_:
|
4646 |
|
|
`RESULT = BESSEL_JN(N, X)'
|
4647 |
|
|
|
4648 |
|
|
_Arguments_:
|
4649 |
|
|
N Shall be a scalar or an array of type
|
4650 |
|
|
`INTEGER'.
|
4651 |
|
|
X Shall be a scalar or an array of type `REAL'.
|
4652 |
|
|
|
4653 |
|
|
_Return value_:
|
4654 |
|
|
The return value is a scalar of type `REAL'. It has the same kind
|
4655 |
|
|
as X.
|
4656 |
|
|
|
4657 |
|
|
_Example_:
|
4658 |
|
|
program test_besjn
|
4659 |
|
|
real(8) :: x = 1.0_8
|
4660 |
|
|
x = bessel_jn(5,x)
|
4661 |
|
|
end program test_besjn
|
4662 |
|
|
|
4663 |
|
|
_Specific names_:
|
4664 |
|
|
Name Argument Return type Standard
|
4665 |
|
|
`DBESJN(N, `INTEGER N' `REAL(8)' GNU extension
|
4666 |
|
|
X)'
|
4667 |
|
|
`REAL(8) X'
|
4668 |
|
|
|
4669 |
|
|
|
4670 |
|
|
File: gfortran.info, Node: BESSEL_Y0, Next: BESSEL_Y1, Prev: BESSEL_JN, Up: Intrinsic Procedures
|
4671 |
|
|
|
4672 |
|
|
8.27 `BESSEL_Y0' -- Bessel function of the second kind of order 0
|
4673 |
|
|
=================================================================
|
4674 |
|
|
|
4675 |
|
|
_Description_:
|
4676 |
|
|
`BESSEL_Y0(X)' computes the Bessel function of the second kind of
|
4677 |
|
|
order 0 of X. This function is available under the name `BESY0' as
|
4678 |
|
|
a GNU extension.
|
4679 |
|
|
|
4680 |
|
|
_Standard_:
|
4681 |
|
|
Fortran 2008 and later
|
4682 |
|
|
|
4683 |
|
|
_Class_:
|
4684 |
|
|
Elemental function
|
4685 |
|
|
|
4686 |
|
|
_Syntax_:
|
4687 |
|
|
`RESULT = BESSEL_Y0(X)'
|
4688 |
|
|
|
4689 |
|
|
_Arguments_:
|
4690 |
|
|
X The type shall be `REAL', and it shall be
|
4691 |
|
|
scalar.
|
4692 |
|
|
|
4693 |
|
|
_Return value_:
|
4694 |
|
|
The return value is a scalar of type `REAL'. It has the same kind
|
4695 |
|
|
as X.
|
4696 |
|
|
|
4697 |
|
|
_Example_:
|
4698 |
|
|
program test_besy0
|
4699 |
|
|
real(8) :: x = 0.0_8
|
4700 |
|
|
x = bessel_y0(x)
|
4701 |
|
|
end program test_besy0
|
4702 |
|
|
|
4703 |
|
|
_Specific names_:
|
4704 |
|
|
Name Argument Return type Standard
|
4705 |
|
|
`DBESY0(X)' `REAL(8) X' `REAL(8)' GNU extension
|
4706 |
|
|
|
4707 |
|
|
|
4708 |
|
|
File: gfortran.info, Node: BESSEL_Y1, Next: BESSEL_YN, Prev: BESSEL_Y0, Up: Intrinsic Procedures
|
4709 |
|
|
|
4710 |
|
|
8.28 `BESSEL_Y1' -- Bessel function of the second kind of order 1
|
4711 |
|
|
=================================================================
|
4712 |
|
|
|
4713 |
|
|
_Description_:
|
4714 |
|
|
`BESSEL_Y1(X)' computes the Bessel function of the second kind of
|
4715 |
|
|
order 1 of X. This function is available under the name `BESY1' as
|
4716 |
|
|
a GNU extension.
|
4717 |
|
|
|
4718 |
|
|
_Standard_:
|
4719 |
|
|
Fortran 2008 and later
|
4720 |
|
|
|
4721 |
|
|
_Class_:
|
4722 |
|
|
Elemental function
|
4723 |
|
|
|
4724 |
|
|
_Syntax_:
|
4725 |
|
|
`RESULT = BESSEL_Y1(X)'
|
4726 |
|
|
|
4727 |
|
|
_Arguments_:
|
4728 |
|
|
X The type shall be `REAL', and it shall be
|
4729 |
|
|
scalar.
|
4730 |
|
|
|
4731 |
|
|
_Return value_:
|
4732 |
|
|
The return value is a scalar of type `REAL'. It has the same kind
|
4733 |
|
|
as X.
|
4734 |
|
|
|
4735 |
|
|
_Example_:
|
4736 |
|
|
program test_besy1
|
4737 |
|
|
real(8) :: x = 1.0_8
|
4738 |
|
|
x = bessel_y1(x)
|
4739 |
|
|
end program test_besy1
|
4740 |
|
|
|
4741 |
|
|
_Specific names_:
|
4742 |
|
|
Name Argument Return type Standard
|
4743 |
|
|
`DBESY1(X)' `REAL(8) X' `REAL(8)' GNU extension
|
4744 |
|
|
|
4745 |
|
|
|
4746 |
|
|
File: gfortran.info, Node: BESSEL_YN, Next: BIT_SIZE, Prev: BESSEL_Y1, Up: Intrinsic Procedures
|
4747 |
|
|
|
4748 |
|
|
8.29 `BESSEL_YN' -- Bessel function of the second kind
|
4749 |
|
|
======================================================
|
4750 |
|
|
|
4751 |
|
|
_Description_:
|
4752 |
|
|
`BESSEL_YN(N, X)' computes the Bessel function of the second kind
|
4753 |
|
|
of order N of X. This function is available under the name `BESYN'
|
4754 |
|
|
as a GNU extension.
|
4755 |
|
|
|
4756 |
|
|
If both arguments are arrays, their ranks and shapes shall conform.
|
4757 |
|
|
|
4758 |
|
|
_Standard_:
|
4759 |
|
|
Fortran 2008 and later
|
4760 |
|
|
|
4761 |
|
|
_Class_:
|
4762 |
|
|
Elemental function
|
4763 |
|
|
|
4764 |
|
|
_Syntax_:
|
4765 |
|
|
`RESULT = BESSEL_YN(N, X)'
|
4766 |
|
|
|
4767 |
|
|
_Arguments_:
|
4768 |
|
|
N Shall be a scalar or an array of type
|
4769 |
|
|
`INTEGER'.
|
4770 |
|
|
X Shall be a scalar or an array of type `REAL'.
|
4771 |
|
|
|
4772 |
|
|
_Return value_:
|
4773 |
|
|
The return value is a scalar of type `REAL'. It has the same kind
|
4774 |
|
|
as X.
|
4775 |
|
|
|
4776 |
|
|
_Example_:
|
4777 |
|
|
program test_besyn
|
4778 |
|
|
real(8) :: x = 1.0_8
|
4779 |
|
|
x = bessel_yn(5,x)
|
4780 |
|
|
end program test_besyn
|
4781 |
|
|
|
4782 |
|
|
_Specific names_:
|
4783 |
|
|
Name Argument Return type Standard
|
4784 |
|
|
`DBESYN(N,X)' `INTEGER N' `REAL(8)' GNU extension
|
4785 |
|
|
`REAL(8)
|
4786 |
|
|
X'
|
4787 |
|
|
|
4788 |
|
|
|
4789 |
|
|
File: gfortran.info, Node: BIT_SIZE, Next: BTEST, Prev: BESSEL_YN, Up: Intrinsic Procedures
|
4790 |
|
|
|
4791 |
|
|
8.30 `BIT_SIZE' -- Bit size inquiry function
|
4792 |
|
|
============================================
|
4793 |
|
|
|
4794 |
|
|
_Description_:
|
4795 |
|
|
`BIT_SIZE(I)' returns the number of bits (integer precision plus
|
4796 |
|
|
sign bit) represented by the type of I. The result of
|
4797 |
|
|
`BIT_SIZE(I)' is independent of the actual value of I.
|
4798 |
|
|
|
4799 |
|
|
_Standard_:
|
4800 |
|
|
Fortran 95 and later
|
4801 |
|
|
|
4802 |
|
|
_Class_:
|
4803 |
|
|
Inquiry function
|
4804 |
|
|
|
4805 |
|
|
_Syntax_:
|
4806 |
|
|
`RESULT = BIT_SIZE(I)'
|
4807 |
|
|
|
4808 |
|
|
_Arguments_:
|
4809 |
|
|
I The type shall be `INTEGER'.
|
4810 |
|
|
|
4811 |
|
|
_Return value_:
|
4812 |
|
|
The return value is of type `INTEGER'
|
4813 |
|
|
|
4814 |
|
|
_Example_:
|
4815 |
|
|
program test_bit_size
|
4816 |
|
|
integer :: i = 123
|
4817 |
|
|
integer :: size
|
4818 |
|
|
size = bit_size(i)
|
4819 |
|
|
print *, size
|
4820 |
|
|
end program test_bit_size
|
4821 |
|
|
|
4822 |
|
|
|
4823 |
|
|
File: gfortran.info, Node: BTEST, Next: C_ASSOCIATED, Prev: BIT_SIZE, Up: Intrinsic Procedures
|
4824 |
|
|
|
4825 |
|
|
8.31 `BTEST' -- Bit test function
|
4826 |
|
|
=================================
|
4827 |
|
|
|
4828 |
|
|
_Description_:
|
4829 |
|
|
`BTEST(I,POS)' returns logical `.TRUE.' if the bit at POS in I is
|
4830 |
|
|
set. The counting of the bits starts at 0.
|
4831 |
|
|
|
4832 |
|
|
_Standard_:
|
4833 |
|
|
Fortran 95 and later
|
4834 |
|
|
|
4835 |
|
|
_Class_:
|
4836 |
|
|
Elemental function
|
4837 |
|
|
|
4838 |
|
|
_Syntax_:
|
4839 |
|
|
`RESULT = BTEST(I, POS)'
|
4840 |
|
|
|
4841 |
|
|
_Arguments_:
|
4842 |
|
|
I The type shall be `INTEGER'.
|
4843 |
|
|
POS The type shall be `INTEGER'.
|
4844 |
|
|
|
4845 |
|
|
_Return value_:
|
4846 |
|
|
The return value is of type `LOGICAL'
|
4847 |
|
|
|
4848 |
|
|
_Example_:
|
4849 |
|
|
program test_btest
|
4850 |
|
|
integer :: i = 32768 + 1024 + 64
|
4851 |
|
|
integer :: pos
|
4852 |
|
|
logical :: bool
|
4853 |
|
|
do pos=0,16
|
4854 |
|
|
bool = btest(i, pos)
|
4855 |
|
|
print *, pos, bool
|
4856 |
|
|
end do
|
4857 |
|
|
end program test_btest
|
4858 |
|
|
|
4859 |
|
|
|
4860 |
|
|
File: gfortran.info, Node: C_ASSOCIATED, Next: C_F_POINTER, Prev: BTEST, Up: Intrinsic Procedures
|
4861 |
|
|
|
4862 |
|
|
8.32 `C_ASSOCIATED' -- Status of a C pointer
|
4863 |
|
|
============================================
|
4864 |
|
|
|
4865 |
|
|
_Description_:
|
4866 |
|
|
`C_ASSOCIATED(c_prt_1[, c_ptr_2])' determines the status of the C
|
4867 |
|
|
pointer C_PTR_1 or if C_PTR_1 is associated with the target
|
4868 |
|
|
C_PTR_2.
|
4869 |
|
|
|
4870 |
|
|
_Standard_:
|
4871 |
|
|
Fortran 2003 and later
|
4872 |
|
|
|
4873 |
|
|
_Class_:
|
4874 |
|
|
Inquiry function
|
4875 |
|
|
|
4876 |
|
|
_Syntax_:
|
4877 |
|
|
`RESULT = C_ASSOCIATED(c_prt_1[, c_ptr_2])'
|
4878 |
|
|
|
4879 |
|
|
_Arguments_:
|
4880 |
|
|
C_PTR_1 Scalar of the type `C_PTR' or `C_FUNPTR'.
|
4881 |
|
|
C_PTR_2 (Optional) Scalar of the same type as C_PTR_1.
|
4882 |
|
|
|
4883 |
|
|
_Return value_:
|
4884 |
|
|
The return value is of type `LOGICAL'; it is `.false.' if either
|
4885 |
|
|
C_PTR_1 is a C NULL pointer or if C_PTR1 and C_PTR_2 point to
|
4886 |
|
|
different addresses.
|
4887 |
|
|
|
4888 |
|
|
_Example_:
|
4889 |
|
|
subroutine association_test(a,b)
|
4890 |
|
|
use iso_c_binding, only: c_associated, c_loc, c_ptr
|
4891 |
|
|
implicit none
|
4892 |
|
|
real, pointer :: a
|
4893 |
|
|
type(c_ptr) :: b
|
4894 |
|
|
if(c_associated(b, c_loc(a))) &
|
4895 |
|
|
stop 'b and a do not point to same target'
|
4896 |
|
|
end subroutine association_test
|
4897 |
|
|
|
4898 |
|
|
_See also_:
|
4899 |
|
|
*note C_LOC::, *note C_FUNLOC::
|
4900 |
|
|
|
4901 |
|
|
|
4902 |
|
|
File: gfortran.info, Node: C_FUNLOC, Next: C_LOC, Prev: C_F_PROCPOINTER, Up: Intrinsic Procedures
|
4903 |
|
|
|
4904 |
|
|
8.33 `C_FUNLOC' -- Obtain the C address of a procedure
|
4905 |
|
|
======================================================
|
4906 |
|
|
|
4907 |
|
|
_Description_:
|
4908 |
|
|
`C_FUNLOC(x)' determines the C address of the argument.
|
4909 |
|
|
|
4910 |
|
|
_Standard_:
|
4911 |
|
|
Fortran 2003 and later
|
4912 |
|
|
|
4913 |
|
|
_Class_:
|
4914 |
|
|
Inquiry function
|
4915 |
|
|
|
4916 |
|
|
_Syntax_:
|
4917 |
|
|
`RESULT = C_FUNLOC(x)'
|
4918 |
|
|
|
4919 |
|
|
_Arguments_:
|
4920 |
|
|
X Interoperable function or pointer to such
|
4921 |
|
|
function.
|
4922 |
|
|
|
4923 |
|
|
_Return value_:
|
4924 |
|
|
The return value is of type `C_FUNPTR' and contains the C address
|
4925 |
|
|
of the argument.
|
4926 |
|
|
|
4927 |
|
|
_Example_:
|
4928 |
|
|
module x
|
4929 |
|
|
use iso_c_binding
|
4930 |
|
|
implicit none
|
4931 |
|
|
contains
|
4932 |
|
|
subroutine sub(a) bind(c)
|
4933 |
|
|
real(c_float) :: a
|
4934 |
|
|
a = sqrt(a)+5.0
|
4935 |
|
|
end subroutine sub
|
4936 |
|
|
end module x
|
4937 |
|
|
program main
|
4938 |
|
|
use iso_c_binding
|
4939 |
|
|
use x
|
4940 |
|
|
implicit none
|
4941 |
|
|
interface
|
4942 |
|
|
subroutine my_routine(p) bind(c,name='myC_func')
|
4943 |
|
|
import :: c_funptr
|
4944 |
|
|
type(c_funptr), intent(in) :: p
|
4945 |
|
|
end subroutine
|
4946 |
|
|
end interface
|
4947 |
|
|
call my_routine(c_funloc(sub))
|
4948 |
|
|
end program main
|
4949 |
|
|
|
4950 |
|
|
_See also_:
|
4951 |
|
|
*note C_ASSOCIATED::, *note C_LOC::, *note C_F_POINTER::, *note
|
4952 |
|
|
C_F_PROCPOINTER::
|
4953 |
|
|
|
4954 |
|
|
|
4955 |
|
|
File: gfortran.info, Node: C_F_PROCPOINTER, Next: C_FUNLOC, Prev: C_F_POINTER, Up: Intrinsic Procedures
|
4956 |
|
|
|
4957 |
|
|
8.34 `C_F_PROCPOINTER' -- Convert C into Fortran procedure pointer
|
4958 |
|
|
==================================================================
|
4959 |
|
|
|
4960 |
|
|
_Description_:
|
4961 |
|
|
`C_F_PROCPOINTER(CPTR, FPTR)' Assign the target of the C function
|
4962 |
|
|
pointer CPTR to the Fortran procedure pointer FPTR.
|
4963 |
|
|
|
4964 |
|
|
_Standard_:
|
4965 |
|
|
Fortran 2003 and later
|
4966 |
|
|
|
4967 |
|
|
_Class_:
|
4968 |
|
|
Subroutine
|
4969 |
|
|
|
4970 |
|
|
_Syntax_:
|
4971 |
|
|
`CALL C_F_PROCPOINTER(cptr, fptr)'
|
4972 |
|
|
|
4973 |
|
|
_Arguments_:
|
4974 |
|
|
CPTR scalar of the type `C_FUNPTR'. It is
|
4975 |
|
|
`INTENT(IN)'.
|
4976 |
|
|
FPTR procedure pointer interoperable with CPTR. It
|
4977 |
|
|
is `INTENT(OUT)'.
|
4978 |
|
|
|
4979 |
|
|
_Example_:
|
4980 |
|
|
program main
|
4981 |
|
|
use iso_c_binding
|
4982 |
|
|
implicit none
|
4983 |
|
|
abstract interface
|
4984 |
|
|
function func(a)
|
4985 |
|
|
import :: c_float
|
4986 |
|
|
real(c_float), intent(in) :: a
|
4987 |
|
|
real(c_float) :: func
|
4988 |
|
|
end function
|
4989 |
|
|
end interface
|
4990 |
|
|
interface
|
4991 |
|
|
function getIterFunc() bind(c,name="getIterFunc")
|
4992 |
|
|
import :: c_funptr
|
4993 |
|
|
type(c_funptr) :: getIterFunc
|
4994 |
|
|
end function
|
4995 |
|
|
end interface
|
4996 |
|
|
type(c_funptr) :: cfunptr
|
4997 |
|
|
procedure(func), pointer :: myFunc
|
4998 |
|
|
cfunptr = getIterFunc()
|
4999 |
|
|
call c_f_procpointer(cfunptr, myFunc)
|
5000 |
|
|
end program main
|
5001 |
|
|
|
5002 |
|
|
_See also_:
|
5003 |
|
|
*note C_LOC::, *note C_F_POINTER::
|
5004 |
|
|
|
5005 |
|
|
|
5006 |
|
|
File: gfortran.info, Node: C_F_POINTER, Next: C_F_PROCPOINTER, Prev: C_ASSOCIATED, Up: Intrinsic Procedures
|
5007 |
|
|
|
5008 |
|
|
8.35 `C_F_POINTER' -- Convert C into Fortran pointer
|
5009 |
|
|
====================================================
|
5010 |
|
|
|
5011 |
|
|
_Description_:
|
5012 |
|
|
`C_F_POINTER(CPTR, FPTR[, SHAPE])' Assign the target the C pointer
|
5013 |
|
|
CPTR to the Fortran pointer FPTR and specify its shape.
|
5014 |
|
|
|
5015 |
|
|
_Standard_:
|
5016 |
|
|
Fortran 2003 and later
|
5017 |
|
|
|
5018 |
|
|
_Class_:
|
5019 |
|
|
Subroutine
|
5020 |
|
|
|
5021 |
|
|
_Syntax_:
|
5022 |
|
|
`CALL C_F_POINTER(CPTR, FPTR[, SHAPE])'
|
5023 |
|
|
|
5024 |
|
|
_Arguments_:
|
5025 |
|
|
CPTR scalar of the type `C_PTR'. It is `INTENT(IN)'.
|
5026 |
|
|
FPTR pointer interoperable with CPTR. It is
|
5027 |
|
|
`INTENT(OUT)'.
|
5028 |
|
|
SHAPE (Optional) Rank-one array of type `INTEGER'
|
5029 |
|
|
with `INTENT(IN)'. It shall be present if and
|
5030 |
|
|
only if FPTR is an array. The size must be
|
5031 |
|
|
equal to the rank of FPTR.
|
5032 |
|
|
|
5033 |
|
|
_Example_:
|
5034 |
|
|
program main
|
5035 |
|
|
use iso_c_binding
|
5036 |
|
|
implicit none
|
5037 |
|
|
interface
|
5038 |
|
|
subroutine my_routine(p) bind(c,name='myC_func')
|
5039 |
|
|
import :: c_ptr
|
5040 |
|
|
type(c_ptr), intent(out) :: p
|
5041 |
|
|
end subroutine
|
5042 |
|
|
end interface
|
5043 |
|
|
type(c_ptr) :: cptr
|
5044 |
|
|
real,pointer :: a(:)
|
5045 |
|
|
call my_routine(cptr)
|
5046 |
|
|
call c_f_pointer(cptr, a, [12])
|
5047 |
|
|
end program main
|
5048 |
|
|
|
5049 |
|
|
_See also_:
|
5050 |
|
|
*note C_LOC::, *note C_F_PROCPOINTER::
|
5051 |
|
|
|
5052 |
|
|
|
5053 |
|
|
File: gfortran.info, Node: C_LOC, Next: C_SIZEOF, Prev: C_FUNLOC, Up: Intrinsic Procedures
|
5054 |
|
|
|
5055 |
|
|
8.36 `C_LOC' -- Obtain the C address of an object
|
5056 |
|
|
=================================================
|
5057 |
|
|
|
5058 |
|
|
_Description_:
|
5059 |
|
|
`C_LOC(X)' determines the C address of the argument.
|
5060 |
|
|
|
5061 |
|
|
_Standard_:
|
5062 |
|
|
Fortran 2003 and later
|
5063 |
|
|
|
5064 |
|
|
_Class_:
|
5065 |
|
|
Inquiry function
|
5066 |
|
|
|
5067 |
|
|
_Syntax_:
|
5068 |
|
|
`RESULT = C_LOC(X)'
|
5069 |
|
|
|
5070 |
|
|
_Arguments_:
|
5071 |
|
|
X Associated scalar pointer or interoperable
|
5072 |
|
|
scalar or allocated allocatable variable with
|
5073 |
|
|
`TARGET' attribute.
|
5074 |
|
|
|
5075 |
|
|
_Return value_:
|
5076 |
|
|
The return value is of type `C_PTR' and contains the C address of
|
5077 |
|
|
the argument.
|
5078 |
|
|
|
5079 |
|
|
_Example_:
|
5080 |
|
|
subroutine association_test(a,b)
|
5081 |
|
|
use iso_c_binding, only: c_associated, c_loc, c_ptr
|
5082 |
|
|
implicit none
|
5083 |
|
|
real, pointer :: a
|
5084 |
|
|
type(c_ptr) :: b
|
5085 |
|
|
if(c_associated(b, c_loc(a))) &
|
5086 |
|
|
stop 'b and a do not point to same target'
|
5087 |
|
|
end subroutine association_test
|
5088 |
|
|
|
5089 |
|
|
_See also_:
|
5090 |
|
|
*note C_ASSOCIATED::, *note C_FUNLOC::, *note C_F_POINTER::, *note
|
5091 |
|
|
C_F_PROCPOINTER::
|
5092 |
|
|
|
5093 |
|
|
|
5094 |
|
|
File: gfortran.info, Node: C_SIZEOF, Next: CEILING, Prev: C_LOC, Up: Intrinsic Procedures
|
5095 |
|
|
|
5096 |
|
|
8.37 `C_SIZEOF' -- Size in bytes of an expression
|
5097 |
|
|
=================================================
|
5098 |
|
|
|
5099 |
|
|
_Description_:
|
5100 |
|
|
`C_SIZEOF(X)' calculates the number of bytes of storage the
|
5101 |
|
|
expression `X' occupies.
|
5102 |
|
|
|
5103 |
|
|
_Standard_:
|
5104 |
|
|
Fortran 2008
|
5105 |
|
|
|
5106 |
|
|
_Class_:
|
5107 |
|
|
Intrinsic function
|
5108 |
|
|
|
5109 |
|
|
_Syntax_:
|
5110 |
|
|
`N = C_SIZEOF(X)'
|
5111 |
|
|
|
5112 |
|
|
_Arguments_:
|
5113 |
|
|
X The argument shall be of any type, rank or
|
5114 |
|
|
shape.
|
5115 |
|
|
|
5116 |
|
|
_Return value_:
|
5117 |
|
|
The return value is of type integer and of the system-dependent
|
5118 |
|
|
kind C_SIZE_T (from the ISO_C_BINDING module). Its value is the
|
5119 |
|
|
number of bytes occupied by the argument. If the argument has the
|
5120 |
|
|
`POINTER' attribute, the number of bytes of the storage area
|
5121 |
|
|
pointed to is returned. If the argument is of a derived type with
|
5122 |
|
|
`POINTER' or `ALLOCATABLE' components, the return value doesn't
|
5123 |
|
|
account for the sizes of the data pointed to by these components.
|
5124 |
|
|
|
5125 |
|
|
_Example_:
|
5126 |
|
|
use iso_c_binding
|
5127 |
|
|
integer(c_int) :: i
|
5128 |
|
|
real(c_float) :: r, s(5)
|
5129 |
|
|
print *, (c_sizeof(s)/c_sizeof(r) == 5)
|
5130 |
|
|
end
|
5131 |
|
|
The example will print `.TRUE.' unless you are using a platform
|
5132 |
|
|
where default `REAL' variables are unusually padded.
|
5133 |
|
|
|
5134 |
|
|
_See also_:
|
5135 |
|
|
*note SIZEOF::
|
5136 |
|
|
|
5137 |
|
|
|
5138 |
|
|
File: gfortran.info, Node: CEILING, Next: CHAR, Prev: C_SIZEOF, Up: Intrinsic Procedures
|
5139 |
|
|
|
5140 |
|
|
8.38 `CEILING' -- Integer ceiling function
|
5141 |
|
|
==========================================
|
5142 |
|
|
|
5143 |
|
|
_Description_:
|
5144 |
|
|
`CEILING(A)' returns the least integer greater than or equal to A.
|
5145 |
|
|
|
5146 |
|
|
_Standard_:
|
5147 |
|
|
Fortran 95 and later
|
5148 |
|
|
|
5149 |
|
|
_Class_:
|
5150 |
|
|
Elemental function
|
5151 |
|
|
|
5152 |
|
|
_Syntax_:
|
5153 |
|
|
`RESULT = CEILING(A [, KIND])'
|
5154 |
|
|
|
5155 |
|
|
_Arguments_:
|
5156 |
|
|
A The type shall be `REAL'.
|
5157 |
|
|
KIND (Optional) An `INTEGER' initialization
|
5158 |
|
|
expression indicating the kind parameter of
|
5159 |
|
|
the result.
|
5160 |
|
|
|
5161 |
|
|
_Return value_:
|
5162 |
|
|
The return value is of type `INTEGER(KIND)' if KIND is present and
|
5163 |
|
|
a default-kind `INTEGER' otherwise.
|
5164 |
|
|
|
5165 |
|
|
_Example_:
|
5166 |
|
|
program test_ceiling
|
5167 |
|
|
real :: x = 63.29
|
5168 |
|
|
real :: y = -63.59
|
5169 |
|
|
print *, ceiling(x) ! returns 64
|
5170 |
|
|
print *, ceiling(y) ! returns -63
|
5171 |
|
|
end program test_ceiling
|
5172 |
|
|
|
5173 |
|
|
_See also_:
|
5174 |
|
|
*note FLOOR::, *note NINT::
|
5175 |
|
|
|
5176 |
|
|
|
5177 |
|
|
|
5178 |
|
|
File: gfortran.info, Node: CHAR, Next: CHDIR, Prev: CEILING, Up: Intrinsic Procedures
|
5179 |
|
|
|
5180 |
|
|
8.39 `CHAR' -- Character conversion function
|
5181 |
|
|
============================================
|
5182 |
|
|
|
5183 |
|
|
_Description_:
|
5184 |
|
|
`CHAR(I [, KIND])' returns the character represented by the
|
5185 |
|
|
integer I.
|
5186 |
|
|
|
5187 |
|
|
_Standard_:
|
5188 |
|
|
Fortran 77 and later
|
5189 |
|
|
|
5190 |
|
|
_Class_:
|
5191 |
|
|
Elemental function
|
5192 |
|
|
|
5193 |
|
|
_Syntax_:
|
5194 |
|
|
`RESULT = CHAR(I [, KIND])'
|
5195 |
|
|
|
5196 |
|
|
_Arguments_:
|
5197 |
|
|
I The type shall be `INTEGER'.
|
5198 |
|
|
KIND (Optional) An `INTEGER' initialization
|
5199 |
|
|
expression indicating the kind parameter of
|
5200 |
|
|
the result.
|
5201 |
|
|
|
5202 |
|
|
_Return value_:
|
5203 |
|
|
The return value is of type `CHARACTER(1)'
|
5204 |
|
|
|
5205 |
|
|
_Example_:
|
5206 |
|
|
program test_char
|
5207 |
|
|
integer :: i = 74
|
5208 |
|
|
character(1) :: c
|
5209 |
|
|
c = char(i)
|
5210 |
|
|
print *, i, c ! returns 'J'
|
5211 |
|
|
end program test_char
|
5212 |
|
|
|
5213 |
|
|
_Note_:
|
5214 |
|
|
See *note ICHAR:: for a discussion of converting between numerical
|
5215 |
|
|
values and formatted string representations.
|
5216 |
|
|
|
5217 |
|
|
_See also_:
|
5218 |
|
|
*note ACHAR::, *note IACHAR::, *note ICHAR::
|
5219 |
|
|
|
5220 |
|
|
|
5221 |
|
|
|
5222 |
|
|
File: gfortran.info, Node: CHDIR, Next: CHMOD, Prev: CHAR, Up: Intrinsic Procedures
|
5223 |
|
|
|
5224 |
|
|
8.40 `CHDIR' -- Change working directory
|
5225 |
|
|
========================================
|
5226 |
|
|
|
5227 |
|
|
_Description_:
|
5228 |
|
|
Change current working directory to a specified path.
|
5229 |
|
|
|
5230 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
5231 |
|
|
however, only one form can be used in any given program unit.
|
5232 |
|
|
|
5233 |
|
|
_Standard_:
|
5234 |
|
|
GNU extension
|
5235 |
|
|
|
5236 |
|
|
_Class_:
|
5237 |
|
|
Subroutine, function
|
5238 |
|
|
|
5239 |
|
|
_Syntax_:
|
5240 |
|
|
`CALL CHDIR(NAME [, STATUS])'
|
5241 |
|
|
`STATUS = CHDIR(NAME)'
|
5242 |
|
|
|
5243 |
|
|
_Arguments_:
|
5244 |
|
|
NAME The type shall be `CHARACTER' of default kind
|
5245 |
|
|
and shall specify a valid path within the file
|
5246 |
|
|
system.
|
5247 |
|
|
STATUS (Optional) `INTEGER' status flag of the default
|
5248 |
|
|
kind. Returns 0 on success, and a system
|
5249 |
|
|
specific and nonzero error code otherwise.
|
5250 |
|
|
|
5251 |
|
|
_Example_:
|
5252 |
|
|
PROGRAM test_chdir
|
5253 |
|
|
CHARACTER(len=255) :: path
|
5254 |
|
|
CALL getcwd(path)
|
5255 |
|
|
WRITE(*,*) TRIM(path)
|
5256 |
|
|
CALL chdir("/tmp")
|
5257 |
|
|
CALL getcwd(path)
|
5258 |
|
|
WRITE(*,*) TRIM(path)
|
5259 |
|
|
END PROGRAM
|
5260 |
|
|
|
5261 |
|
|
_See also_:
|
5262 |
|
|
*note GETCWD::
|
5263 |
|
|
|
5264 |
|
|
|
5265 |
|
|
File: gfortran.info, Node: CHMOD, Next: CMPLX, Prev: CHDIR, Up: Intrinsic Procedures
|
5266 |
|
|
|
5267 |
|
|
8.41 `CHMOD' -- Change access permissions of files
|
5268 |
|
|
==================================================
|
5269 |
|
|
|
5270 |
|
|
_Description_:
|
5271 |
|
|
`CHMOD' changes the permissions of a file. This function invokes
|
5272 |
|
|
`/bin/chmod' and might therefore not work on all platforms.
|
5273 |
|
|
|
5274 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
5275 |
|
|
however, only one form can be used in any given program unit.
|
5276 |
|
|
|
5277 |
|
|
_Standard_:
|
5278 |
|
|
GNU extension
|
5279 |
|
|
|
5280 |
|
|
_Class_:
|
5281 |
|
|
Subroutine, function
|
5282 |
|
|
|
5283 |
|
|
_Syntax_:
|
5284 |
|
|
`CALL CHMOD(NAME, MODE[, STATUS])'
|
5285 |
|
|
`STATUS = CHMOD(NAME, MODE)'
|
5286 |
|
|
|
5287 |
|
|
_Arguments_:
|
5288 |
|
|
NAME Scalar `CHARACTER' of default kind with the
|
5289 |
|
|
file name. Trailing blanks are ignored unless
|
5290 |
|
|
the character `achar(0)' is present, then all
|
5291 |
|
|
characters up to and excluding `achar(0)' are
|
5292 |
|
|
used as the file name.
|
5293 |
|
|
MODE Scalar `CHARACTER' of default kind giving the
|
5294 |
|
|
file permission. MODE uses the same syntax as
|
5295 |
|
|
the MODE argument of `/bin/chmod'.
|
5296 |
|
|
STATUS (optional) scalar `INTEGER', which is `0' on
|
5297 |
|
|
success and nonzero otherwise.
|
5298 |
|
|
|
5299 |
|
|
_Return value_:
|
5300 |
|
|
In either syntax, STATUS is set to `0' on success and nonzero
|
5301 |
|
|
otherwise.
|
5302 |
|
|
|
5303 |
|
|
_Example_:
|
5304 |
|
|
`CHMOD' as subroutine
|
5305 |
|
|
program chmod_test
|
5306 |
|
|
implicit none
|
5307 |
|
|
integer :: status
|
5308 |
|
|
call chmod('test.dat','u+x',status)
|
5309 |
|
|
print *, 'Status: ', status
|
5310 |
|
|
end program chmod_test
|
5311 |
|
|
`CHMOD' as function:
|
5312 |
|
|
program chmod_test
|
5313 |
|
|
implicit none
|
5314 |
|
|
integer :: status
|
5315 |
|
|
status = chmod('test.dat','u+x')
|
5316 |
|
|
print *, 'Status: ', status
|
5317 |
|
|
end program chmod_test
|
5318 |
|
|
|
5319 |
|
|
|
5320 |
|
|
|
5321 |
|
|
File: gfortran.info, Node: CMPLX, Next: COMMAND_ARGUMENT_COUNT, Prev: CHMOD, Up: Intrinsic Procedures
|
5322 |
|
|
|
5323 |
|
|
8.42 `CMPLX' -- Complex conversion function
|
5324 |
|
|
===========================================
|
5325 |
|
|
|
5326 |
|
|
_Description_:
|
5327 |
|
|
`CMPLX(X [, Y [, KIND]])' returns a complex number where X is
|
5328 |
|
|
converted to the real component. If Y is present it is converted
|
5329 |
|
|
to the imaginary component. If Y is not present then the
|
5330 |
|
|
imaginary component is set to 0.0. If X is complex then Y must
|
5331 |
|
|
not be present.
|
5332 |
|
|
|
5333 |
|
|
_Standard_:
|
5334 |
|
|
Fortran 77 and later
|
5335 |
|
|
|
5336 |
|
|
_Class_:
|
5337 |
|
|
Elemental function
|
5338 |
|
|
|
5339 |
|
|
_Syntax_:
|
5340 |
|
|
`RESULT = CMPLX(X [, Y [, KIND]])'
|
5341 |
|
|
|
5342 |
|
|
_Arguments_:
|
5343 |
|
|
X The type may be `INTEGER', `REAL', or
|
5344 |
|
|
`COMPLEX'.
|
5345 |
|
|
Y (Optional; only allowed if X is not
|
5346 |
|
|
`COMPLEX'.) May be `INTEGER' or `REAL'.
|
5347 |
|
|
KIND (Optional) An `INTEGER' initialization
|
5348 |
|
|
expression indicating the kind parameter of
|
5349 |
|
|
the result.
|
5350 |
|
|
|
5351 |
|
|
_Return value_:
|
5352 |
|
|
The return value is of `COMPLEX' type, with a kind equal to KIND
|
5353 |
|
|
if it is specified. If KIND is not specified, the result is of
|
5354 |
|
|
the default `COMPLEX' kind, regardless of the kinds of X and Y.
|
5355 |
|
|
|
5356 |
|
|
_Example_:
|
5357 |
|
|
program test_cmplx
|
5358 |
|
|
integer :: i = 42
|
5359 |
|
|
real :: x = 3.14
|
5360 |
|
|
complex :: z
|
5361 |
|
|
z = cmplx(i, x)
|
5362 |
|
|
print *, z, cmplx(x)
|
5363 |
|
|
end program test_cmplx
|
5364 |
|
|
|
5365 |
|
|
_See also_:
|
5366 |
|
|
*note COMPLEX::
|
5367 |
|
|
|
5368 |
|
|
|
5369 |
|
|
File: gfortran.info, Node: COMMAND_ARGUMENT_COUNT, Next: COMPLEX, Prev: CMPLX, Up: Intrinsic Procedures
|
5370 |
|
|
|
5371 |
|
|
8.43 `COMMAND_ARGUMENT_COUNT' -- Get number of command line arguments
|
5372 |
|
|
=====================================================================
|
5373 |
|
|
|
5374 |
|
|
_Description_:
|
5375 |
|
|
`COMMAND_ARGUMENT_COUNT()' returns the number of arguments passed
|
5376 |
|
|
on the command line when the containing program was invoked.
|
5377 |
|
|
|
5378 |
|
|
_Standard_:
|
5379 |
|
|
Fortran 2003 and later
|
5380 |
|
|
|
5381 |
|
|
_Class_:
|
5382 |
|
|
Inquiry function
|
5383 |
|
|
|
5384 |
|
|
_Syntax_:
|
5385 |
|
|
`RESULT = COMMAND_ARGUMENT_COUNT()'
|
5386 |
|
|
|
5387 |
|
|
_Arguments_:
|
5388 |
|
|
None
|
5389 |
|
|
|
5390 |
|
|
_Return value_:
|
5391 |
|
|
The return value is an `INTEGER' of default kind.
|
5392 |
|
|
|
5393 |
|
|
_Example_:
|
5394 |
|
|
program test_command_argument_count
|
5395 |
|
|
integer :: count
|
5396 |
|
|
count = command_argument_count()
|
5397 |
|
|
print *, count
|
5398 |
|
|
end program test_command_argument_count
|
5399 |
|
|
|
5400 |
|
|
_See also_:
|
5401 |
|
|
*note GET_COMMAND::, *note GET_COMMAND_ARGUMENT::
|
5402 |
|
|
|
5403 |
|
|
|
5404 |
|
|
File: gfortran.info, Node: COMPLEX, Next: CONJG, Prev: COMMAND_ARGUMENT_COUNT, Up: Intrinsic Procedures
|
5405 |
|
|
|
5406 |
|
|
8.44 `COMPLEX' -- Complex conversion function
|
5407 |
|
|
=============================================
|
5408 |
|
|
|
5409 |
|
|
_Description_:
|
5410 |
|
|
`COMPLEX(X, Y)' returns a complex number where X is converted to
|
5411 |
|
|
the real component and Y is converted to the imaginary component.
|
5412 |
|
|
|
5413 |
|
|
_Standard_:
|
5414 |
|
|
GNU extension
|
5415 |
|
|
|
5416 |
|
|
_Class_:
|
5417 |
|
|
Elemental function
|
5418 |
|
|
|
5419 |
|
|
_Syntax_:
|
5420 |
|
|
`RESULT = COMPLEX(X, Y)'
|
5421 |
|
|
|
5422 |
|
|
_Arguments_:
|
5423 |
|
|
X The type may be `INTEGER' or `REAL'.
|
5424 |
|
|
Y The type may be `INTEGER' or `REAL'.
|
5425 |
|
|
|
5426 |
|
|
_Return value_:
|
5427 |
|
|
If X and Y are both of `INTEGER' type, then the return value is of
|
5428 |
|
|
default `COMPLEX' type.
|
5429 |
|
|
|
5430 |
|
|
If X and Y are of `REAL' type, or one is of `REAL' type and one is
|
5431 |
|
|
of `INTEGER' type, then the return value is of `COMPLEX' type with
|
5432 |
|
|
a kind equal to that of the `REAL' argument with the highest
|
5433 |
|
|
precision.
|
5434 |
|
|
|
5435 |
|
|
_Example_:
|
5436 |
|
|
program test_complex
|
5437 |
|
|
integer :: i = 42
|
5438 |
|
|
real :: x = 3.14
|
5439 |
|
|
print *, complex(i, x)
|
5440 |
|
|
end program test_complex
|
5441 |
|
|
|
5442 |
|
|
_See also_:
|
5443 |
|
|
*note CMPLX::
|
5444 |
|
|
|
5445 |
|
|
|
5446 |
|
|
File: gfortran.info, Node: CONJG, Next: COS, Prev: COMPLEX, Up: Intrinsic Procedures
|
5447 |
|
|
|
5448 |
|
|
8.45 `CONJG' -- Complex conjugate function
|
5449 |
|
|
==========================================
|
5450 |
|
|
|
5451 |
|
|
_Description_:
|
5452 |
|
|
`CONJG(Z)' returns the conjugate of Z. If Z is `(x, y)' then the
|
5453 |
|
|
result is `(x, -y)'
|
5454 |
|
|
|
5455 |
|
|
_Standard_:
|
5456 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
5457 |
|
|
|
5458 |
|
|
_Class_:
|
5459 |
|
|
Elemental function
|
5460 |
|
|
|
5461 |
|
|
_Syntax_:
|
5462 |
|
|
`Z = CONJG(Z)'
|
5463 |
|
|
|
5464 |
|
|
_Arguments_:
|
5465 |
|
|
Z The type shall be `COMPLEX'.
|
5466 |
|
|
|
5467 |
|
|
_Return value_:
|
5468 |
|
|
The return value is of type `COMPLEX'.
|
5469 |
|
|
|
5470 |
|
|
_Example_:
|
5471 |
|
|
program test_conjg
|
5472 |
|
|
complex :: z = (2.0, 3.0)
|
5473 |
|
|
complex(8) :: dz = (2.71_8, -3.14_8)
|
5474 |
|
|
z= conjg(z)
|
5475 |
|
|
print *, z
|
5476 |
|
|
dz = dconjg(dz)
|
5477 |
|
|
print *, dz
|
5478 |
|
|
end program test_conjg
|
5479 |
|
|
|
5480 |
|
|
_Specific names_:
|
5481 |
|
|
Name Argument Return type Standard
|
5482 |
|
|
`DCONJG(Z)' `COMPLEX(8) `COMPLEX(8)' GNU extension
|
5483 |
|
|
Z'
|
5484 |
|
|
|
5485 |
|
|
|
5486 |
|
|
File: gfortran.info, Node: COS, Next: COSH, Prev: CONJG, Up: Intrinsic Procedures
|
5487 |
|
|
|
5488 |
|
|
8.46 `COS' -- Cosine function
|
5489 |
|
|
=============================
|
5490 |
|
|
|
5491 |
|
|
_Description_:
|
5492 |
|
|
`COS(X)' computes the cosine of X.
|
5493 |
|
|
|
5494 |
|
|
_Standard_:
|
5495 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
5496 |
|
|
|
5497 |
|
|
_Class_:
|
5498 |
|
|
Elemental function
|
5499 |
|
|
|
5500 |
|
|
_Syntax_:
|
5501 |
|
|
`RESULT = COS(X)'
|
5502 |
|
|
|
5503 |
|
|
_Arguments_:
|
5504 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
5505 |
|
|
|
5506 |
|
|
_Return value_:
|
5507 |
|
|
The return value is of the same type and kind as X. The real part
|
5508 |
|
|
of the result is in radians. If X is of the type `REAL', the
|
5509 |
|
|
return value lies in the range -1 \leq \cos (x) \leq 1.
|
5510 |
|
|
|
5511 |
|
|
_Example_:
|
5512 |
|
|
program test_cos
|
5513 |
|
|
real :: x = 0.0
|
5514 |
|
|
x = cos(x)
|
5515 |
|
|
end program test_cos
|
5516 |
|
|
|
5517 |
|
|
_Specific names_:
|
5518 |
|
|
Name Argument Return type Standard
|
5519 |
|
|
`DCOS(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
|
5520 |
|
|
later
|
5521 |
|
|
`CCOS(X)' `COMPLEX(4) `COMPLEX(4)' Fortran 77 and
|
5522 |
|
|
X' later
|
5523 |
|
|
`ZCOS(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
|
5524 |
|
|
X'
|
5525 |
|
|
`CDCOS(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
|
5526 |
|
|
X'
|
5527 |
|
|
|
5528 |
|
|
_See also_:
|
5529 |
|
|
Inverse function: *note ACOS::
|
5530 |
|
|
|
5531 |
|
|
|
5532 |
|
|
|
5533 |
|
|
File: gfortran.info, Node: COSH, Next: COUNT, Prev: COS, Up: Intrinsic Procedures
|
5534 |
|
|
|
5535 |
|
|
8.47 `COSH' -- Hyperbolic cosine function
|
5536 |
|
|
=========================================
|
5537 |
|
|
|
5538 |
|
|
_Description_:
|
5539 |
|
|
`COSH(X)' computes the hyperbolic cosine of X.
|
5540 |
|
|
|
5541 |
|
|
_Standard_:
|
5542 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
5543 |
|
|
|
5544 |
|
|
_Class_:
|
5545 |
|
|
Elemental function
|
5546 |
|
|
|
5547 |
|
|
_Syntax_:
|
5548 |
|
|
`X = COSH(X)'
|
5549 |
|
|
|
5550 |
|
|
_Arguments_:
|
5551 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
5552 |
|
|
|
5553 |
|
|
_Return value_:
|
5554 |
|
|
The return value has same type and kind as X. If X is complex, the
|
5555 |
|
|
imaginary part of the result is in radians. If X is `REAL', the
|
5556 |
|
|
return value has a lower bound of one, \cosh (x) \geq 1.
|
5557 |
|
|
|
5558 |
|
|
_Example_:
|
5559 |
|
|
program test_cosh
|
5560 |
|
|
real(8) :: x = 1.0_8
|
5561 |
|
|
x = cosh(x)
|
5562 |
|
|
end program test_cosh
|
5563 |
|
|
|
5564 |
|
|
_Specific names_:
|
5565 |
|
|
Name Argument Return type Standard
|
5566 |
|
|
`DCOSH(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
|
5567 |
|
|
later
|
5568 |
|
|
|
5569 |
|
|
_See also_:
|
5570 |
|
|
Inverse function: *note ACOSH::
|
5571 |
|
|
|
5572 |
|
|
|
5573 |
|
|
|
5574 |
|
|
File: gfortran.info, Node: COUNT, Next: CPU_TIME, Prev: COSH, Up: Intrinsic Procedures
|
5575 |
|
|
|
5576 |
|
|
8.48 `COUNT' -- Count function
|
5577 |
|
|
==============================
|
5578 |
|
|
|
5579 |
|
|
_Description_:
|
5580 |
|
|
Counts the number of `.TRUE.' elements in a logical MASK, or, if
|
5581 |
|
|
the DIM argument is supplied, counts the number of elements along
|
5582 |
|
|
each row of the array in the DIM direction. If the array has zero
|
5583 |
|
|
size, or all of the elements of MASK are `.FALSE.', then the
|
5584 |
|
|
result is `0'.
|
5585 |
|
|
|
5586 |
|
|
_Standard_:
|
5587 |
|
|
Fortran 95 and later, with KIND argument Fortran 2003 and later
|
5588 |
|
|
|
5589 |
|
|
_Class_:
|
5590 |
|
|
Transformational function
|
5591 |
|
|
|
5592 |
|
|
_Syntax_:
|
5593 |
|
|
`RESULT = COUNT(MASK [, DIM, KIND])'
|
5594 |
|
|
|
5595 |
|
|
_Arguments_:
|
5596 |
|
|
MASK The type shall be `LOGICAL'.
|
5597 |
|
|
DIM (Optional) The type shall be `INTEGER'.
|
5598 |
|
|
KIND (Optional) An `INTEGER' initialization
|
5599 |
|
|
expression indicating the kind parameter of
|
5600 |
|
|
the result.
|
5601 |
|
|
|
5602 |
|
|
_Return value_:
|
5603 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
5604 |
|
|
absent, the return value is of default integer kind. If DIM is
|
5605 |
|
|
present, the result is an array with a rank one less than the rank
|
5606 |
|
|
of ARRAY, and a size corresponding to the shape of ARRAY with the
|
5607 |
|
|
DIM dimension removed.
|
5608 |
|
|
|
5609 |
|
|
_Example_:
|
5610 |
|
|
program test_count
|
5611 |
|
|
integer, dimension(2,3) :: a, b
|
5612 |
|
|
logical, dimension(2,3) :: mask
|
5613 |
|
|
a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
|
5614 |
|
|
b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
|
5615 |
|
|
print '(3i3)', a(1,:)
|
5616 |
|
|
print '(3i3)', a(2,:)
|
5617 |
|
|
print *
|
5618 |
|
|
print '(3i3)', b(1,:)
|
5619 |
|
|
print '(3i3)', b(2,:)
|
5620 |
|
|
print *
|
5621 |
|
|
mask = a.ne.b
|
5622 |
|
|
print '(3l3)', mask(1,:)
|
5623 |
|
|
print '(3l3)', mask(2,:)
|
5624 |
|
|
print *
|
5625 |
|
|
print '(3i3)', count(mask)
|
5626 |
|
|
print *
|
5627 |
|
|
print '(3i3)', count(mask, 1)
|
5628 |
|
|
print *
|
5629 |
|
|
print '(3i3)', count(mask, 2)
|
5630 |
|
|
end program test_count
|
5631 |
|
|
|
5632 |
|
|
|
5633 |
|
|
File: gfortran.info, Node: CPU_TIME, Next: CSHIFT, Prev: COUNT, Up: Intrinsic Procedures
|
5634 |
|
|
|
5635 |
|
|
8.49 `CPU_TIME' -- CPU elapsed time in seconds
|
5636 |
|
|
==============================================
|
5637 |
|
|
|
5638 |
|
|
_Description_:
|
5639 |
|
|
Returns a `REAL' value representing the elapsed CPU time in
|
5640 |
|
|
seconds. This is useful for testing segments of code to determine
|
5641 |
|
|
execution time.
|
5642 |
|
|
|
5643 |
|
|
If a time source is available, time will be reported with
|
5644 |
|
|
microsecond resolution. If no time source is available, TIME is
|
5645 |
|
|
set to `-1.0'.
|
5646 |
|
|
|
5647 |
|
|
Note that TIME may contain a, system dependent, arbitrary offset
|
5648 |
|
|
and may not start with `0.0'. For `CPU_TIME', the absolute value
|
5649 |
|
|
is meaningless, only differences between subsequent calls to this
|
5650 |
|
|
subroutine, as shown in the example below, should be used.
|
5651 |
|
|
|
5652 |
|
|
_Standard_:
|
5653 |
|
|
Fortran 95 and later
|
5654 |
|
|
|
5655 |
|
|
_Class_:
|
5656 |
|
|
Subroutine
|
5657 |
|
|
|
5658 |
|
|
_Syntax_:
|
5659 |
|
|
`CALL CPU_TIME(TIME)'
|
5660 |
|
|
|
5661 |
|
|
_Arguments_:
|
5662 |
|
|
TIME The type shall be `REAL' with `INTENT(OUT)'.
|
5663 |
|
|
|
5664 |
|
|
_Return value_:
|
5665 |
|
|
None
|
5666 |
|
|
|
5667 |
|
|
_Example_:
|
5668 |
|
|
program test_cpu_time
|
5669 |
|
|
real :: start, finish
|
5670 |
|
|
call cpu_time(start)
|
5671 |
|
|
! put code to test here
|
5672 |
|
|
call cpu_time(finish)
|
5673 |
|
|
print '("Time = ",f6.3," seconds.")',finish-start
|
5674 |
|
|
end program test_cpu_time
|
5675 |
|
|
|
5676 |
|
|
_See also_:
|
5677 |
|
|
*note SYSTEM_CLOCK::, *note DATE_AND_TIME::
|
5678 |
|
|
|
5679 |
|
|
|
5680 |
|
|
File: gfortran.info, Node: CSHIFT, Next: CTIME, Prev: CPU_TIME, Up: Intrinsic Procedures
|
5681 |
|
|
|
5682 |
|
|
8.50 `CSHIFT' -- Circular shift elements of an array
|
5683 |
|
|
====================================================
|
5684 |
|
|
|
5685 |
|
|
_Description_:
|
5686 |
|
|
`CSHIFT(ARRAY, SHIFT [, DIM])' performs a circular shift on
|
5687 |
|
|
elements of ARRAY along the dimension of DIM. If DIM is omitted
|
5688 |
|
|
it is taken to be `1'. DIM is a scalar of type `INTEGER' in the
|
5689 |
|
|
range of 1 \leq DIM \leq n) where n is the rank of ARRAY. If the
|
5690 |
|
|
rank of ARRAY is one, then all elements of ARRAY are shifted by
|
5691 |
|
|
SHIFT places. If rank is greater than one, then all complete rank
|
5692 |
|
|
one sections of ARRAY along the given dimension are shifted.
|
5693 |
|
|
Elements shifted out one end of each rank one section are shifted
|
5694 |
|
|
back in the other end.
|
5695 |
|
|
|
5696 |
|
|
_Standard_:
|
5697 |
|
|
Fortran 95 and later
|
5698 |
|
|
|
5699 |
|
|
_Class_:
|
5700 |
|
|
Transformational function
|
5701 |
|
|
|
5702 |
|
|
_Syntax_:
|
5703 |
|
|
`RESULT = CSHIFT(ARRAY, SHIFT [, DIM])'
|
5704 |
|
|
|
5705 |
|
|
_Arguments_:
|
5706 |
|
|
ARRAY Shall be an array of any type.
|
5707 |
|
|
SHIFT The type shall be `INTEGER'.
|
5708 |
|
|
DIM The type shall be `INTEGER'.
|
5709 |
|
|
|
5710 |
|
|
_Return value_:
|
5711 |
|
|
Returns an array of same type and rank as the ARRAY argument.
|
5712 |
|
|
|
5713 |
|
|
_Example_:
|
5714 |
|
|
program test_cshift
|
5715 |
|
|
integer, dimension(3,3) :: a
|
5716 |
|
|
a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
|
5717 |
|
|
print '(3i3)', a(1,:)
|
5718 |
|
|
print '(3i3)', a(2,:)
|
5719 |
|
|
print '(3i3)', a(3,:)
|
5720 |
|
|
a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
|
5721 |
|
|
print *
|
5722 |
|
|
print '(3i3)', a(1,:)
|
5723 |
|
|
print '(3i3)', a(2,:)
|
5724 |
|
|
print '(3i3)', a(3,:)
|
5725 |
|
|
end program test_cshift
|
5726 |
|
|
|
5727 |
|
|
|
5728 |
|
|
File: gfortran.info, Node: CTIME, Next: DATE_AND_TIME, Prev: CSHIFT, Up: Intrinsic Procedures
|
5729 |
|
|
|
5730 |
|
|
8.51 `CTIME' -- Convert a time into a string
|
5731 |
|
|
============================================
|
5732 |
|
|
|
5733 |
|
|
_Description_:
|
5734 |
|
|
`CTIME' converts a system time value, such as returned by
|
5735 |
|
|
`TIME8()', to a string of the form `Sat Aug 19 18:13:14 1995'.
|
5736 |
|
|
|
5737 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
5738 |
|
|
however, only one form can be used in any given program unit.
|
5739 |
|
|
|
5740 |
|
|
_Standard_:
|
5741 |
|
|
GNU extension
|
5742 |
|
|
|
5743 |
|
|
_Class_:
|
5744 |
|
|
Subroutine, function
|
5745 |
|
|
|
5746 |
|
|
_Syntax_:
|
5747 |
|
|
`CALL CTIME(TIME, RESULT)'.
|
5748 |
|
|
`RESULT = CTIME(TIME)', (not recommended).
|
5749 |
|
|
|
5750 |
|
|
_Arguments_:
|
5751 |
|
|
TIME The type shall be of type `INTEGER(KIND=8)'.
|
5752 |
|
|
RESULT The type shall be of type `CHARACTER' and of
|
5753 |
|
|
default kind.
|
5754 |
|
|
|
5755 |
|
|
_Return value_:
|
5756 |
|
|
The converted date and time as a string.
|
5757 |
|
|
|
5758 |
|
|
_Example_:
|
5759 |
|
|
program test_ctime
|
5760 |
|
|
integer(8) :: i
|
5761 |
|
|
character(len=30) :: date
|
5762 |
|
|
i = time8()
|
5763 |
|
|
|
5764 |
|
|
! Do something, main part of the program
|
5765 |
|
|
|
5766 |
|
|
call ctime(i,date)
|
5767 |
|
|
print *, 'Program was started on ', date
|
5768 |
|
|
end program test_ctime
|
5769 |
|
|
|
5770 |
|
|
_See Also_:
|
5771 |
|
|
*note GMTIME::, *note LTIME::, *note TIME::, *note TIME8::
|
5772 |
|
|
|
5773 |
|
|
|
5774 |
|
|
File: gfortran.info, Node: DATE_AND_TIME, Next: DBLE, Prev: CTIME, Up: Intrinsic Procedures
|
5775 |
|
|
|
5776 |
|
|
8.52 `DATE_AND_TIME' -- Date and time subroutine
|
5777 |
|
|
================================================
|
5778 |
|
|
|
5779 |
|
|
_Description_:
|
5780 |
|
|
`DATE_AND_TIME(DATE, TIME, ZONE, VALUES)' gets the corresponding
|
5781 |
|
|
date and time information from the real-time system clock. DATE is
|
5782 |
|
|
`INTENT(OUT)' and has form ccyymmdd. TIME is `INTENT(OUT)' and
|
5783 |
|
|
has form hhmmss.sss. ZONE is `INTENT(OUT)' and has form (+-)hhmm,
|
5784 |
|
|
representing the difference with respect to Coordinated Universal
|
5785 |
|
|
Time (UTC). Unavailable time and date parameters return blanks.
|
5786 |
|
|
|
5787 |
|
|
VALUES is `INTENT(OUT)' and provides the following:
|
5788 |
|
|
|
5789 |
|
|
`VALUE(1)': The year
|
5790 |
|
|
`VALUE(2)': The month
|
5791 |
|
|
`VALUE(3)': The day of the month
|
5792 |
|
|
`VALUE(4)': Time difference with UTC
|
5793 |
|
|
in minutes
|
5794 |
|
|
`VALUE(5)': The hour of the day
|
5795 |
|
|
`VALUE(6)': The minutes of the hour
|
5796 |
|
|
`VALUE(7)': The seconds of the minute
|
5797 |
|
|
`VALUE(8)': The milliseconds of the
|
5798 |
|
|
second
|
5799 |
|
|
|
5800 |
|
|
_Standard_:
|
5801 |
|
|
Fortran 95 and later
|
5802 |
|
|
|
5803 |
|
|
_Class_:
|
5804 |
|
|
Subroutine
|
5805 |
|
|
|
5806 |
|
|
_Syntax_:
|
5807 |
|
|
`CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])'
|
5808 |
|
|
|
5809 |
|
|
_Arguments_:
|
5810 |
|
|
DATE (Optional) The type shall be `CHARACTER(LEN=8)'
|
5811 |
|
|
or larger, and of default kind.
|
5812 |
|
|
TIME (Optional) The type shall be
|
5813 |
|
|
`CHARACTER(LEN=10)' or larger, and of default
|
5814 |
|
|
kind.
|
5815 |
|
|
ZONE (Optional) The type shall be `CHARACTER(LEN=5)'
|
5816 |
|
|
or larger, and of default kind.
|
5817 |
|
|
VALUES (Optional) The type shall be `INTEGER(8)'.
|
5818 |
|
|
|
5819 |
|
|
_Return value_:
|
5820 |
|
|
None
|
5821 |
|
|
|
5822 |
|
|
_Example_:
|
5823 |
|
|
program test_time_and_date
|
5824 |
|
|
character(8) :: date
|
5825 |
|
|
character(10) :: time
|
5826 |
|
|
character(5) :: zone
|
5827 |
|
|
integer,dimension(8) :: values
|
5828 |
|
|
! using keyword arguments
|
5829 |
|
|
call date_and_time(date,time,zone,values)
|
5830 |
|
|
call date_and_time(DATE=date,ZONE=zone)
|
5831 |
|
|
call date_and_time(TIME=time)
|
5832 |
|
|
call date_and_time(VALUES=values)
|
5833 |
|
|
print '(a,2x,a,2x,a)', date, time, zone
|
5834 |
|
|
print '(8i5))', values
|
5835 |
|
|
end program test_time_and_date
|
5836 |
|
|
|
5837 |
|
|
_See also_:
|
5838 |
|
|
*note CPU_TIME::, *note SYSTEM_CLOCK::
|
5839 |
|
|
|
5840 |
|
|
|
5841 |
|
|
File: gfortran.info, Node: DBLE, Next: DCMPLX, Prev: DATE_AND_TIME, Up: Intrinsic Procedures
|
5842 |
|
|
|
5843 |
|
|
8.53 `DBLE' -- Double conversion function
|
5844 |
|
|
=========================================
|
5845 |
|
|
|
5846 |
|
|
_Description_:
|
5847 |
|
|
`DBLE(A)' Converts A to double precision real type.
|
5848 |
|
|
|
5849 |
|
|
_Standard_:
|
5850 |
|
|
Fortran 77 and later
|
5851 |
|
|
|
5852 |
|
|
_Class_:
|
5853 |
|
|
Elemental function
|
5854 |
|
|
|
5855 |
|
|
_Syntax_:
|
5856 |
|
|
`RESULT = DBLE(A)'
|
5857 |
|
|
|
5858 |
|
|
_Arguments_:
|
5859 |
|
|
A The type shall be `INTEGER', `REAL', or
|
5860 |
|
|
`COMPLEX'.
|
5861 |
|
|
|
5862 |
|
|
_Return value_:
|
5863 |
|
|
The return value is of type double precision real.
|
5864 |
|
|
|
5865 |
|
|
_Example_:
|
5866 |
|
|
program test_dble
|
5867 |
|
|
real :: x = 2.18
|
5868 |
|
|
integer :: i = 5
|
5869 |
|
|
complex :: z = (2.3,1.14)
|
5870 |
|
|
print *, dble(x), dble(i), dble(z)
|
5871 |
|
|
end program test_dble
|
5872 |
|
|
|
5873 |
|
|
_See also_:
|
5874 |
|
|
*note DFLOAT::, *note FLOAT::, *note REAL::
|
5875 |
|
|
|
5876 |
|
|
|
5877 |
|
|
File: gfortran.info, Node: DCMPLX, Next: DFLOAT, Prev: DBLE, Up: Intrinsic Procedures
|
5878 |
|
|
|
5879 |
|
|
8.54 `DCMPLX' -- Double complex conversion function
|
5880 |
|
|
===================================================
|
5881 |
|
|
|
5882 |
|
|
_Description_:
|
5883 |
|
|
`DCMPLX(X [,Y])' returns a double complex number where X is
|
5884 |
|
|
converted to the real component. If Y is present it is converted
|
5885 |
|
|
to the imaginary component. If Y is not present then the
|
5886 |
|
|
imaginary component is set to 0.0. If X is complex then Y must
|
5887 |
|
|
not be present.
|
5888 |
|
|
|
5889 |
|
|
_Standard_:
|
5890 |
|
|
GNU extension
|
5891 |
|
|
|
5892 |
|
|
_Class_:
|
5893 |
|
|
Elemental function
|
5894 |
|
|
|
5895 |
|
|
_Syntax_:
|
5896 |
|
|
`RESULT = DCMPLX(X [, Y])'
|
5897 |
|
|
|
5898 |
|
|
_Arguments_:
|
5899 |
|
|
X The type may be `INTEGER', `REAL', or
|
5900 |
|
|
`COMPLEX'.
|
5901 |
|
|
Y (Optional if X is not `COMPLEX'.) May be
|
5902 |
|
|
`INTEGER' or `REAL'.
|
5903 |
|
|
|
5904 |
|
|
_Return value_:
|
5905 |
|
|
The return value is of type `COMPLEX(8)'
|
5906 |
|
|
|
5907 |
|
|
_Example_:
|
5908 |
|
|
program test_dcmplx
|
5909 |
|
|
integer :: i = 42
|
5910 |
|
|
real :: x = 3.14
|
5911 |
|
|
complex :: z
|
5912 |
|
|
z = cmplx(i, x)
|
5913 |
|
|
print *, dcmplx(i)
|
5914 |
|
|
print *, dcmplx(x)
|
5915 |
|
|
print *, dcmplx(z)
|
5916 |
|
|
print *, dcmplx(x,i)
|
5917 |
|
|
end program test_dcmplx
|
5918 |
|
|
|
5919 |
|
|
|
5920 |
|
|
File: gfortran.info, Node: DFLOAT, Next: DIGITS, Prev: DCMPLX, Up: Intrinsic Procedures
|
5921 |
|
|
|
5922 |
|
|
8.55 `DFLOAT' -- Double conversion function
|
5923 |
|
|
===========================================
|
5924 |
|
|
|
5925 |
|
|
_Description_:
|
5926 |
|
|
`DFLOAT(A)' Converts A to double precision real type.
|
5927 |
|
|
|
5928 |
|
|
_Standard_:
|
5929 |
|
|
GNU extension
|
5930 |
|
|
|
5931 |
|
|
_Class_:
|
5932 |
|
|
Elemental function
|
5933 |
|
|
|
5934 |
|
|
_Syntax_:
|
5935 |
|
|
`RESULT = DFLOAT(A)'
|
5936 |
|
|
|
5937 |
|
|
_Arguments_:
|
5938 |
|
|
A The type shall be `INTEGER'.
|
5939 |
|
|
|
5940 |
|
|
_Return value_:
|
5941 |
|
|
The return value is of type double precision real.
|
5942 |
|
|
|
5943 |
|
|
_Example_:
|
5944 |
|
|
program test_dfloat
|
5945 |
|
|
integer :: i = 5
|
5946 |
|
|
print *, dfloat(i)
|
5947 |
|
|
end program test_dfloat
|
5948 |
|
|
|
5949 |
|
|
_See also_:
|
5950 |
|
|
*note DBLE::, *note FLOAT::, *note REAL::
|
5951 |
|
|
|
5952 |
|
|
|
5953 |
|
|
File: gfortran.info, Node: DIGITS, Next: DIM, Prev: DFLOAT, Up: Intrinsic Procedures
|
5954 |
|
|
|
5955 |
|
|
8.56 `DIGITS' -- Significant binary digits function
|
5956 |
|
|
===================================================
|
5957 |
|
|
|
5958 |
|
|
_Description_:
|
5959 |
|
|
`DIGITS(X)' returns the number of significant binary digits of the
|
5960 |
|
|
internal model representation of X. For example, on a system
|
5961 |
|
|
using a 32-bit floating point representation, a default real
|
5962 |
|
|
number would likely return 24.
|
5963 |
|
|
|
5964 |
|
|
_Standard_:
|
5965 |
|
|
Fortran 95 and later
|
5966 |
|
|
|
5967 |
|
|
_Class_:
|
5968 |
|
|
Inquiry function
|
5969 |
|
|
|
5970 |
|
|
_Syntax_:
|
5971 |
|
|
`RESULT = DIGITS(X)'
|
5972 |
|
|
|
5973 |
|
|
_Arguments_:
|
5974 |
|
|
X The type may be `INTEGER' or `REAL'.
|
5975 |
|
|
|
5976 |
|
|
_Return value_:
|
5977 |
|
|
The return value is of type `INTEGER'.
|
5978 |
|
|
|
5979 |
|
|
_Example_:
|
5980 |
|
|
program test_digits
|
5981 |
|
|
integer :: i = 12345
|
5982 |
|
|
real :: x = 3.143
|
5983 |
|
|
real(8) :: y = 2.33
|
5984 |
|
|
print *, digits(i)
|
5985 |
|
|
print *, digits(x)
|
5986 |
|
|
print *, digits(y)
|
5987 |
|
|
end program test_digits
|
5988 |
|
|
|
5989 |
|
|
|
5990 |
|
|
File: gfortran.info, Node: DIM, Next: DOT_PRODUCT, Prev: DIGITS, Up: Intrinsic Procedures
|
5991 |
|
|
|
5992 |
|
|
8.57 `DIM' -- Positive difference
|
5993 |
|
|
=================================
|
5994 |
|
|
|
5995 |
|
|
_Description_:
|
5996 |
|
|
`DIM(X,Y)' returns the difference `X-Y' if the result is positive;
|
5997 |
|
|
otherwise returns zero.
|
5998 |
|
|
|
5999 |
|
|
_Standard_:
|
6000 |
|
|
Fortran 77 and later
|
6001 |
|
|
|
6002 |
|
|
_Class_:
|
6003 |
|
|
Elemental function
|
6004 |
|
|
|
6005 |
|
|
_Syntax_:
|
6006 |
|
|
`RESULT = DIM(X, Y)'
|
6007 |
|
|
|
6008 |
|
|
_Arguments_:
|
6009 |
|
|
X The type shall be `INTEGER' or `REAL'
|
6010 |
|
|
Y The type shall be the same type and kind as X.
|
6011 |
|
|
|
6012 |
|
|
_Return value_:
|
6013 |
|
|
The return value is of type `INTEGER' or `REAL'.
|
6014 |
|
|
|
6015 |
|
|
_Example_:
|
6016 |
|
|
program test_dim
|
6017 |
|
|
integer :: i
|
6018 |
|
|
real(8) :: x
|
6019 |
|
|
i = dim(4, 15)
|
6020 |
|
|
x = dim(4.345_8, 2.111_8)
|
6021 |
|
|
print *, i
|
6022 |
|
|
print *, x
|
6023 |
|
|
end program test_dim
|
6024 |
|
|
|
6025 |
|
|
_Specific names_:
|
6026 |
|
|
Name Argument Return type Standard
|
6027 |
|
|
`IDIM(X,Y)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
|
6028 |
|
|
X,Y' later
|
6029 |
|
|
`DDIM(X,Y)' `REAL(8) `REAL(8)' Fortran 77 and
|
6030 |
|
|
X,Y' later
|
6031 |
|
|
|
6032 |
|
|
|
6033 |
|
|
File: gfortran.info, Node: DOT_PRODUCT, Next: DPROD, Prev: DIM, Up: Intrinsic Procedures
|
6034 |
|
|
|
6035 |
|
|
8.58 `DOT_PRODUCT' -- Dot product function
|
6036 |
|
|
==========================================
|
6037 |
|
|
|
6038 |
|
|
_Description_:
|
6039 |
|
|
`DOT_PRODUCT(VECTOR_A, VECTOR_B)' computes the dot product
|
6040 |
|
|
multiplication of two vectors VECTOR_A and VECTOR_B. The two
|
6041 |
|
|
vectors may be either numeric or logical and must be arrays of
|
6042 |
|
|
rank one and of equal size. If the vectors are `INTEGER' or
|
6043 |
|
|
`REAL', the result is `SUM(VECTOR_A*VECTOR_B)'. If the vectors are
|
6044 |
|
|
`COMPLEX', the result is `SUM(CONJG(VECTOR_A)*VECTOR_B)'. If the
|
6045 |
|
|
vectors are `LOGICAL', the result is `ANY(VECTOR_A .AND.
|
6046 |
|
|
VECTOR_B)'.
|
6047 |
|
|
|
6048 |
|
|
_Standard_:
|
6049 |
|
|
Fortran 95 and later
|
6050 |
|
|
|
6051 |
|
|
_Class_:
|
6052 |
|
|
Transformational function
|
6053 |
|
|
|
6054 |
|
|
_Syntax_:
|
6055 |
|
|
`RESULT = DOT_PRODUCT(VECTOR_A, VECTOR_B)'
|
6056 |
|
|
|
6057 |
|
|
_Arguments_:
|
6058 |
|
|
VECTOR_A The type shall be numeric or `LOGICAL', rank 1.
|
6059 |
|
|
VECTOR_B The type shall be numeric if VECTOR_A is of
|
6060 |
|
|
numeric type or `LOGICAL' if VECTOR_A is of
|
6061 |
|
|
type `LOGICAL'. VECTOR_B shall be a rank-one
|
6062 |
|
|
array.
|
6063 |
|
|
|
6064 |
|
|
_Return value_:
|
6065 |
|
|
If the arguments are numeric, the return value is a scalar of
|
6066 |
|
|
numeric type, `INTEGER', `REAL', or `COMPLEX'. If the arguments
|
6067 |
|
|
are `LOGICAL', the return value is `.TRUE.' or `.FALSE.'.
|
6068 |
|
|
|
6069 |
|
|
_Example_:
|
6070 |
|
|
program test_dot_prod
|
6071 |
|
|
integer, dimension(3) :: a, b
|
6072 |
|
|
a = (/ 1, 2, 3 /)
|
6073 |
|
|
b = (/ 4, 5, 6 /)
|
6074 |
|
|
print '(3i3)', a
|
6075 |
|
|
print *
|
6076 |
|
|
print '(3i3)', b
|
6077 |
|
|
print *
|
6078 |
|
|
print *, dot_product(a,b)
|
6079 |
|
|
end program test_dot_prod
|
6080 |
|
|
|
6081 |
|
|
|
6082 |
|
|
File: gfortran.info, Node: DPROD, Next: DREAL, Prev: DOT_PRODUCT, Up: Intrinsic Procedures
|
6083 |
|
|
|
6084 |
|
|
8.59 `DPROD' -- Double product function
|
6085 |
|
|
=======================================
|
6086 |
|
|
|
6087 |
|
|
_Description_:
|
6088 |
|
|
`DPROD(X,Y)' returns the product `X*Y'.
|
6089 |
|
|
|
6090 |
|
|
_Standard_:
|
6091 |
|
|
Fortran 77 and later
|
6092 |
|
|
|
6093 |
|
|
_Class_:
|
6094 |
|
|
Elemental function
|
6095 |
|
|
|
6096 |
|
|
_Syntax_:
|
6097 |
|
|
`RESULT = DPROD(X, Y)'
|
6098 |
|
|
|
6099 |
|
|
_Arguments_:
|
6100 |
|
|
X The type shall be `REAL'.
|
6101 |
|
|
Y The type shall be `REAL'.
|
6102 |
|
|
|
6103 |
|
|
_Return value_:
|
6104 |
|
|
The return value is of type `REAL(8)'.
|
6105 |
|
|
|
6106 |
|
|
_Example_:
|
6107 |
|
|
program test_dprod
|
6108 |
|
|
real :: x = 5.2
|
6109 |
|
|
real :: y = 2.3
|
6110 |
|
|
real(8) :: d
|
6111 |
|
|
d = dprod(x,y)
|
6112 |
|
|
print *, d
|
6113 |
|
|
end program test_dprod
|
6114 |
|
|
|
6115 |
|
|
|
6116 |
|
|
File: gfortran.info, Node: DREAL, Next: DTIME, Prev: DPROD, Up: Intrinsic Procedures
|
6117 |
|
|
|
6118 |
|
|
8.60 `DREAL' -- Double real part function
|
6119 |
|
|
=========================================
|
6120 |
|
|
|
6121 |
|
|
_Description_:
|
6122 |
|
|
`DREAL(Z)' returns the real part of complex variable Z.
|
6123 |
|
|
|
6124 |
|
|
_Standard_:
|
6125 |
|
|
GNU extension
|
6126 |
|
|
|
6127 |
|
|
_Class_:
|
6128 |
|
|
Elemental function
|
6129 |
|
|
|
6130 |
|
|
_Syntax_:
|
6131 |
|
|
`RESULT = DREAL(A)'
|
6132 |
|
|
|
6133 |
|
|
_Arguments_:
|
6134 |
|
|
A The type shall be `COMPLEX(8)'.
|
6135 |
|
|
|
6136 |
|
|
_Return value_:
|
6137 |
|
|
The return value is of type `REAL(8)'.
|
6138 |
|
|
|
6139 |
|
|
_Example_:
|
6140 |
|
|
program test_dreal
|
6141 |
|
|
complex(8) :: z = (1.3_8,7.2_8)
|
6142 |
|
|
print *, dreal(z)
|
6143 |
|
|
end program test_dreal
|
6144 |
|
|
|
6145 |
|
|
_See also_:
|
6146 |
|
|
*note AIMAG::
|
6147 |
|
|
|
6148 |
|
|
|
6149 |
|
|
|
6150 |
|
|
File: gfortran.info, Node: DTIME, Next: EOSHIFT, Prev: DREAL, Up: Intrinsic Procedures
|
6151 |
|
|
|
6152 |
|
|
8.61 `DTIME' -- Execution time subroutine (or function)
|
6153 |
|
|
=======================================================
|
6154 |
|
|
|
6155 |
|
|
_Description_:
|
6156 |
|
|
`DTIME(VALUES, TIME)' initially returns the number of seconds of
|
6157 |
|
|
runtime since the start of the process's execution in TIME. VALUES
|
6158 |
|
|
returns the user and system components of this time in `VALUES(1)'
|
6159 |
|
|
and `VALUES(2)' respectively. TIME is equal to `VALUES(1) +
|
6160 |
|
|
VALUES(2)'.
|
6161 |
|
|
|
6162 |
|
|
Subsequent invocations of `DTIME' return values accumulated since
|
6163 |
|
|
the previous invocation.
|
6164 |
|
|
|
6165 |
|
|
On some systems, the underlying timings are represented using
|
6166 |
|
|
types with sufficiently small limits that overflows (wrap around)
|
6167 |
|
|
are possible, such as 32-bit types. Therefore, the values returned
|
6168 |
|
|
by this intrinsic might be, or become, negative, or numerically
|
6169 |
|
|
less than previous values, during a single run of the compiled
|
6170 |
|
|
program.
|
6171 |
|
|
|
6172 |
|
|
Please note, that this implementation is thread safe if used
|
6173 |
|
|
within OpenMP directives, i.e., its state will be consistent while
|
6174 |
|
|
called from multiple threads. However, if `DTIME' is called from
|
6175 |
|
|
multiple threads, the result is still the time since the last
|
6176 |
|
|
invocation. This may not give the intended results. If possible,
|
6177 |
|
|
use `CPU_TIME' instead.
|
6178 |
|
|
|
6179 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
6180 |
|
|
however, only one form can be used in any given program unit.
|
6181 |
|
|
|
6182 |
|
|
VALUES and TIME are `INTENT(OUT)' and provide the following:
|
6183 |
|
|
|
6184 |
|
|
`VALUES(1)': User time in seconds.
|
6185 |
|
|
`VALUES(2)': System time in seconds.
|
6186 |
|
|
`TIME': Run time since start in
|
6187 |
|
|
seconds.
|
6188 |
|
|
|
6189 |
|
|
_Standard_:
|
6190 |
|
|
GNU extension
|
6191 |
|
|
|
6192 |
|
|
_Class_:
|
6193 |
|
|
Subroutine, function
|
6194 |
|
|
|
6195 |
|
|
_Syntax_:
|
6196 |
|
|
`CALL DTIME(VALUES, TIME)'.
|
6197 |
|
|
`TIME = DTIME(VALUES)', (not recommended).
|
6198 |
|
|
|
6199 |
|
|
_Arguments_:
|
6200 |
|
|
VALUES The type shall be `REAL(4), DIMENSION(2)'.
|
6201 |
|
|
TIME The type shall be `REAL(4)'.
|
6202 |
|
|
|
6203 |
|
|
_Return value_:
|
6204 |
|
|
Elapsed time in seconds since the last invocation or since the
|
6205 |
|
|
start of program execution if not called before.
|
6206 |
|
|
|
6207 |
|
|
_Example_:
|
6208 |
|
|
program test_dtime
|
6209 |
|
|
integer(8) :: i, j
|
6210 |
|
|
real, dimension(2) :: tarray
|
6211 |
|
|
real :: result
|
6212 |
|
|
call dtime(tarray, result)
|
6213 |
|
|
print *, result
|
6214 |
|
|
print *, tarray(1)
|
6215 |
|
|
print *, tarray(2)
|
6216 |
|
|
do i=1,100000000 ! Just a delay
|
6217 |
|
|
j = i * i - i
|
6218 |
|
|
end do
|
6219 |
|
|
call dtime(tarray, result)
|
6220 |
|
|
print *, result
|
6221 |
|
|
print *, tarray(1)
|
6222 |
|
|
print *, tarray(2)
|
6223 |
|
|
end program test_dtime
|
6224 |
|
|
|
6225 |
|
|
_See also_:
|
6226 |
|
|
*note CPU_TIME::
|
6227 |
|
|
|
6228 |
|
|
|
6229 |
|
|
|
6230 |
|
|
File: gfortran.info, Node: EOSHIFT, Next: EPSILON, Prev: DTIME, Up: Intrinsic Procedures
|
6231 |
|
|
|
6232 |
|
|
8.62 `EOSHIFT' -- End-off shift elements of an array
|
6233 |
|
|
====================================================
|
6234 |
|
|
|
6235 |
|
|
_Description_:
|
6236 |
|
|
`EOSHIFT(ARRAY, SHIFT[, BOUNDARY, DIM])' performs an end-off shift
|
6237 |
|
|
on elements of ARRAY along the dimension of DIM. If DIM is
|
6238 |
|
|
omitted it is taken to be `1'. DIM is a scalar of type `INTEGER'
|
6239 |
|
|
in the range of 1 \leq DIM \leq n) where n is the rank of ARRAY.
|
6240 |
|
|
If the rank of ARRAY is one, then all elements of ARRAY are
|
6241 |
|
|
shifted by SHIFT places. If rank is greater than one, then all
|
6242 |
|
|
complete rank one sections of ARRAY along the given dimension are
|
6243 |
|
|
shifted. Elements shifted out one end of each rank one section
|
6244 |
|
|
are dropped. If BOUNDARY is present then the corresponding value
|
6245 |
|
|
of from BOUNDARY is copied back in the other end. If BOUNDARY is
|
6246 |
|
|
not present then the following are copied in depending on the type
|
6247 |
|
|
of ARRAY.
|
6248 |
|
|
|
6249 |
|
|
_Array _Boundary Value_
|
6250 |
|
|
Type_
|
6251 |
|
|
Numeric 0 of the type and kind of ARRAY.
|
6252 |
|
|
Logical `.FALSE.'.
|
6253 |
|
|
Character(LEN)LEN blanks.
|
6254 |
|
|
|
6255 |
|
|
_Standard_:
|
6256 |
|
|
Fortran 95 and later
|
6257 |
|
|
|
6258 |
|
|
_Class_:
|
6259 |
|
|
Transformational function
|
6260 |
|
|
|
6261 |
|
|
_Syntax_:
|
6262 |
|
|
`RESULT = EOSHIFT(ARRAY, SHIFT [, BOUNDARY, DIM])'
|
6263 |
|
|
|
6264 |
|
|
_Arguments_:
|
6265 |
|
|
ARRAY May be any type, not scalar.
|
6266 |
|
|
SHIFT The type shall be `INTEGER'.
|
6267 |
|
|
BOUNDARY Same type as ARRAY.
|
6268 |
|
|
DIM The type shall be `INTEGER'.
|
6269 |
|
|
|
6270 |
|
|
_Return value_:
|
6271 |
|
|
Returns an array of same type and rank as the ARRAY argument.
|
6272 |
|
|
|
6273 |
|
|
_Example_:
|
6274 |
|
|
program test_eoshift
|
6275 |
|
|
integer, dimension(3,3) :: a
|
6276 |
|
|
a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
|
6277 |
|
|
print '(3i3)', a(1,:)
|
6278 |
|
|
print '(3i3)', a(2,:)
|
6279 |
|
|
print '(3i3)', a(3,:)
|
6280 |
|
|
a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
|
6281 |
|
|
print *
|
6282 |
|
|
print '(3i3)', a(1,:)
|
6283 |
|
|
print '(3i3)', a(2,:)
|
6284 |
|
|
print '(3i3)', a(3,:)
|
6285 |
|
|
end program test_eoshift
|
6286 |
|
|
|
6287 |
|
|
|
6288 |
|
|
File: gfortran.info, Node: EPSILON, Next: ERF, Prev: EOSHIFT, Up: Intrinsic Procedures
|
6289 |
|
|
|
6290 |
|
|
8.63 `EPSILON' -- Epsilon function
|
6291 |
|
|
==================================
|
6292 |
|
|
|
6293 |
|
|
_Description_:
|
6294 |
|
|
`EPSILON(X)' returns the smallest number E of the same kind as X
|
6295 |
|
|
such that 1 + E > 1.
|
6296 |
|
|
|
6297 |
|
|
_Standard_:
|
6298 |
|
|
Fortran 95 and later
|
6299 |
|
|
|
6300 |
|
|
_Class_:
|
6301 |
|
|
Inquiry function
|
6302 |
|
|
|
6303 |
|
|
_Syntax_:
|
6304 |
|
|
`RESULT = EPSILON(X)'
|
6305 |
|
|
|
6306 |
|
|
_Arguments_:
|
6307 |
|
|
X The type shall be `REAL'.
|
6308 |
|
|
|
6309 |
|
|
_Return value_:
|
6310 |
|
|
The return value is of same type as the argument.
|
6311 |
|
|
|
6312 |
|
|
_Example_:
|
6313 |
|
|
program test_epsilon
|
6314 |
|
|
real :: x = 3.143
|
6315 |
|
|
real(8) :: y = 2.33
|
6316 |
|
|
print *, EPSILON(x)
|
6317 |
|
|
print *, EPSILON(y)
|
6318 |
|
|
end program test_epsilon
|
6319 |
|
|
|
6320 |
|
|
|
6321 |
|
|
File: gfortran.info, Node: ERF, Next: ERFC, Prev: EPSILON, Up: Intrinsic Procedures
|
6322 |
|
|
|
6323 |
|
|
8.64 `ERF' -- Error function
|
6324 |
|
|
============================
|
6325 |
|
|
|
6326 |
|
|
_Description_:
|
6327 |
|
|
`ERF(X)' computes the error function of X.
|
6328 |
|
|
|
6329 |
|
|
_Standard_:
|
6330 |
|
|
Fortran 2008 and later
|
6331 |
|
|
|
6332 |
|
|
_Class_:
|
6333 |
|
|
Elemental function
|
6334 |
|
|
|
6335 |
|
|
_Syntax_:
|
6336 |
|
|
`RESULT = ERF(X)'
|
6337 |
|
|
|
6338 |
|
|
_Arguments_:
|
6339 |
|
|
X The type shall be `REAL'.
|
6340 |
|
|
|
6341 |
|
|
_Return value_:
|
6342 |
|
|
The return value is of type `REAL', of the same kind as X and lies
|
6343 |
|
|
in the range -1 \leq erf (x) \leq 1 .
|
6344 |
|
|
|
6345 |
|
|
_Example_:
|
6346 |
|
|
program test_erf
|
6347 |
|
|
real(8) :: x = 0.17_8
|
6348 |
|
|
x = erf(x)
|
6349 |
|
|
end program test_erf
|
6350 |
|
|
|
6351 |
|
|
_Specific names_:
|
6352 |
|
|
Name Argument Return type Standard
|
6353 |
|
|
`DERF(X)' `REAL(8) X' `REAL(8)' GNU extension
|
6354 |
|
|
|
6355 |
|
|
|
6356 |
|
|
File: gfortran.info, Node: ERFC, Next: ERFC_SCALED, Prev: ERF, Up: Intrinsic Procedures
|
6357 |
|
|
|
6358 |
|
|
8.65 `ERFC' -- Error function
|
6359 |
|
|
=============================
|
6360 |
|
|
|
6361 |
|
|
_Description_:
|
6362 |
|
|
`ERFC(X)' computes the complementary error function of X.
|
6363 |
|
|
|
6364 |
|
|
_Standard_:
|
6365 |
|
|
Fortran 2008 and later
|
6366 |
|
|
|
6367 |
|
|
_Class_:
|
6368 |
|
|
Elemental function
|
6369 |
|
|
|
6370 |
|
|
_Syntax_:
|
6371 |
|
|
`RESULT = ERFC(X)'
|
6372 |
|
|
|
6373 |
|
|
_Arguments_:
|
6374 |
|
|
X The type shall be `REAL'.
|
6375 |
|
|
|
6376 |
|
|
_Return value_:
|
6377 |
|
|
The return value is of type `REAL' and of the same kind as X. It
|
6378 |
|
|
lies in the range 0 \leq erfc (x) \leq 2 .
|
6379 |
|
|
|
6380 |
|
|
_Example_:
|
6381 |
|
|
program test_erfc
|
6382 |
|
|
real(8) :: x = 0.17_8
|
6383 |
|
|
x = erfc(x)
|
6384 |
|
|
end program test_erfc
|
6385 |
|
|
|
6386 |
|
|
_Specific names_:
|
6387 |
|
|
Name Argument Return type Standard
|
6388 |
|
|
`DERFC(X)' `REAL(8) X' `REAL(8)' GNU extension
|
6389 |
|
|
|
6390 |
|
|
|
6391 |
|
|
File: gfortran.info, Node: ERFC_SCALED, Next: ETIME, Prev: ERFC, Up: Intrinsic Procedures
|
6392 |
|
|
|
6393 |
|
|
8.66 `ERFC_SCALED' -- Error function
|
6394 |
|
|
====================================
|
6395 |
|
|
|
6396 |
|
|
_Description_:
|
6397 |
|
|
`ERFC_SCALED(X)' computes the exponentially-scaled complementary
|
6398 |
|
|
error function of X.
|
6399 |
|
|
|
6400 |
|
|
_Standard_:
|
6401 |
|
|
Fortran 2008 and later
|
6402 |
|
|
|
6403 |
|
|
_Class_:
|
6404 |
|
|
Elemental function
|
6405 |
|
|
|
6406 |
|
|
_Syntax_:
|
6407 |
|
|
`RESULT = ERFC_SCALED(X)'
|
6408 |
|
|
|
6409 |
|
|
_Arguments_:
|
6410 |
|
|
X The type shall be `REAL'.
|
6411 |
|
|
|
6412 |
|
|
_Return value_:
|
6413 |
|
|
The return value is of type `REAL' and of the same kind as X.
|
6414 |
|
|
|
6415 |
|
|
_Example_:
|
6416 |
|
|
program test_erfc_scaled
|
6417 |
|
|
real(8) :: x = 0.17_8
|
6418 |
|
|
x = erfc_scaled(x)
|
6419 |
|
|
end program test_erfc_scaled
|
6420 |
|
|
|
6421 |
|
|
|
6422 |
|
|
File: gfortran.info, Node: ETIME, Next: EXIT, Prev: ERFC_SCALED, Up: Intrinsic Procedures
|
6423 |
|
|
|
6424 |
|
|
8.67 `ETIME' -- Execution time subroutine (or function)
|
6425 |
|
|
=======================================================
|
6426 |
|
|
|
6427 |
|
|
_Description_:
|
6428 |
|
|
`ETIME(VALUES, TIME)' returns the number of seconds of runtime
|
6429 |
|
|
since the start of the process's execution in TIME. VALUES
|
6430 |
|
|
returns the user and system components of this time in `VALUES(1)'
|
6431 |
|
|
and `VALUES(2)' respectively. TIME is equal to `VALUES(1) +
|
6432 |
|
|
VALUES(2)'.
|
6433 |
|
|
|
6434 |
|
|
On some systems, the underlying timings are represented using
|
6435 |
|
|
types with sufficiently small limits that overflows (wrap around)
|
6436 |
|
|
are possible, such as 32-bit types. Therefore, the values returned
|
6437 |
|
|
by this intrinsic might be, or become, negative, or numerically
|
6438 |
|
|
less than previous values, during a single run of the compiled
|
6439 |
|
|
program.
|
6440 |
|
|
|
6441 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
6442 |
|
|
however, only one form can be used in any given program unit.
|
6443 |
|
|
|
6444 |
|
|
VALUES and TIME are `INTENT(OUT)' and provide the following:
|
6445 |
|
|
|
6446 |
|
|
`VALUES(1)': User time in seconds.
|
6447 |
|
|
`VALUES(2)': System time in seconds.
|
6448 |
|
|
`TIME': Run time since start in seconds.
|
6449 |
|
|
|
6450 |
|
|
_Standard_:
|
6451 |
|
|
GNU extension
|
6452 |
|
|
|
6453 |
|
|
_Class_:
|
6454 |
|
|
Subroutine, function
|
6455 |
|
|
|
6456 |
|
|
_Syntax_:
|
6457 |
|
|
`CALL ETIME(VALUES, TIME)'.
|
6458 |
|
|
`TIME = ETIME(VALUES)', (not recommended).
|
6459 |
|
|
|
6460 |
|
|
_Arguments_:
|
6461 |
|
|
VALUES The type shall be `REAL(4), DIMENSION(2)'.
|
6462 |
|
|
TIME The type shall be `REAL(4)'.
|
6463 |
|
|
|
6464 |
|
|
_Return value_:
|
6465 |
|
|
Elapsed time in seconds since the start of program execution.
|
6466 |
|
|
|
6467 |
|
|
_Example_:
|
6468 |
|
|
program test_etime
|
6469 |
|
|
integer(8) :: i, j
|
6470 |
|
|
real, dimension(2) :: tarray
|
6471 |
|
|
real :: result
|
6472 |
|
|
call ETIME(tarray, result)
|
6473 |
|
|
print *, result
|
6474 |
|
|
print *, tarray(1)
|
6475 |
|
|
print *, tarray(2)
|
6476 |
|
|
do i=1,100000000 ! Just a delay
|
6477 |
|
|
j = i * i - i
|
6478 |
|
|
end do
|
6479 |
|
|
call ETIME(tarray, result)
|
6480 |
|
|
print *, result
|
6481 |
|
|
print *, tarray(1)
|
6482 |
|
|
print *, tarray(2)
|
6483 |
|
|
end program test_etime
|
6484 |
|
|
|
6485 |
|
|
_See also_:
|
6486 |
|
|
*note CPU_TIME::
|
6487 |
|
|
|
6488 |
|
|
|
6489 |
|
|
|
6490 |
|
|
File: gfortran.info, Node: EXIT, Next: EXP, Prev: ETIME, Up: Intrinsic Procedures
|
6491 |
|
|
|
6492 |
|
|
8.68 `EXIT' -- Exit the program with status.
|
6493 |
|
|
============================================
|
6494 |
|
|
|
6495 |
|
|
_Description_:
|
6496 |
|
|
`EXIT' causes immediate termination of the program with status.
|
6497 |
|
|
If status is omitted it returns the canonical _success_ for the
|
6498 |
|
|
system. All Fortran I/O units are closed.
|
6499 |
|
|
|
6500 |
|
|
_Standard_:
|
6501 |
|
|
GNU extension
|
6502 |
|
|
|
6503 |
|
|
_Class_:
|
6504 |
|
|
Subroutine
|
6505 |
|
|
|
6506 |
|
|
_Syntax_:
|
6507 |
|
|
`CALL EXIT([STATUS])'
|
6508 |
|
|
|
6509 |
|
|
_Arguments_:
|
6510 |
|
|
STATUS Shall be an `INTEGER' of the default kind.
|
6511 |
|
|
|
6512 |
|
|
_Return value_:
|
6513 |
|
|
`STATUS' is passed to the parent process on exit.
|
6514 |
|
|
|
6515 |
|
|
_Example_:
|
6516 |
|
|
program test_exit
|
6517 |
|
|
integer :: STATUS = 0
|
6518 |
|
|
print *, 'This program is going to exit.'
|
6519 |
|
|
call EXIT(STATUS)
|
6520 |
|
|
end program test_exit
|
6521 |
|
|
|
6522 |
|
|
_See also_:
|
6523 |
|
|
*note ABORT::, *note KILL::
|
6524 |
|
|
|
6525 |
|
|
|
6526 |
|
|
File: gfortran.info, Node: EXP, Next: EXPONENT, Prev: EXIT, Up: Intrinsic Procedures
|
6527 |
|
|
|
6528 |
|
|
8.69 `EXP' -- Exponential function
|
6529 |
|
|
==================================
|
6530 |
|
|
|
6531 |
|
|
_Description_:
|
6532 |
|
|
`EXP(X)' computes the base e exponential of X.
|
6533 |
|
|
|
6534 |
|
|
_Standard_:
|
6535 |
|
|
Fortran 77 and later, has overloads that are GNU extensions
|
6536 |
|
|
|
6537 |
|
|
_Class_:
|
6538 |
|
|
Elemental function
|
6539 |
|
|
|
6540 |
|
|
_Syntax_:
|
6541 |
|
|
`RESULT = EXP(X)'
|
6542 |
|
|
|
6543 |
|
|
_Arguments_:
|
6544 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
6545 |
|
|
|
6546 |
|
|
_Return value_:
|
6547 |
|
|
The return value has same type and kind as X.
|
6548 |
|
|
|
6549 |
|
|
_Example_:
|
6550 |
|
|
program test_exp
|
6551 |
|
|
real :: x = 1.0
|
6552 |
|
|
x = exp(x)
|
6553 |
|
|
end program test_exp
|
6554 |
|
|
|
6555 |
|
|
_Specific names_:
|
6556 |
|
|
Name Argument Return type Standard
|
6557 |
|
|
`DEXP(X)' `REAL(8) X' `REAL(8)' Fortran 77 and
|
6558 |
|
|
later
|
6559 |
|
|
`CEXP(X)' `COMPLEX(4) `COMPLEX(4)' Fortran 77 and
|
6560 |
|
|
X' later
|
6561 |
|
|
`ZEXP(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
|
6562 |
|
|
X'
|
6563 |
|
|
`CDEXP(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
|
6564 |
|
|
X'
|
6565 |
|
|
|
6566 |
|
|
|
6567 |
|
|
File: gfortran.info, Node: EXPONENT, Next: FDATE, Prev: EXP, Up: Intrinsic Procedures
|
6568 |
|
|
|
6569 |
|
|
8.70 `EXPONENT' -- Exponent function
|
6570 |
|
|
====================================
|
6571 |
|
|
|
6572 |
|
|
_Description_:
|
6573 |
|
|
`EXPONENT(X)' returns the value of the exponent part of X. If X is
|
6574 |
|
|
zero the value returned is zero.
|
6575 |
|
|
|
6576 |
|
|
_Standard_:
|
6577 |
|
|
Fortran 95 and later
|
6578 |
|
|
|
6579 |
|
|
_Class_:
|
6580 |
|
|
Elemental function
|
6581 |
|
|
|
6582 |
|
|
_Syntax_:
|
6583 |
|
|
`RESULT = EXPONENT(X)'
|
6584 |
|
|
|
6585 |
|
|
_Arguments_:
|
6586 |
|
|
X The type shall be `REAL'.
|
6587 |
|
|
|
6588 |
|
|
_Return value_:
|
6589 |
|
|
The return value is of type default `INTEGER'.
|
6590 |
|
|
|
6591 |
|
|
_Example_:
|
6592 |
|
|
program test_exponent
|
6593 |
|
|
real :: x = 1.0
|
6594 |
|
|
integer :: i
|
6595 |
|
|
i = exponent(x)
|
6596 |
|
|
print *, i
|
6597 |
|
|
print *, exponent(0.0)
|
6598 |
|
|
end program test_exponent
|
6599 |
|
|
|
6600 |
|
|
|
6601 |
|
|
File: gfortran.info, Node: FDATE, Next: FGET, Prev: EXPONENT, Up: Intrinsic Procedures
|
6602 |
|
|
|
6603 |
|
|
8.71 `FDATE' -- Get the current time as a string
|
6604 |
|
|
================================================
|
6605 |
|
|
|
6606 |
|
|
_Description_:
|
6607 |
|
|
`FDATE(DATE)' returns the current date (using the same format as
|
6608 |
|
|
`CTIME') in DATE. It is equivalent to `CALL CTIME(DATE, TIME())'.
|
6609 |
|
|
|
6610 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
6611 |
|
|
however, only one form can be used in any given program unit.
|
6612 |
|
|
|
6613 |
|
|
DATE is an `INTENT(OUT)' `CHARACTER' variable of the default kind.
|
6614 |
|
|
|
6615 |
|
|
_Standard_:
|
6616 |
|
|
GNU extension
|
6617 |
|
|
|
6618 |
|
|
_Class_:
|
6619 |
|
|
Subroutine, function
|
6620 |
|
|
|
6621 |
|
|
_Syntax_:
|
6622 |
|
|
`CALL FDATE(DATE)'.
|
6623 |
|
|
`DATE = FDATE()', (not recommended).
|
6624 |
|
|
|
6625 |
|
|
_Arguments_:
|
6626 |
|
|
DATE The type shall be of type `CHARACTER' of the
|
6627 |
|
|
default kind
|
6628 |
|
|
|
6629 |
|
|
_Return value_:
|
6630 |
|
|
The current date as a string.
|
6631 |
|
|
|
6632 |
|
|
_Example_:
|
6633 |
|
|
program test_fdate
|
6634 |
|
|
integer(8) :: i, j
|
6635 |
|
|
character(len=30) :: date
|
6636 |
|
|
call fdate(date)
|
6637 |
|
|
print *, 'Program started on ', date
|
6638 |
|
|
do i = 1, 100000000 ! Just a delay
|
6639 |
|
|
j = i * i - i
|
6640 |
|
|
end do
|
6641 |
|
|
call fdate(date)
|
6642 |
|
|
print *, 'Program ended on ', date
|
6643 |
|
|
end program test_fdate
|
6644 |
|
|
|
6645 |
|
|
|
6646 |
|
|
File: gfortran.info, Node: FLOAT, Next: FLOOR, Prev: FGETC, Up: Intrinsic Procedures
|
6647 |
|
|
|
6648 |
|
|
8.72 `FLOAT' -- Convert integer to default real
|
6649 |
|
|
===============================================
|
6650 |
|
|
|
6651 |
|
|
_Description_:
|
6652 |
|
|
`FLOAT(A)' converts the integer A to a default real value.
|
6653 |
|
|
|
6654 |
|
|
_Standard_:
|
6655 |
|
|
Fortran 77 and later
|
6656 |
|
|
|
6657 |
|
|
_Class_:
|
6658 |
|
|
Elemental function
|
6659 |
|
|
|
6660 |
|
|
_Syntax_:
|
6661 |
|
|
`RESULT = FLOAT(A)'
|
6662 |
|
|
|
6663 |
|
|
_Arguments_:
|
6664 |
|
|
A The type shall be `INTEGER'.
|
6665 |
|
|
|
6666 |
|
|
_Return value_:
|
6667 |
|
|
The return value is of type default `REAL'.
|
6668 |
|
|
|
6669 |
|
|
_Example_:
|
6670 |
|
|
program test_float
|
6671 |
|
|
integer :: i = 1
|
6672 |
|
|
if (float(i) /= 1.) call abort
|
6673 |
|
|
end program test_float
|
6674 |
|
|
|
6675 |
|
|
_See also_:
|
6676 |
|
|
*note DBLE::, *note DFLOAT::, *note REAL::
|
6677 |
|
|
|
6678 |
|
|
|
6679 |
|
|
File: gfortran.info, Node: FGET, Next: FGETC, Prev: FDATE, Up: Intrinsic Procedures
|
6680 |
|
|
|
6681 |
|
|
8.73 `FGET' -- Read a single character in stream mode from stdin
|
6682 |
|
|
================================================================
|
6683 |
|
|
|
6684 |
|
|
_Description_:
|
6685 |
|
|
Read a single character in stream mode from stdin by bypassing
|
6686 |
|
|
normal formatted output. Stream I/O should not be mixed with
|
6687 |
|
|
normal record-oriented (formatted or unformatted) I/O on the same
|
6688 |
|
|
unit; the results are unpredictable.
|
6689 |
|
|
|
6690 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
6691 |
|
|
however, only one form can be used in any given program unit.
|
6692 |
|
|
|
6693 |
|
|
Note that the `FGET' intrinsic is provided for backwards
|
6694 |
|
|
compatibility with `g77'. GNU Fortran provides the Fortran 2003
|
6695 |
|
|
Stream facility. Programmers should consider the use of new
|
6696 |
|
|
stream IO feature in new code for future portability. See also
|
6697 |
|
|
*note Fortran 2003 status::.
|
6698 |
|
|
|
6699 |
|
|
_Standard_:
|
6700 |
|
|
GNU extension
|
6701 |
|
|
|
6702 |
|
|
_Class_:
|
6703 |
|
|
Subroutine, function
|
6704 |
|
|
|
6705 |
|
|
_Syntax_:
|
6706 |
|
|
`CALL FGET(C [, STATUS])'
|
6707 |
|
|
|
6708 |
|
|
_Arguments_:
|
6709 |
|
|
C The type shall be `CHARACTER' and of default
|
6710 |
|
|
kind.
|
6711 |
|
|
STATUS (Optional) status flag of type `INTEGER'.
|
6712 |
|
|
Returns 0 on success, -1 on end-of-file, and a
|
6713 |
|
|
system specific positive error code otherwise.
|
6714 |
|
|
|
6715 |
|
|
_Example_:
|
6716 |
|
|
PROGRAM test_fget
|
6717 |
|
|
INTEGER, PARAMETER :: strlen = 100
|
6718 |
|
|
INTEGER :: status, i = 1
|
6719 |
|
|
CHARACTER(len=strlen) :: str = ""
|
6720 |
|
|
|
6721 |
|
|
WRITE (*,*) 'Enter text:'
|
6722 |
|
|
DO
|
6723 |
|
|
CALL fget(str(i:i), status)
|
6724 |
|
|
if (status /= 0 .OR. i > strlen) exit
|
6725 |
|
|
i = i + 1
|
6726 |
|
|
END DO
|
6727 |
|
|
WRITE (*,*) TRIM(str)
|
6728 |
|
|
END PROGRAM
|
6729 |
|
|
|
6730 |
|
|
_See also_:
|
6731 |
|
|
*note FGETC::, *note FPUT::, *note FPUTC::
|
6732 |
|
|
|
6733 |
|
|
|
6734 |
|
|
File: gfortran.info, Node: FGETC, Next: FLOAT, Prev: FGET, Up: Intrinsic Procedures
|
6735 |
|
|
|
6736 |
|
|
8.74 `FGETC' -- Read a single character in stream mode
|
6737 |
|
|
======================================================
|
6738 |
|
|
|
6739 |
|
|
_Description_:
|
6740 |
|
|
Read a single character in stream mode by bypassing normal
|
6741 |
|
|
formatted output. Stream I/O should not be mixed with normal
|
6742 |
|
|
record-oriented (formatted or unformatted) I/O on the same unit;
|
6743 |
|
|
the results are unpredictable.
|
6744 |
|
|
|
6745 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
6746 |
|
|
however, only one form can be used in any given program unit.
|
6747 |
|
|
|
6748 |
|
|
Note that the `FGET' intrinsic is provided for backwards
|
6749 |
|
|
compatibility with `g77'. GNU Fortran provides the Fortran 2003
|
6750 |
|
|
Stream facility. Programmers should consider the use of new
|
6751 |
|
|
stream IO feature in new code for future portability. See also
|
6752 |
|
|
*note Fortran 2003 status::.
|
6753 |
|
|
|
6754 |
|
|
_Standard_:
|
6755 |
|
|
GNU extension
|
6756 |
|
|
|
6757 |
|
|
_Class_:
|
6758 |
|
|
Subroutine, function
|
6759 |
|
|
|
6760 |
|
|
_Syntax_:
|
6761 |
|
|
`CALL FGETC(UNIT, C [, STATUS])'
|
6762 |
|
|
|
6763 |
|
|
_Arguments_:
|
6764 |
|
|
UNIT The type shall be `INTEGER'.
|
6765 |
|
|
C The type shall be `CHARACTER' and of default
|
6766 |
|
|
kind.
|
6767 |
|
|
STATUS (Optional) status flag of type `INTEGER'.
|
6768 |
|
|
Returns 0 on success, -1 on end-of-file and a
|
6769 |
|
|
system specific positive error code otherwise.
|
6770 |
|
|
|
6771 |
|
|
_Example_:
|
6772 |
|
|
PROGRAM test_fgetc
|
6773 |
|
|
INTEGER :: fd = 42, status
|
6774 |
|
|
CHARACTER :: c
|
6775 |
|
|
|
6776 |
|
|
OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD")
|
6777 |
|
|
DO
|
6778 |
|
|
CALL fgetc(fd, c, status)
|
6779 |
|
|
IF (status /= 0) EXIT
|
6780 |
|
|
call fput(c)
|
6781 |
|
|
END DO
|
6782 |
|
|
CLOSE(UNIT=fd)
|
6783 |
|
|
END PROGRAM
|
6784 |
|
|
|
6785 |
|
|
_See also_:
|
6786 |
|
|
*note FGET::, *note FPUT::, *note FPUTC::
|
6787 |
|
|
|
6788 |
|
|
|
6789 |
|
|
File: gfortran.info, Node: FLOOR, Next: FLUSH, Prev: FLOAT, Up: Intrinsic Procedures
|
6790 |
|
|
|
6791 |
|
|
8.75 `FLOOR' -- Integer floor function
|
6792 |
|
|
======================================
|
6793 |
|
|
|
6794 |
|
|
_Description_:
|
6795 |
|
|
`FLOOR(A)' returns the greatest integer less than or equal to X.
|
6796 |
|
|
|
6797 |
|
|
_Standard_:
|
6798 |
|
|
Fortran 95 and later
|
6799 |
|
|
|
6800 |
|
|
_Class_:
|
6801 |
|
|
Elemental function
|
6802 |
|
|
|
6803 |
|
|
_Syntax_:
|
6804 |
|
|
`RESULT = FLOOR(A [, KIND])'
|
6805 |
|
|
|
6806 |
|
|
_Arguments_:
|
6807 |
|
|
A The type shall be `REAL'.
|
6808 |
|
|
KIND (Optional) An `INTEGER' initialization
|
6809 |
|
|
expression indicating the kind parameter of
|
6810 |
|
|
the result.
|
6811 |
|
|
|
6812 |
|
|
_Return value_:
|
6813 |
|
|
The return value is of type `INTEGER(KIND)' if KIND is present and
|
6814 |
|
|
of default-kind `INTEGER' otherwise.
|
6815 |
|
|
|
6816 |
|
|
_Example_:
|
6817 |
|
|
program test_floor
|
6818 |
|
|
real :: x = 63.29
|
6819 |
|
|
real :: y = -63.59
|
6820 |
|
|
print *, floor(x) ! returns 63
|
6821 |
|
|
print *, floor(y) ! returns -64
|
6822 |
|
|
end program test_floor
|
6823 |
|
|
|
6824 |
|
|
_See also_:
|
6825 |
|
|
*note CEILING::, *note NINT::
|
6826 |
|
|
|
6827 |
|
|
|
6828 |
|
|
|
6829 |
|
|
File: gfortran.info, Node: FLUSH, Next: FNUM, Prev: FLOOR, Up: Intrinsic Procedures
|
6830 |
|
|
|
6831 |
|
|
8.76 `FLUSH' -- Flush I/O unit(s)
|
6832 |
|
|
=================================
|
6833 |
|
|
|
6834 |
|
|
_Description_:
|
6835 |
|
|
Flushes Fortran unit(s) currently open for output. Without the
|
6836 |
|
|
optional argument, all units are flushed, otherwise just the unit
|
6837 |
|
|
specified.
|
6838 |
|
|
|
6839 |
|
|
_Standard_:
|
6840 |
|
|
GNU extension
|
6841 |
|
|
|
6842 |
|
|
_Class_:
|
6843 |
|
|
Subroutine
|
6844 |
|
|
|
6845 |
|
|
_Syntax_:
|
6846 |
|
|
`CALL FLUSH(UNIT)'
|
6847 |
|
|
|
6848 |
|
|
_Arguments_:
|
6849 |
|
|
UNIT (Optional) The type shall be `INTEGER'.
|
6850 |
|
|
|
6851 |
|
|
_Note_:
|
6852 |
|
|
Beginning with the Fortran 2003 standard, there is a `FLUSH'
|
6853 |
|
|
statement that should be preferred over the `FLUSH' intrinsic.
|
6854 |
|
|
|
6855 |
|
|
|
6856 |
|
|
|
6857 |
|
|
File: gfortran.info, Node: FNUM, Next: FPUT, Prev: FLUSH, Up: Intrinsic Procedures
|
6858 |
|
|
|
6859 |
|
|
8.77 `FNUM' -- File number function
|
6860 |
|
|
===================================
|
6861 |
|
|
|
6862 |
|
|
_Description_:
|
6863 |
|
|
`FNUM(UNIT)' returns the POSIX file descriptor number
|
6864 |
|
|
corresponding to the open Fortran I/O unit `UNIT'.
|
6865 |
|
|
|
6866 |
|
|
_Standard_:
|
6867 |
|
|
GNU extension
|
6868 |
|
|
|
6869 |
|
|
_Class_:
|
6870 |
|
|
Function
|
6871 |
|
|
|
6872 |
|
|
_Syntax_:
|
6873 |
|
|
`RESULT = FNUM(UNIT)'
|
6874 |
|
|
|
6875 |
|
|
_Arguments_:
|
6876 |
|
|
UNIT The type shall be `INTEGER'.
|
6877 |
|
|
|
6878 |
|
|
_Return value_:
|
6879 |
|
|
The return value is of type `INTEGER'
|
6880 |
|
|
|
6881 |
|
|
_Example_:
|
6882 |
|
|
program test_fnum
|
6883 |
|
|
integer :: i
|
6884 |
|
|
open (unit=10, status = "scratch")
|
6885 |
|
|
i = fnum(10)
|
6886 |
|
|
print *, i
|
6887 |
|
|
close (10)
|
6888 |
|
|
end program test_fnum
|
6889 |
|
|
|
6890 |
|
|
|
6891 |
|
|
File: gfortran.info, Node: FPUT, Next: FPUTC, Prev: FNUM, Up: Intrinsic Procedures
|
6892 |
|
|
|
6893 |
|
|
8.78 `FPUT' -- Write a single character in stream mode to stdout
|
6894 |
|
|
================================================================
|
6895 |
|
|
|
6896 |
|
|
_Description_:
|
6897 |
|
|
Write a single character in stream mode to stdout by bypassing
|
6898 |
|
|
normal formatted output. Stream I/O should not be mixed with
|
6899 |
|
|
normal record-oriented (formatted or unformatted) I/O on the same
|
6900 |
|
|
unit; the results are unpredictable.
|
6901 |
|
|
|
6902 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
6903 |
|
|
however, only one form can be used in any given program unit.
|
6904 |
|
|
|
6905 |
|
|
Note that the `FGET' intrinsic is provided for backwards
|
6906 |
|
|
compatibility with `g77'. GNU Fortran provides the Fortran 2003
|
6907 |
|
|
Stream facility. Programmers should consider the use of new
|
6908 |
|
|
stream IO feature in new code for future portability. See also
|
6909 |
|
|
*note Fortran 2003 status::.
|
6910 |
|
|
|
6911 |
|
|
_Standard_:
|
6912 |
|
|
GNU extension
|
6913 |
|
|
|
6914 |
|
|
_Class_:
|
6915 |
|
|
Subroutine, function
|
6916 |
|
|
|
6917 |
|
|
_Syntax_:
|
6918 |
|
|
`CALL FPUT(C [, STATUS])'
|
6919 |
|
|
|
6920 |
|
|
_Arguments_:
|
6921 |
|
|
C The type shall be `CHARACTER' and of default
|
6922 |
|
|
kind.
|
6923 |
|
|
STATUS (Optional) status flag of type `INTEGER'.
|
6924 |
|
|
Returns 0 on success, -1 on end-of-file and a
|
6925 |
|
|
system specific positive error code otherwise.
|
6926 |
|
|
|
6927 |
|
|
_Example_:
|
6928 |
|
|
PROGRAM test_fput
|
6929 |
|
|
CHARACTER(len=10) :: str = "gfortran"
|
6930 |
|
|
INTEGER :: i
|
6931 |
|
|
DO i = 1, len_trim(str)
|
6932 |
|
|
CALL fput(str(i:i))
|
6933 |
|
|
END DO
|
6934 |
|
|
END PROGRAM
|
6935 |
|
|
|
6936 |
|
|
_See also_:
|
6937 |
|
|
*note FPUTC::, *note FGET::, *note FGETC::
|
6938 |
|
|
|
6939 |
|
|
|
6940 |
|
|
File: gfortran.info, Node: FPUTC, Next: FRACTION, Prev: FPUT, Up: Intrinsic Procedures
|
6941 |
|
|
|
6942 |
|
|
8.79 `FPUTC' -- Write a single character in stream mode
|
6943 |
|
|
=======================================================
|
6944 |
|
|
|
6945 |
|
|
_Description_:
|
6946 |
|
|
Write a single character in stream mode by bypassing normal
|
6947 |
|
|
formatted output. Stream I/O should not be mixed with normal
|
6948 |
|
|
record-oriented (formatted or unformatted) I/O on the same unit;
|
6949 |
|
|
the results are unpredictable.
|
6950 |
|
|
|
6951 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
6952 |
|
|
however, only one form can be used in any given program unit.
|
6953 |
|
|
|
6954 |
|
|
Note that the `FGET' intrinsic is provided for backwards
|
6955 |
|
|
compatibility with `g77'. GNU Fortran provides the Fortran 2003
|
6956 |
|
|
Stream facility. Programmers should consider the use of new
|
6957 |
|
|
stream IO feature in new code for future portability. See also
|
6958 |
|
|
*note Fortran 2003 status::.
|
6959 |
|
|
|
6960 |
|
|
_Standard_:
|
6961 |
|
|
GNU extension
|
6962 |
|
|
|
6963 |
|
|
_Class_:
|
6964 |
|
|
Subroutine, function
|
6965 |
|
|
|
6966 |
|
|
_Syntax_:
|
6967 |
|
|
`CALL FPUTC(UNIT, C [, STATUS])'
|
6968 |
|
|
|
6969 |
|
|
_Arguments_:
|
6970 |
|
|
UNIT The type shall be `INTEGER'.
|
6971 |
|
|
C The type shall be `CHARACTER' and of default
|
6972 |
|
|
kind.
|
6973 |
|
|
STATUS (Optional) status flag of type `INTEGER'.
|
6974 |
|
|
Returns 0 on success, -1 on end-of-file and a
|
6975 |
|
|
system specific positive error code otherwise.
|
6976 |
|
|
|
6977 |
|
|
_Example_:
|
6978 |
|
|
PROGRAM test_fputc
|
6979 |
|
|
CHARACTER(len=10) :: str = "gfortran"
|
6980 |
|
|
INTEGER :: fd = 42, i
|
6981 |
|
|
|
6982 |
|
|
OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW")
|
6983 |
|
|
DO i = 1, len_trim(str)
|
6984 |
|
|
CALL fputc(fd, str(i:i))
|
6985 |
|
|
END DO
|
6986 |
|
|
CLOSE(fd)
|
6987 |
|
|
END PROGRAM
|
6988 |
|
|
|
6989 |
|
|
_See also_:
|
6990 |
|
|
*note FPUT::, *note FGET::, *note FGETC::
|
6991 |
|
|
|
6992 |
|
|
|
6993 |
|
|
File: gfortran.info, Node: FRACTION, Next: FREE, Prev: FPUTC, Up: Intrinsic Procedures
|
6994 |
|
|
|
6995 |
|
|
8.80 `FRACTION' -- Fractional part of the model representation
|
6996 |
|
|
==============================================================
|
6997 |
|
|
|
6998 |
|
|
_Description_:
|
6999 |
|
|
`FRACTION(X)' returns the fractional part of the model
|
7000 |
|
|
representation of `X'.
|
7001 |
|
|
|
7002 |
|
|
_Standard_:
|
7003 |
|
|
Fortran 95 and later
|
7004 |
|
|
|
7005 |
|
|
_Class_:
|
7006 |
|
|
Elemental function
|
7007 |
|
|
|
7008 |
|
|
_Syntax_:
|
7009 |
|
|
`Y = FRACTION(X)'
|
7010 |
|
|
|
7011 |
|
|
_Arguments_:
|
7012 |
|
|
X The type of the argument shall be a `REAL'.
|
7013 |
|
|
|
7014 |
|
|
_Return value_:
|
7015 |
|
|
The return value is of the same type and kind as the argument.
|
7016 |
|
|
The fractional part of the model representation of `X' is returned;
|
7017 |
|
|
it is `X * RADIX(X)**(-EXPONENT(X))'.
|
7018 |
|
|
|
7019 |
|
|
_Example_:
|
7020 |
|
|
program test_fraction
|
7021 |
|
|
real :: x
|
7022 |
|
|
x = 178.1387e-4
|
7023 |
|
|
print *, fraction(x), x * radix(x)**(-exponent(x))
|
7024 |
|
|
end program test_fraction
|
7025 |
|
|
|
7026 |
|
|
|
7027 |
|
|
|
7028 |
|
|
File: gfortran.info, Node: FREE, Next: FSEEK, Prev: FRACTION, Up: Intrinsic Procedures
|
7029 |
|
|
|
7030 |
|
|
8.81 `FREE' -- Frees memory
|
7031 |
|
|
===========================
|
7032 |
|
|
|
7033 |
|
|
_Description_:
|
7034 |
|
|
Frees memory previously allocated by `MALLOC()'. The `FREE'
|
7035 |
|
|
intrinsic is an extension intended to be used with Cray pointers,
|
7036 |
|
|
and is provided in GNU Fortran to allow user to compile legacy
|
7037 |
|
|
code. For new code using Fortran 95 pointers, the memory
|
7038 |
|
|
de-allocation intrinsic is `DEALLOCATE'.
|
7039 |
|
|
|
7040 |
|
|
_Standard_:
|
7041 |
|
|
GNU extension
|
7042 |
|
|
|
7043 |
|
|
_Class_:
|
7044 |
|
|
Subroutine
|
7045 |
|
|
|
7046 |
|
|
_Syntax_:
|
7047 |
|
|
`CALL FREE(PTR)'
|
7048 |
|
|
|
7049 |
|
|
_Arguments_:
|
7050 |
|
|
PTR The type shall be `INTEGER'. It represents the
|
7051 |
|
|
location of the memory that should be
|
7052 |
|
|
de-allocated.
|
7053 |
|
|
|
7054 |
|
|
_Return value_:
|
7055 |
|
|
None
|
7056 |
|
|
|
7057 |
|
|
_Example_:
|
7058 |
|
|
See `MALLOC' for an example.
|
7059 |
|
|
|
7060 |
|
|
_See also_:
|
7061 |
|
|
*note MALLOC::
|
7062 |
|
|
|
7063 |
|
|
|
7064 |
|
|
File: gfortran.info, Node: FSEEK, Next: FSTAT, Prev: FREE, Up: Intrinsic Procedures
|
7065 |
|
|
|
7066 |
|
|
8.82 `FSEEK' -- Low level file positioning subroutine
|
7067 |
|
|
=====================================================
|
7068 |
|
|
|
7069 |
|
|
_Description_:
|
7070 |
|
|
Moves UNIT to the specified OFFSET. If WHENCE is set to 0, the
|
7071 |
|
|
OFFSET is taken as an absolute value `SEEK_SET', if set to 1,
|
7072 |
|
|
OFFSET is taken to be relative to the current position `SEEK_CUR',
|
7073 |
|
|
and if set to 2 relative to the end of the file `SEEK_END'. On
|
7074 |
|
|
error, STATUS is set to a nonzero value. If STATUS the seek fails
|
7075 |
|
|
silently.
|
7076 |
|
|
|
7077 |
|
|
This intrinsic routine is not fully backwards compatible with
|
7078 |
|
|
`g77'. In `g77', the `FSEEK' takes a statement label instead of a
|
7079 |
|
|
STATUS variable. If FSEEK is used in old code, change
|
7080 |
|
|
CALL FSEEK(UNIT, OFFSET, WHENCE, *label)
|
7081 |
|
|
to
|
7082 |
|
|
INTEGER :: status
|
7083 |
|
|
CALL FSEEK(UNIT, OFFSET, WHENCE, status)
|
7084 |
|
|
IF (status /= 0) GOTO label
|
7085 |
|
|
|
7086 |
|
|
Please note that GNU Fortran provides the Fortran 2003 Stream
|
7087 |
|
|
facility. Programmers should consider the use of new stream IO
|
7088 |
|
|
feature in new code for future portability. See also *note Fortran
|
7089 |
|
|
2003 status::.
|
7090 |
|
|
|
7091 |
|
|
_Standard_:
|
7092 |
|
|
GNU extension
|
7093 |
|
|
|
7094 |
|
|
_Class_:
|
7095 |
|
|
Subroutine
|
7096 |
|
|
|
7097 |
|
|
_Syntax_:
|
7098 |
|
|
`CALL FSEEK(UNIT, OFFSET, WHENCE[, STATUS])'
|
7099 |
|
|
|
7100 |
|
|
_Arguments_:
|
7101 |
|
|
UNIT Shall be a scalar of type `INTEGER'.
|
7102 |
|
|
OFFSET Shall be a scalar of type `INTEGER'.
|
7103 |
|
|
WHENCE Shall be a scalar of type `INTEGER'. Its
|
7104 |
|
|
value shall be either 0, 1 or 2.
|
7105 |
|
|
STATUS (Optional) shall be a scalar of type
|
7106 |
|
|
`INTEGER(4)'.
|
7107 |
|
|
|
7108 |
|
|
_Example_:
|
7109 |
|
|
PROGRAM test_fseek
|
7110 |
|
|
INTEGER, PARAMETER :: SEEK_SET = 0, SEEK_CUR = 1, SEEK_END = 2
|
7111 |
|
|
INTEGER :: fd, offset, ierr
|
7112 |
|
|
|
7113 |
|
|
ierr = 0
|
7114 |
|
|
offset = 5
|
7115 |
|
|
fd = 10
|
7116 |
|
|
|
7117 |
|
|
OPEN(UNIT=fd, FILE="fseek.test")
|
7118 |
|
|
CALL FSEEK(fd, offset, SEEK_SET, ierr) ! move to OFFSET
|
7119 |
|
|
print *, FTELL(fd), ierr
|
7120 |
|
|
|
7121 |
|
|
CALL FSEEK(fd, 0, SEEK_END, ierr) ! move to end
|
7122 |
|
|
print *, FTELL(fd), ierr
|
7123 |
|
|
|
7124 |
|
|
CALL FSEEK(fd, 0, SEEK_SET, ierr) ! move to beginning
|
7125 |
|
|
print *, FTELL(fd), ierr
|
7126 |
|
|
|
7127 |
|
|
CLOSE(UNIT=fd)
|
7128 |
|
|
END PROGRAM
|
7129 |
|
|
|
7130 |
|
|
_See also_:
|
7131 |
|
|
*note FTELL::
|
7132 |
|
|
|
7133 |
|
|
|
7134 |
|
|
File: gfortran.info, Node: FSTAT, Next: FTELL, Prev: FSEEK, Up: Intrinsic Procedures
|
7135 |
|
|
|
7136 |
|
|
8.83 `FSTAT' -- Get file status
|
7137 |
|
|
===============================
|
7138 |
|
|
|
7139 |
|
|
_Description_:
|
7140 |
|
|
`FSTAT' is identical to *note STAT::, except that information
|
7141 |
|
|
about an already opened file is obtained.
|
7142 |
|
|
|
7143 |
|
|
The elements in `VALUES' are the same as described by *note STAT::.
|
7144 |
|
|
|
7145 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
7146 |
|
|
however, only one form can be used in any given program unit.
|
7147 |
|
|
|
7148 |
|
|
_Standard_:
|
7149 |
|
|
GNU extension
|
7150 |
|
|
|
7151 |
|
|
_Class_:
|
7152 |
|
|
Subroutine, function
|
7153 |
|
|
|
7154 |
|
|
_Syntax_:
|
7155 |
|
|
`CALL FSTAT(UNIT, VALUES [, STATUS])'
|
7156 |
|
|
|
7157 |
|
|
_Arguments_:
|
7158 |
|
|
UNIT An open I/O unit number of type `INTEGER'.
|
7159 |
|
|
VALUES The type shall be `INTEGER(4), DIMENSION(13)'.
|
7160 |
|
|
STATUS (Optional) status flag of type `INTEGER(4)'.
|
7161 |
|
|
Returns 0 on success and a system specific
|
7162 |
|
|
error code otherwise.
|
7163 |
|
|
|
7164 |
|
|
_Example_:
|
7165 |
|
|
See *note STAT:: for an example.
|
7166 |
|
|
|
7167 |
|
|
_See also_:
|
7168 |
|
|
To stat a link: *note LSTAT::, to stat a file: *note STAT::
|
7169 |
|
|
|
7170 |
|
|
|
7171 |
|
|
File: gfortran.info, Node: FTELL, Next: GAMMA, Prev: FSTAT, Up: Intrinsic Procedures
|
7172 |
|
|
|
7173 |
|
|
8.84 `FTELL' -- Current stream position
|
7174 |
|
|
=======================================
|
7175 |
|
|
|
7176 |
|
|
_Description_:
|
7177 |
|
|
Retrieves the current position within an open file.
|
7178 |
|
|
|
7179 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
7180 |
|
|
however, only one form can be used in any given program unit.
|
7181 |
|
|
|
7182 |
|
|
_Standard_:
|
7183 |
|
|
GNU extension
|
7184 |
|
|
|
7185 |
|
|
_Class_:
|
7186 |
|
|
Subroutine, function
|
7187 |
|
|
|
7188 |
|
|
_Syntax_:
|
7189 |
|
|
`CALL FTELL(UNIT, OFFSET)'
|
7190 |
|
|
`OFFSET = FTELL(UNIT)'
|
7191 |
|
|
|
7192 |
|
|
_Arguments_:
|
7193 |
|
|
OFFSET Shall of type `INTEGER'.
|
7194 |
|
|
UNIT Shall of type `INTEGER'.
|
7195 |
|
|
|
7196 |
|
|
_Return value_:
|
7197 |
|
|
In either syntax, OFFSET is set to the current offset of unit
|
7198 |
|
|
number UNIT, or to -1 if the unit is not currently open.
|
7199 |
|
|
|
7200 |
|
|
_Example_:
|
7201 |
|
|
PROGRAM test_ftell
|
7202 |
|
|
INTEGER :: i
|
7203 |
|
|
OPEN(10, FILE="temp.dat")
|
7204 |
|
|
CALL ftell(10,i)
|
7205 |
|
|
WRITE(*,*) i
|
7206 |
|
|
END PROGRAM
|
7207 |
|
|
|
7208 |
|
|
_See also_:
|
7209 |
|
|
*note FSEEK::
|
7210 |
|
|
|
7211 |
|
|
|
7212 |
|
|
File: gfortran.info, Node: GAMMA, Next: GERROR, Prev: FTELL, Up: Intrinsic Procedures
|
7213 |
|
|
|
7214 |
|
|
8.85 `GAMMA' -- Gamma function
|
7215 |
|
|
==============================
|
7216 |
|
|
|
7217 |
|
|
_Description_:
|
7218 |
|
|
`GAMMA(X)' computes Gamma (\Gamma) of X. For positive, integer
|
7219 |
|
|
values of X the Gamma function simplifies to the factorial
|
7220 |
|
|
function \Gamma(x)=(x-1)!.
|
7221 |
|
|
|
7222 |
|
|
_Standard_:
|
7223 |
|
|
Fortran 2008 and later
|
7224 |
|
|
|
7225 |
|
|
_Class_:
|
7226 |
|
|
Elemental function
|
7227 |
|
|
|
7228 |
|
|
_Syntax_:
|
7229 |
|
|
`X = GAMMA(X)'
|
7230 |
|
|
|
7231 |
|
|
_Arguments_:
|
7232 |
|
|
X Shall be of type `REAL' and neither zero nor a
|
7233 |
|
|
negative integer.
|
7234 |
|
|
|
7235 |
|
|
_Return value_:
|
7236 |
|
|
The return value is of type `REAL' of the same kind as X.
|
7237 |
|
|
|
7238 |
|
|
_Example_:
|
7239 |
|
|
program test_gamma
|
7240 |
|
|
real :: x = 1.0
|
7241 |
|
|
x = gamma(x) ! returns 1.0
|
7242 |
|
|
end program test_gamma
|
7243 |
|
|
|
7244 |
|
|
_Specific names_:
|
7245 |
|
|
Name Argument Return type Standard
|
7246 |
|
|
`GAMMA(X)' `REAL(4) X' `REAL(4)' GNU Extension
|
7247 |
|
|
`DGAMMA(X)' `REAL(8) X' `REAL(8)' GNU Extension
|
7248 |
|
|
|
7249 |
|
|
_See also_:
|
7250 |
|
|
Logarithm of the Gamma function: *note LOG_GAMMA::
|
7251 |
|
|
|
7252 |
|
|
|
7253 |
|
|
|
7254 |
|
|
File: gfortran.info, Node: GERROR, Next: GETARG, Prev: GAMMA, Up: Intrinsic Procedures
|
7255 |
|
|
|
7256 |
|
|
8.86 `GERROR' -- Get last system error message
|
7257 |
|
|
==============================================
|
7258 |
|
|
|
7259 |
|
|
_Description_:
|
7260 |
|
|
Returns the system error message corresponding to the last system
|
7261 |
|
|
error. This resembles the functionality of `strerror(3)' in C.
|
7262 |
|
|
|
7263 |
|
|
_Standard_:
|
7264 |
|
|
GNU extension
|
7265 |
|
|
|
7266 |
|
|
_Class_:
|
7267 |
|
|
Subroutine
|
7268 |
|
|
|
7269 |
|
|
_Syntax_:
|
7270 |
|
|
`CALL GERROR(RESULT)'
|
7271 |
|
|
|
7272 |
|
|
_Arguments_:
|
7273 |
|
|
RESULT Shall of type `CHARACTER' and of default
|
7274 |
|
|
|
7275 |
|
|
_Example_:
|
7276 |
|
|
PROGRAM test_gerror
|
7277 |
|
|
CHARACTER(len=100) :: msg
|
7278 |
|
|
CALL gerror(msg)
|
7279 |
|
|
WRITE(*,*) msg
|
7280 |
|
|
END PROGRAM
|
7281 |
|
|
|
7282 |
|
|
_See also_:
|
7283 |
|
|
*note IERRNO::, *note PERROR::
|
7284 |
|
|
|
7285 |
|
|
|
7286 |
|
|
File: gfortran.info, Node: GETARG, Next: GET_COMMAND, Prev: GERROR, Up: Intrinsic Procedures
|
7287 |
|
|
|
7288 |
|
|
8.87 `GETARG' -- Get command line arguments
|
7289 |
|
|
===========================================
|
7290 |
|
|
|
7291 |
|
|
_Description_:
|
7292 |
|
|
Retrieve the POS-th argument that was passed on the command line
|
7293 |
|
|
when the containing program was invoked.
|
7294 |
|
|
|
7295 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
7296 |
|
|
GNU Fortran 77. In new code, programmers should consider the use
|
7297 |
|
|
of the *note GET_COMMAND_ARGUMENT:: intrinsic defined by the
|
7298 |
|
|
Fortran 2003 standard.
|
7299 |
|
|
|
7300 |
|
|
_Standard_:
|
7301 |
|
|
GNU extension
|
7302 |
|
|
|
7303 |
|
|
_Class_:
|
7304 |
|
|
Subroutine
|
7305 |
|
|
|
7306 |
|
|
_Syntax_:
|
7307 |
|
|
`CALL GETARG(POS, VALUE)'
|
7308 |
|
|
|
7309 |
|
|
_Arguments_:
|
7310 |
|
|
POS Shall be of type `INTEGER' and not wider than
|
7311 |
|
|
the default integer kind; POS \geq 0
|
7312 |
|
|
VALUE Shall be of type `CHARACTER' and of default
|
7313 |
|
|
kind.
|
7314 |
|
|
VALUE Shall be of type `CHARACTER'.
|
7315 |
|
|
|
7316 |
|
|
_Return value_:
|
7317 |
|
|
After `GETARG' returns, the VALUE argument holds the POSth command
|
7318 |
|
|
line argument. If VALUE can not hold the argument, it is truncated
|
7319 |
|
|
to fit the length of VALUE. If there are less than POS arguments
|
7320 |
|
|
specified at the command line, VALUE will be filled with blanks.
|
7321 |
|
|
If POS = 0, VALUE is set to the name of the program (on systems
|
7322 |
|
|
that support this feature).
|
7323 |
|
|
|
7324 |
|
|
_Example_:
|
7325 |
|
|
PROGRAM test_getarg
|
7326 |
|
|
INTEGER :: i
|
7327 |
|
|
CHARACTER(len=32) :: arg
|
7328 |
|
|
|
7329 |
|
|
DO i = 1, iargc()
|
7330 |
|
|
CALL getarg(i, arg)
|
7331 |
|
|
WRITE (*,*) arg
|
7332 |
|
|
END DO
|
7333 |
|
|
END PROGRAM
|
7334 |
|
|
|
7335 |
|
|
_See also_:
|
7336 |
|
|
GNU Fortran 77 compatibility function: *note IARGC::
|
7337 |
|
|
|
7338 |
|
|
Fortran 2003 functions and subroutines: *note GET_COMMAND::, *note
|
7339 |
|
|
GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT::
|
7340 |
|
|
|
7341 |
|
|
|
7342 |
|
|
File: gfortran.info, Node: GET_COMMAND, Next: GET_COMMAND_ARGUMENT, Prev: GETARG, Up: Intrinsic Procedures
|
7343 |
|
|
|
7344 |
|
|
8.88 `GET_COMMAND' -- Get the entire command line
|
7345 |
|
|
=================================================
|
7346 |
|
|
|
7347 |
|
|
_Description_:
|
7348 |
|
|
Retrieve the entire command line that was used to invoke the
|
7349 |
|
|
program.
|
7350 |
|
|
|
7351 |
|
|
_Standard_:
|
7352 |
|
|
Fortran 2003 and later
|
7353 |
|
|
|
7354 |
|
|
_Class_:
|
7355 |
|
|
Subroutine
|
7356 |
|
|
|
7357 |
|
|
_Syntax_:
|
7358 |
|
|
`CALL GET_COMMAND([COMMAND, LENGTH, STATUS])'
|
7359 |
|
|
|
7360 |
|
|
_Arguments_:
|
7361 |
|
|
COMMAND (Optional) shall be of type `CHARACTER' and of
|
7362 |
|
|
default kind.
|
7363 |
|
|
LENGTH (Optional) Shall be of type `INTEGER' and of
|
7364 |
|
|
default kind.
|
7365 |
|
|
STATUS (Optional) Shall be of type `INTEGER' and of
|
7366 |
|
|
default kind.
|
7367 |
|
|
|
7368 |
|
|
_Return value_:
|
7369 |
|
|
If COMMAND is present, stores the entire command line that was used
|
7370 |
|
|
to invoke the program in COMMAND. If LENGTH is present, it is
|
7371 |
|
|
assigned the length of the command line. If STATUS is present, it
|
7372 |
|
|
is assigned 0 upon success of the command, -1 if COMMAND is too
|
7373 |
|
|
short to store the command line, or a positive value in case of an
|
7374 |
|
|
error.
|
7375 |
|
|
|
7376 |
|
|
_Example_:
|
7377 |
|
|
PROGRAM test_get_command
|
7378 |
|
|
CHARACTER(len=255) :: cmd
|
7379 |
|
|
CALL get_command(cmd)
|
7380 |
|
|
WRITE (*,*) TRIM(cmd)
|
7381 |
|
|
END PROGRAM
|
7382 |
|
|
|
7383 |
|
|
_See also_:
|
7384 |
|
|
*note GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT::
|
7385 |
|
|
|
7386 |
|
|
|
7387 |
|
|
File: gfortran.info, Node: GET_COMMAND_ARGUMENT, Next: GETCWD, Prev: GET_COMMAND, Up: Intrinsic Procedures
|
7388 |
|
|
|
7389 |
|
|
8.89 `GET_COMMAND_ARGUMENT' -- Get command line arguments
|
7390 |
|
|
=========================================================
|
7391 |
|
|
|
7392 |
|
|
_Description_:
|
7393 |
|
|
Retrieve the NUMBER-th argument that was passed on the command
|
7394 |
|
|
line when the containing program was invoked.
|
7395 |
|
|
|
7396 |
|
|
_Standard_:
|
7397 |
|
|
Fortran 2003 and later
|
7398 |
|
|
|
7399 |
|
|
_Class_:
|
7400 |
|
|
Subroutine
|
7401 |
|
|
|
7402 |
|
|
_Syntax_:
|
7403 |
|
|
`CALL GET_COMMAND_ARGUMENT(NUMBER [, VALUE, LENGTH, STATUS])'
|
7404 |
|
|
|
7405 |
|
|
_Arguments_:
|
7406 |
|
|
NUMBER Shall be a scalar of type `INTEGER' and of
|
7407 |
|
|
default kind, NUMBER \geq 0
|
7408 |
|
|
VALUE Shall be a scalar of type `CHARACTER' and of
|
7409 |
|
|
default kind.
|
7410 |
|
|
LENGTH (Option) Shall be a scalar of type `INTEGER'
|
7411 |
|
|
and of default kind.
|
7412 |
|
|
STATUS (Option) Shall be a scalar of type `INTEGER'
|
7413 |
|
|
and of default kind.
|
7414 |
|
|
|
7415 |
|
|
_Return value_:
|
7416 |
|
|
After `GET_COMMAND_ARGUMENT' returns, the VALUE argument holds the
|
7417 |
|
|
NUMBER-th command line argument. If VALUE can not hold the
|
7418 |
|
|
argument, it is truncated to fit the length of VALUE. If there are
|
7419 |
|
|
less than NUMBER arguments specified at the command line, VALUE
|
7420 |
|
|
will be filled with blanks. If NUMBER = 0, VALUE is set to the
|
7421 |
|
|
name of the program (on systems that support this feature). The
|
7422 |
|
|
LENGTH argument contains the length of the NUMBER-th command line
|
7423 |
|
|
argument. If the argument retrieval fails, STATUS is a positive
|
7424 |
|
|
number; if VALUE contains a truncated command line argument,
|
7425 |
|
|
STATUS is -1; and otherwise the STATUS is zero.
|
7426 |
|
|
|
7427 |
|
|
_Example_:
|
7428 |
|
|
PROGRAM test_get_command_argument
|
7429 |
|
|
INTEGER :: i
|
7430 |
|
|
CHARACTER(len=32) :: arg
|
7431 |
|
|
|
7432 |
|
|
i = 0
|
7433 |
|
|
DO
|
7434 |
|
|
CALL get_command_argument(i, arg)
|
7435 |
|
|
IF (LEN_TRIM(arg) == 0) EXIT
|
7436 |
|
|
|
7437 |
|
|
WRITE (*,*) TRIM(arg)
|
7438 |
|
|
i = i+1
|
7439 |
|
|
END DO
|
7440 |
|
|
END PROGRAM
|
7441 |
|
|
|
7442 |
|
|
_See also_:
|
7443 |
|
|
*note GET_COMMAND::, *note COMMAND_ARGUMENT_COUNT::
|
7444 |
|
|
|
7445 |
|
|
|
7446 |
|
|
File: gfortran.info, Node: GETCWD, Next: GETENV, Prev: GET_COMMAND_ARGUMENT, Up: Intrinsic Procedures
|
7447 |
|
|
|
7448 |
|
|
8.90 `GETCWD' -- Get current working directory
|
7449 |
|
|
==============================================
|
7450 |
|
|
|
7451 |
|
|
_Description_:
|
7452 |
|
|
Get current working directory.
|
7453 |
|
|
|
7454 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
7455 |
|
|
however, only one form can be used in any given program unit.
|
7456 |
|
|
|
7457 |
|
|
_Standard_:
|
7458 |
|
|
GNU extension
|
7459 |
|
|
|
7460 |
|
|
_Class_:
|
7461 |
|
|
Subroutine, function
|
7462 |
|
|
|
7463 |
|
|
_Syntax_:
|
7464 |
|
|
`CALL GETCWD(C [, STATUS])'
|
7465 |
|
|
|
7466 |
|
|
_Arguments_:
|
7467 |
|
|
C The type shall be `CHARACTER' and of default
|
7468 |
|
|
kind.
|
7469 |
|
|
STATUS (Optional) status flag. Returns 0 on success,
|
7470 |
|
|
a system specific and nonzero error code
|
7471 |
|
|
otherwise.
|
7472 |
|
|
|
7473 |
|
|
_Example_:
|
7474 |
|
|
PROGRAM test_getcwd
|
7475 |
|
|
CHARACTER(len=255) :: cwd
|
7476 |
|
|
CALL getcwd(cwd)
|
7477 |
|
|
WRITE(*,*) TRIM(cwd)
|
7478 |
|
|
END PROGRAM
|
7479 |
|
|
|
7480 |
|
|
_See also_:
|
7481 |
|
|
*note CHDIR::
|
7482 |
|
|
|
7483 |
|
|
|
7484 |
|
|
File: gfortran.info, Node: GETENV, Next: GET_ENVIRONMENT_VARIABLE, Prev: GETCWD, Up: Intrinsic Procedures
|
7485 |
|
|
|
7486 |
|
|
8.91 `GETENV' -- Get an environmental variable
|
7487 |
|
|
==============================================
|
7488 |
|
|
|
7489 |
|
|
_Description_:
|
7490 |
|
|
Get the VALUE of the environmental variable NAME.
|
7491 |
|
|
|
7492 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
7493 |
|
|
GNU Fortran 77. In new code, programmers should consider the use
|
7494 |
|
|
of the *note GET_ENVIRONMENT_VARIABLE:: intrinsic defined by the
|
7495 |
|
|
Fortran 2003 standard.
|
7496 |
|
|
|
7497 |
|
|
_Standard_:
|
7498 |
|
|
GNU extension
|
7499 |
|
|
|
7500 |
|
|
_Class_:
|
7501 |
|
|
Subroutine
|
7502 |
|
|
|
7503 |
|
|
_Syntax_:
|
7504 |
|
|
`CALL GETENV(NAME, VALUE)'
|
7505 |
|
|
|
7506 |
|
|
_Arguments_:
|
7507 |
|
|
NAME Shall be of type `CHARACTER' and of default
|
7508 |
|
|
kind.
|
7509 |
|
|
VALUE Shall be of type `CHARACTER' and of default
|
7510 |
|
|
kind.
|
7511 |
|
|
|
7512 |
|
|
_Return value_:
|
7513 |
|
|
Stores the value of NAME in VALUE. If VALUE is not large enough to
|
7514 |
|
|
hold the data, it is truncated. If NAME is not set, VALUE will be
|
7515 |
|
|
filled with blanks.
|
7516 |
|
|
|
7517 |
|
|
_Example_:
|
7518 |
|
|
PROGRAM test_getenv
|
7519 |
|
|
CHARACTER(len=255) :: homedir
|
7520 |
|
|
CALL getenv("HOME", homedir)
|
7521 |
|
|
WRITE (*,*) TRIM(homedir)
|
7522 |
|
|
END PROGRAM
|
7523 |
|
|
|
7524 |
|
|
_See also_:
|
7525 |
|
|
*note GET_ENVIRONMENT_VARIABLE::
|
7526 |
|
|
|
7527 |
|
|
|
7528 |
|
|
File: gfortran.info, Node: GET_ENVIRONMENT_VARIABLE, Next: GETGID, Prev: GETENV, Up: Intrinsic Procedures
|
7529 |
|
|
|
7530 |
|
|
8.92 `GET_ENVIRONMENT_VARIABLE' -- Get an environmental variable
|
7531 |
|
|
================================================================
|
7532 |
|
|
|
7533 |
|
|
_Description_:
|
7534 |
|
|
Get the VALUE of the environmental variable NAME.
|
7535 |
|
|
|
7536 |
|
|
_Standard_:
|
7537 |
|
|
Fortran 2003 and later
|
7538 |
|
|
|
7539 |
|
|
_Class_:
|
7540 |
|
|
Subroutine
|
7541 |
|
|
|
7542 |
|
|
_Syntax_:
|
7543 |
|
|
`CALL GET_ENVIRONMENT_VARIABLE(NAME[, VALUE, LENGTH, STATUS,
|
7544 |
|
|
TRIM_NAME)'
|
7545 |
|
|
|
7546 |
|
|
_Arguments_:
|
7547 |
|
|
NAME Shall be a scalar of type `CHARACTER' and of
|
7548 |
|
|
default kind.
|
7549 |
|
|
VALUE Shall be a scalar of type `CHARACTER' and of
|
7550 |
|
|
default kind.
|
7551 |
|
|
LENGTH Shall be a scalar of type `INTEGER' and of
|
7552 |
|
|
default kind.
|
7553 |
|
|
STATUS Shall be a scalar of type `INTEGER' and of
|
7554 |
|
|
default kind.
|
7555 |
|
|
TRIM_NAME Shall be a scalar of type `LOGICAL' and of
|
7556 |
|
|
default kind.
|
7557 |
|
|
|
7558 |
|
|
_Return value_:
|
7559 |
|
|
Stores the value of NAME in VALUE. If VALUE is not large enough to
|
7560 |
|
|
hold the data, it is truncated. If NAME is not set, VALUE will be
|
7561 |
|
|
filled with blanks. Argument LENGTH contains the length needed for
|
7562 |
|
|
storing the environment variable NAME or zero if it is not
|
7563 |
|
|
present. STATUS is -1 if VALUE is present but too short for the
|
7564 |
|
|
environment variable; it is 1 if the environment variable does not
|
7565 |
|
|
exist and 2 if the processor does not support environment
|
7566 |
|
|
variables; in all other cases STATUS is zero. If TRIM_NAME is
|
7567 |
|
|
present with the value `.FALSE.', the trailing blanks in NAME are
|
7568 |
|
|
significant; otherwise they are not part of the environment
|
7569 |
|
|
variable name.
|
7570 |
|
|
|
7571 |
|
|
_Example_:
|
7572 |
|
|
PROGRAM test_getenv
|
7573 |
|
|
CHARACTER(len=255) :: homedir
|
7574 |
|
|
CALL get_environment_variable("HOME", homedir)
|
7575 |
|
|
WRITE (*,*) TRIM(homedir)
|
7576 |
|
|
END PROGRAM
|
7577 |
|
|
|
7578 |
|
|
|
7579 |
|
|
File: gfortran.info, Node: GETGID, Next: GETLOG, Prev: GET_ENVIRONMENT_VARIABLE, Up: Intrinsic Procedures
|
7580 |
|
|
|
7581 |
|
|
8.93 `GETGID' -- Group ID function
|
7582 |
|
|
==================================
|
7583 |
|
|
|
7584 |
|
|
_Description_:
|
7585 |
|
|
Returns the numerical group ID of the current process.
|
7586 |
|
|
|
7587 |
|
|
_Standard_:
|
7588 |
|
|
GNU extension
|
7589 |
|
|
|
7590 |
|
|
_Class_:
|
7591 |
|
|
Function
|
7592 |
|
|
|
7593 |
|
|
_Syntax_:
|
7594 |
|
|
`RESULT = GETGID()'
|
7595 |
|
|
|
7596 |
|
|
_Return value_:
|
7597 |
|
|
The return value of `GETGID' is an `INTEGER' of the default kind.
|
7598 |
|
|
|
7599 |
|
|
_Example_:
|
7600 |
|
|
See `GETPID' for an example.
|
7601 |
|
|
|
7602 |
|
|
_See also_:
|
7603 |
|
|
*note GETPID::, *note GETUID::
|
7604 |
|
|
|
7605 |
|
|
|
7606 |
|
|
File: gfortran.info, Node: GETLOG, Next: GETPID, Prev: GETGID, Up: Intrinsic Procedures
|
7607 |
|
|
|
7608 |
|
|
8.94 `GETLOG' -- Get login name
|
7609 |
|
|
===============================
|
7610 |
|
|
|
7611 |
|
|
_Description_:
|
7612 |
|
|
Gets the username under which the program is running.
|
7613 |
|
|
|
7614 |
|
|
_Standard_:
|
7615 |
|
|
GNU extension
|
7616 |
|
|
|
7617 |
|
|
_Class_:
|
7618 |
|
|
Subroutine
|
7619 |
|
|
|
7620 |
|
|
_Syntax_:
|
7621 |
|
|
`CALL GETLOG(C)'
|
7622 |
|
|
|
7623 |
|
|
_Arguments_:
|
7624 |
|
|
C Shall be of type `CHARACTER' and of default
|
7625 |
|
|
kind.
|
7626 |
|
|
|
7627 |
|
|
_Return value_:
|
7628 |
|
|
Stores the current user name in LOGIN. (On systems where POSIX
|
7629 |
|
|
functions `geteuid' and `getpwuid' are not available, and the
|
7630 |
|
|
`getlogin' function is not implemented either, this will return a
|
7631 |
|
|
blank string.)
|
7632 |
|
|
|
7633 |
|
|
_Example_:
|
7634 |
|
|
PROGRAM TEST_GETLOG
|
7635 |
|
|
CHARACTER(32) :: login
|
7636 |
|
|
CALL GETLOG(login)
|
7637 |
|
|
WRITE(*,*) login
|
7638 |
|
|
END PROGRAM
|
7639 |
|
|
|
7640 |
|
|
_See also_:
|
7641 |
|
|
*note GETUID::
|
7642 |
|
|
|
7643 |
|
|
|
7644 |
|
|
File: gfortran.info, Node: GETPID, Next: GETUID, Prev: GETLOG, Up: Intrinsic Procedures
|
7645 |
|
|
|
7646 |
|
|
8.95 `GETPID' -- Process ID function
|
7647 |
|
|
====================================
|
7648 |
|
|
|
7649 |
|
|
_Description_:
|
7650 |
|
|
Returns the numerical process identifier of the current process.
|
7651 |
|
|
|
7652 |
|
|
_Standard_:
|
7653 |
|
|
GNU extension
|
7654 |
|
|
|
7655 |
|
|
_Class_:
|
7656 |
|
|
Function
|
7657 |
|
|
|
7658 |
|
|
_Syntax_:
|
7659 |
|
|
`RESULT = GETPID()'
|
7660 |
|
|
|
7661 |
|
|
_Return value_:
|
7662 |
|
|
The return value of `GETPID' is an `INTEGER' of the default kind.
|
7663 |
|
|
|
7664 |
|
|
_Example_:
|
7665 |
|
|
program info
|
7666 |
|
|
print *, "The current process ID is ", getpid()
|
7667 |
|
|
print *, "Your numerical user ID is ", getuid()
|
7668 |
|
|
print *, "Your numerical group ID is ", getgid()
|
7669 |
|
|
end program info
|
7670 |
|
|
|
7671 |
|
|
_See also_:
|
7672 |
|
|
*note GETGID::, *note GETUID::
|
7673 |
|
|
|
7674 |
|
|
|
7675 |
|
|
File: gfortran.info, Node: GETUID, Next: GMTIME, Prev: GETPID, Up: Intrinsic Procedures
|
7676 |
|
|
|
7677 |
|
|
8.96 `GETUID' -- User ID function
|
7678 |
|
|
=================================
|
7679 |
|
|
|
7680 |
|
|
_Description_:
|
7681 |
|
|
Returns the numerical user ID of the current process.
|
7682 |
|
|
|
7683 |
|
|
_Standard_:
|
7684 |
|
|
GNU extension
|
7685 |
|
|
|
7686 |
|
|
_Class_:
|
7687 |
|
|
Function
|
7688 |
|
|
|
7689 |
|
|
_Syntax_:
|
7690 |
|
|
`RESULT = GETUID()'
|
7691 |
|
|
|
7692 |
|
|
_Return value_:
|
7693 |
|
|
The return value of `GETUID' is an `INTEGER' of the default kind.
|
7694 |
|
|
|
7695 |
|
|
_Example_:
|
7696 |
|
|
See `GETPID' for an example.
|
7697 |
|
|
|
7698 |
|
|
_See also_:
|
7699 |
|
|
*note GETPID::, *note GETLOG::
|
7700 |
|
|
|
7701 |
|
|
|
7702 |
|
|
File: gfortran.info, Node: GMTIME, Next: HOSTNM, Prev: GETUID, Up: Intrinsic Procedures
|
7703 |
|
|
|
7704 |
|
|
8.97 `GMTIME' -- Convert time to GMT info
|
7705 |
|
|
=========================================
|
7706 |
|
|
|
7707 |
|
|
_Description_:
|
7708 |
|
|
Given a system time value TIME (as provided by the `TIME8()'
|
7709 |
|
|
intrinsic), fills VALUES with values extracted from it appropriate
|
7710 |
|
|
to the UTC time zone (Universal Coordinated Time, also known in
|
7711 |
|
|
some countries as GMT, Greenwich Mean Time), using `gmtime(3)'.
|
7712 |
|
|
|
7713 |
|
|
_Standard_:
|
7714 |
|
|
GNU extension
|
7715 |
|
|
|
7716 |
|
|
_Class_:
|
7717 |
|
|
Subroutine
|
7718 |
|
|
|
7719 |
|
|
_Syntax_:
|
7720 |
|
|
`CALL GMTIME(TIME, VALUES)'
|
7721 |
|
|
|
7722 |
|
|
_Arguments_:
|
7723 |
|
|
TIME An `INTEGER' scalar expression corresponding
|
7724 |
|
|
to a system time, with `INTENT(IN)'.
|
7725 |
|
|
VALUES A default `INTEGER' array with 9 elements,
|
7726 |
|
|
with `INTENT(OUT)'.
|
7727 |
|
|
|
7728 |
|
|
_Return value_:
|
7729 |
|
|
The elements of VALUES are assigned as follows:
|
7730 |
|
|
1. Seconds after the minute, range 0-59 or 0-61 to allow for leap
|
7731 |
|
|
seconds
|
7732 |
|
|
|
7733 |
|
|
2. Minutes after the hour, range 0-59
|
7734 |
|
|
|
7735 |
|
|
3. Hours past midnight, range 0-23
|
7736 |
|
|
|
7737 |
|
|
4. Day of month, range 0-31
|
7738 |
|
|
|
7739 |
|
|
5. Number of months since January, range 0-12
|
7740 |
|
|
|
7741 |
|
|
6. Years since 1900
|
7742 |
|
|
|
7743 |
|
|
7. Number of days since Sunday, range 0-6
|
7744 |
|
|
|
7745 |
|
|
8. Days since January 1
|
7746 |
|
|
|
7747 |
|
|
9. Daylight savings indicator: positive if daylight savings is in
|
7748 |
|
|
effect, zero if not, and negative if the information is not
|
7749 |
|
|
available.
|
7750 |
|
|
|
7751 |
|
|
_See also_:
|
7752 |
|
|
*note CTIME::, *note LTIME::, *note TIME::, *note TIME8::
|
7753 |
|
|
|
7754 |
|
|
|
7755 |
|
|
|
7756 |
|
|
File: gfortran.info, Node: HOSTNM, Next: HUGE, Prev: GMTIME, Up: Intrinsic Procedures
|
7757 |
|
|
|
7758 |
|
|
8.98 `HOSTNM' -- Get system host name
|
7759 |
|
|
=====================================
|
7760 |
|
|
|
7761 |
|
|
_Description_:
|
7762 |
|
|
Retrieves the host name of the system on which the program is
|
7763 |
|
|
running.
|
7764 |
|
|
|
7765 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
7766 |
|
|
however, only one form can be used in any given program unit.
|
7767 |
|
|
|
7768 |
|
|
_Standard_:
|
7769 |
|
|
GNU extension
|
7770 |
|
|
|
7771 |
|
|
_Class_:
|
7772 |
|
|
Subroutine, function
|
7773 |
|
|
|
7774 |
|
|
_Syntax_:
|
7775 |
|
|
`CALL HOSTNM(C [, STATUS])'
|
7776 |
|
|
`STATUS = HOSTNM(NAME)'
|
7777 |
|
|
|
7778 |
|
|
_Arguments_:
|
7779 |
|
|
C Shall of type `CHARACTER' and of default kind.
|
7780 |
|
|
STATUS (Optional) status flag of type `INTEGER'.
|
7781 |
|
|
Returns 0 on success, or a system specific
|
7782 |
|
|
error code otherwise.
|
7783 |
|
|
|
7784 |
|
|
_Return value_:
|
7785 |
|
|
In either syntax, NAME is set to the current hostname if it can be
|
7786 |
|
|
obtained, or to a blank string otherwise.
|
7787 |
|
|
|
7788 |
|
|
|
7789 |
|
|
|
7790 |
|
|
File: gfortran.info, Node: HUGE, Next: HYPOT, Prev: HOSTNM, Up: Intrinsic Procedures
|
7791 |
|
|
|
7792 |
|
|
8.99 `HUGE' -- Largest number of a kind
|
7793 |
|
|
=======================================
|
7794 |
|
|
|
7795 |
|
|
_Description_:
|
7796 |
|
|
`HUGE(X)' returns the largest number that is not an infinity in
|
7797 |
|
|
the model of the type of `X'.
|
7798 |
|
|
|
7799 |
|
|
_Standard_:
|
7800 |
|
|
Fortran 95 and later
|
7801 |
|
|
|
7802 |
|
|
_Class_:
|
7803 |
|
|
Inquiry function
|
7804 |
|
|
|
7805 |
|
|
_Syntax_:
|
7806 |
|
|
`RESULT = HUGE(X)'
|
7807 |
|
|
|
7808 |
|
|
_Arguments_:
|
7809 |
|
|
X Shall be of type `REAL' or `INTEGER'.
|
7810 |
|
|
|
7811 |
|
|
_Return value_:
|
7812 |
|
|
The return value is of the same type and kind as X
|
7813 |
|
|
|
7814 |
|
|
_Example_:
|
7815 |
|
|
program test_huge_tiny
|
7816 |
|
|
print *, huge(0), huge(0.0), huge(0.0d0)
|
7817 |
|
|
print *, tiny(0.0), tiny(0.0d0)
|
7818 |
|
|
end program test_huge_tiny
|
7819 |
|
|
|
7820 |
|
|
|
7821 |
|
|
File: gfortran.info, Node: HYPOT, Next: IACHAR, Prev: HUGE, Up: Intrinsic Procedures
|
7822 |
|
|
|
7823 |
|
|
8.100 `HYPOT' -- Euclidean distance function
|
7824 |
|
|
============================================
|
7825 |
|
|
|
7826 |
|
|
_Description_:
|
7827 |
|
|
`HYPOT(X,Y)' is the Euclidean distance function. It is equal to
|
7828 |
|
|
\sqrtX^2 + Y^2, without undue underflow or overflow.
|
7829 |
|
|
|
7830 |
|
|
_Standard_:
|
7831 |
|
|
Fortran 2008 and later
|
7832 |
|
|
|
7833 |
|
|
_Class_:
|
7834 |
|
|
Elemental function
|
7835 |
|
|
|
7836 |
|
|
_Syntax_:
|
7837 |
|
|
`RESULT = HYPOT(X, Y)'
|
7838 |
|
|
|
7839 |
|
|
_Arguments_:
|
7840 |
|
|
X The type shall be `REAL'.
|
7841 |
|
|
Y The type and kind type parameter shall be the
|
7842 |
|
|
same as X.
|
7843 |
|
|
|
7844 |
|
|
_Return value_:
|
7845 |
|
|
The return value has the same type and kind type parameter as X.
|
7846 |
|
|
|
7847 |
|
|
_Example_:
|
7848 |
|
|
program test_hypot
|
7849 |
|
|
real(4) :: x = 1.e0_4, y = 0.5e0_4
|
7850 |
|
|
x = hypot(x,y)
|
7851 |
|
|
end program test_hypot
|
7852 |
|
|
|
7853 |
|
|
|
7854 |
|
|
File: gfortran.info, Node: IACHAR, Next: IAND, Prev: HYPOT, Up: Intrinsic Procedures
|
7855 |
|
|
|
7856 |
|
|
8.101 `IACHAR' -- Code in ASCII collating sequence
|
7857 |
|
|
==================================================
|
7858 |
|
|
|
7859 |
|
|
_Description_:
|
7860 |
|
|
`IACHAR(C)' returns the code for the ASCII character in the first
|
7861 |
|
|
character position of `C'.
|
7862 |
|
|
|
7863 |
|
|
_Standard_:
|
7864 |
|
|
Fortran 95 and later, with KIND argument Fortran 2003 and later
|
7865 |
|
|
|
7866 |
|
|
_Class_:
|
7867 |
|
|
Elemental function
|
7868 |
|
|
|
7869 |
|
|
_Syntax_:
|
7870 |
|
|
`RESULT = IACHAR(C [, KIND])'
|
7871 |
|
|
|
7872 |
|
|
_Arguments_:
|
7873 |
|
|
C Shall be a scalar `CHARACTER', with
|
7874 |
|
|
`INTENT(IN)'
|
7875 |
|
|
KIND (Optional) An `INTEGER' initialization
|
7876 |
|
|
expression indicating the kind parameter of
|
7877 |
|
|
the result.
|
7878 |
|
|
|
7879 |
|
|
_Return value_:
|
7880 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
7881 |
|
|
absent, the return value is of default integer kind.
|
7882 |
|
|
|
7883 |
|
|
_Example_:
|
7884 |
|
|
program test_iachar
|
7885 |
|
|
integer i
|
7886 |
|
|
i = iachar(' ')
|
7887 |
|
|
end program test_iachar
|
7888 |
|
|
|
7889 |
|
|
_Note_:
|
7890 |
|
|
See *note ICHAR:: for a discussion of converting between numerical
|
7891 |
|
|
values and formatted string representations.
|
7892 |
|
|
|
7893 |
|
|
_See also_:
|
7894 |
|
|
*note ACHAR::, *note CHAR::, *note ICHAR::
|
7895 |
|
|
|
7896 |
|
|
|
7897 |
|
|
|
7898 |
|
|
File: gfortran.info, Node: IAND, Next: IARGC, Prev: IACHAR, Up: Intrinsic Procedures
|
7899 |
|
|
|
7900 |
|
|
8.102 `IAND' -- Bitwise logical and
|
7901 |
|
|
===================================
|
7902 |
|
|
|
7903 |
|
|
_Description_:
|
7904 |
|
|
Bitwise logical `AND'.
|
7905 |
|
|
|
7906 |
|
|
_Standard_:
|
7907 |
|
|
Fortran 95 and later
|
7908 |
|
|
|
7909 |
|
|
_Class_:
|
7910 |
|
|
Elemental function
|
7911 |
|
|
|
7912 |
|
|
_Syntax_:
|
7913 |
|
|
`RESULT = IAND(I, J)'
|
7914 |
|
|
|
7915 |
|
|
_Arguments_:
|
7916 |
|
|
I The type shall be `INTEGER'.
|
7917 |
|
|
J The type shall be `INTEGER', of the same kind
|
7918 |
|
|
as I. (As a GNU extension, different kinds
|
7919 |
|
|
are also permitted.)
|
7920 |
|
|
|
7921 |
|
|
_Return value_:
|
7922 |
|
|
The return type is `INTEGER', of the same kind as the arguments.
|
7923 |
|
|
(If the argument kinds differ, it is of the same kind as the
|
7924 |
|
|
larger argument.)
|
7925 |
|
|
|
7926 |
|
|
_Example_:
|
7927 |
|
|
PROGRAM test_iand
|
7928 |
|
|
INTEGER :: a, b
|
7929 |
|
|
DATA a / Z'F' /, b / Z'3' /
|
7930 |
|
|
WRITE (*,*) IAND(a, b)
|
7931 |
|
|
END PROGRAM
|
7932 |
|
|
|
7933 |
|
|
_See also_:
|
7934 |
|
|
*note IOR::, *note IEOR::, *note IBITS::, *note IBSET::, *note
|
7935 |
|
|
IBCLR::, *note NOT::
|
7936 |
|
|
|
7937 |
|
|
|
7938 |
|
|
|
7939 |
|
|
File: gfortran.info, Node: IARGC, Next: IBCLR, Prev: IAND, Up: Intrinsic Procedures
|
7940 |
|
|
|
7941 |
|
|
8.103 `IARGC' -- Get the number of command line arguments
|
7942 |
|
|
=========================================================
|
7943 |
|
|
|
7944 |
|
|
_Description_:
|
7945 |
|
|
`IARGC()' returns the number of arguments passed on the command
|
7946 |
|
|
line when the containing program was invoked.
|
7947 |
|
|
|
7948 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
7949 |
|
|
GNU Fortran 77. In new code, programmers should consider the use
|
7950 |
|
|
of the *note COMMAND_ARGUMENT_COUNT:: intrinsic defined by the
|
7951 |
|
|
Fortran 2003 standard.
|
7952 |
|
|
|
7953 |
|
|
_Standard_:
|
7954 |
|
|
GNU extension
|
7955 |
|
|
|
7956 |
|
|
_Class_:
|
7957 |
|
|
Function
|
7958 |
|
|
|
7959 |
|
|
_Syntax_:
|
7960 |
|
|
`RESULT = IARGC()'
|
7961 |
|
|
|
7962 |
|
|
_Arguments_:
|
7963 |
|
|
None.
|
7964 |
|
|
|
7965 |
|
|
_Return value_:
|
7966 |
|
|
The number of command line arguments, type `INTEGER(4)'.
|
7967 |
|
|
|
7968 |
|
|
_Example_:
|
7969 |
|
|
See *note GETARG::
|
7970 |
|
|
|
7971 |
|
|
_See also_:
|
7972 |
|
|
GNU Fortran 77 compatibility subroutine: *note GETARG::
|
7973 |
|
|
|
7974 |
|
|
Fortran 2003 functions and subroutines: *note GET_COMMAND::, *note
|
7975 |
|
|
GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT::
|
7976 |
|
|
|
7977 |
|
|
|
7978 |
|
|
File: gfortran.info, Node: IBCLR, Next: IBITS, Prev: IARGC, Up: Intrinsic Procedures
|
7979 |
|
|
|
7980 |
|
|
8.104 `IBCLR' -- Clear bit
|
7981 |
|
|
==========================
|
7982 |
|
|
|
7983 |
|
|
_Description_:
|
7984 |
|
|
`IBCLR' returns the value of I with the bit at position POS set to
|
7985 |
|
|
zero.
|
7986 |
|
|
|
7987 |
|
|
_Standard_:
|
7988 |
|
|
Fortran 95 and later
|
7989 |
|
|
|
7990 |
|
|
_Class_:
|
7991 |
|
|
Elemental function
|
7992 |
|
|
|
7993 |
|
|
_Syntax_:
|
7994 |
|
|
`RESULT = IBCLR(I, POS)'
|
7995 |
|
|
|
7996 |
|
|
_Arguments_:
|
7997 |
|
|
I The type shall be `INTEGER'.
|
7998 |
|
|
POS The type shall be `INTEGER'.
|
7999 |
|
|
|
8000 |
|
|
_Return value_:
|
8001 |
|
|
The return value is of type `INTEGER' and of the same kind as I.
|
8002 |
|
|
|
8003 |
|
|
_See also_:
|
8004 |
|
|
*note IBITS::, *note IBSET::, *note IAND::, *note IOR::, *note
|
8005 |
|
|
IEOR::, *note MVBITS::
|
8006 |
|
|
|
8007 |
|
|
|
8008 |
|
|
|
8009 |
|
|
File: gfortran.info, Node: IBITS, Next: IBSET, Prev: IBCLR, Up: Intrinsic Procedures
|
8010 |
|
|
|
8011 |
|
|
8.105 `IBITS' -- Bit extraction
|
8012 |
|
|
===============================
|
8013 |
|
|
|
8014 |
|
|
_Description_:
|
8015 |
|
|
`IBITS' extracts a field of length LEN from I, starting from bit
|
8016 |
|
|
position POS and extending left for LEN bits. The result is
|
8017 |
|
|
right-justified and the remaining bits are zeroed. The value of
|
8018 |
|
|
`POS+LEN' must be less than or equal to the value `BIT_SIZE(I)'.
|
8019 |
|
|
|
8020 |
|
|
_Standard_:
|
8021 |
|
|
Fortran 95 and later
|
8022 |
|
|
|
8023 |
|
|
_Class_:
|
8024 |
|
|
Elemental function
|
8025 |
|
|
|
8026 |
|
|
_Syntax_:
|
8027 |
|
|
`RESULT = IBITS(I, POS, LEN)'
|
8028 |
|
|
|
8029 |
|
|
_Arguments_:
|
8030 |
|
|
I The type shall be `INTEGER'.
|
8031 |
|
|
POS The type shall be `INTEGER'.
|
8032 |
|
|
LEN The type shall be `INTEGER'.
|
8033 |
|
|
|
8034 |
|
|
_Return value_:
|
8035 |
|
|
The return value is of type `INTEGER' and of the same kind as I.
|
8036 |
|
|
|
8037 |
|
|
_See also_:
|
8038 |
|
|
*note BIT_SIZE::, *note IBCLR::, *note IBSET::, *note IAND::,
|
8039 |
|
|
*note IOR::, *note IEOR::
|
8040 |
|
|
|
8041 |
|
|
|
8042 |
|
|
File: gfortran.info, Node: IBSET, Next: ICHAR, Prev: IBITS, Up: Intrinsic Procedures
|
8043 |
|
|
|
8044 |
|
|
8.106 `IBSET' -- Set bit
|
8045 |
|
|
========================
|
8046 |
|
|
|
8047 |
|
|
_Description_:
|
8048 |
|
|
`IBSET' returns the value of I with the bit at position POS set to
|
8049 |
|
|
one.
|
8050 |
|
|
|
8051 |
|
|
_Standard_:
|
8052 |
|
|
Fortran 95 and later
|
8053 |
|
|
|
8054 |
|
|
_Class_:
|
8055 |
|
|
Elemental function
|
8056 |
|
|
|
8057 |
|
|
_Syntax_:
|
8058 |
|
|
`RESULT = IBSET(I, POS)'
|
8059 |
|
|
|
8060 |
|
|
_Arguments_:
|
8061 |
|
|
I The type shall be `INTEGER'.
|
8062 |
|
|
POS The type shall be `INTEGER'.
|
8063 |
|
|
|
8064 |
|
|
_Return value_:
|
8065 |
|
|
The return value is of type `INTEGER' and of the same kind as I.
|
8066 |
|
|
|
8067 |
|
|
_See also_:
|
8068 |
|
|
*note IBCLR::, *note IBITS::, *note IAND::, *note IOR::, *note
|
8069 |
|
|
IEOR::, *note MVBITS::
|
8070 |
|
|
|
8071 |
|
|
|
8072 |
|
|
|
8073 |
|
|
File: gfortran.info, Node: ICHAR, Next: IDATE, Prev: IBSET, Up: Intrinsic Procedures
|
8074 |
|
|
|
8075 |
|
|
8.107 `ICHAR' -- Character-to-integer conversion function
|
8076 |
|
|
=========================================================
|
8077 |
|
|
|
8078 |
|
|
_Description_:
|
8079 |
|
|
`ICHAR(C)' returns the code for the character in the first
|
8080 |
|
|
character position of `C' in the system's native character set.
|
8081 |
|
|
The correspondence between characters and their codes is not
|
8082 |
|
|
necessarily the same across different GNU Fortran implementations.
|
8083 |
|
|
|
8084 |
|
|
_Standard_:
|
8085 |
|
|
Fortan 95 and later, with KIND argument Fortran 2003 and later
|
8086 |
|
|
|
8087 |
|
|
_Class_:
|
8088 |
|
|
Elemental function
|
8089 |
|
|
|
8090 |
|
|
_Syntax_:
|
8091 |
|
|
`RESULT = ICHAR(C [, KIND])'
|
8092 |
|
|
|
8093 |
|
|
_Arguments_:
|
8094 |
|
|
C Shall be a scalar `CHARACTER', with
|
8095 |
|
|
`INTENT(IN)'
|
8096 |
|
|
KIND (Optional) An `INTEGER' initialization
|
8097 |
|
|
expression indicating the kind parameter of
|
8098 |
|
|
the result.
|
8099 |
|
|
|
8100 |
|
|
_Return value_:
|
8101 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
8102 |
|
|
absent, the return value is of default integer kind.
|
8103 |
|
|
|
8104 |
|
|
_Example_:
|
8105 |
|
|
program test_ichar
|
8106 |
|
|
integer i
|
8107 |
|
|
i = ichar(' ')
|
8108 |
|
|
end program test_ichar
|
8109 |
|
|
|
8110 |
|
|
_Note_:
|
8111 |
|
|
No intrinsic exists to convert between a numeric value and a
|
8112 |
|
|
formatted character string representation - for instance, given the
|
8113 |
|
|
`CHARACTER' value `'154'', obtaining an `INTEGER' or `REAL' value
|
8114 |
|
|
with the value 154, or vice versa. Instead, this functionality is
|
8115 |
|
|
provided by internal-file I/O, as in the following example:
|
8116 |
|
|
program read_val
|
8117 |
|
|
integer value
|
8118 |
|
|
character(len=10) string, string2
|
8119 |
|
|
string = '154'
|
8120 |
|
|
|
8121 |
|
|
! Convert a string to a numeric value
|
8122 |
|
|
read (string,'(I10)') value
|
8123 |
|
|
print *, value
|
8124 |
|
|
|
8125 |
|
|
! Convert a value to a formatted string
|
8126 |
|
|
write (string2,'(I10)') value
|
8127 |
|
|
print *, string2
|
8128 |
|
|
end program read_val
|
8129 |
|
|
|
8130 |
|
|
_See also_:
|
8131 |
|
|
*note ACHAR::, *note CHAR::, *note IACHAR::
|
8132 |
|
|
|
8133 |
|
|
|
8134 |
|
|
|
8135 |
|
|
File: gfortran.info, Node: IDATE, Next: IEOR, Prev: ICHAR, Up: Intrinsic Procedures
|
8136 |
|
|
|
8137 |
|
|
8.108 `IDATE' -- Get current local time subroutine (day/month/year)
|
8138 |
|
|
===================================================================
|
8139 |
|
|
|
8140 |
|
|
_Description_:
|
8141 |
|
|
`IDATE(VALUES)' Fills VALUES with the numerical values at the
|
8142 |
|
|
current local time. The day (in the range 1-31), month (in the
|
8143 |
|
|
range 1-12), and year appear in elements 1, 2, and 3 of VALUES,
|
8144 |
|
|
respectively. The year has four significant digits.
|
8145 |
|
|
|
8146 |
|
|
_Standard_:
|
8147 |
|
|
GNU extension
|
8148 |
|
|
|
8149 |
|
|
_Class_:
|
8150 |
|
|
Subroutine
|
8151 |
|
|
|
8152 |
|
|
_Syntax_:
|
8153 |
|
|
`CALL IDATE(VALUES)'
|
8154 |
|
|
|
8155 |
|
|
_Arguments_:
|
8156 |
|
|
VALUES The type shall be `INTEGER, DIMENSION(3)' and
|
8157 |
|
|
the kind shall be the default integer kind.
|
8158 |
|
|
|
8159 |
|
|
_Return value_:
|
8160 |
|
|
Does not return anything.
|
8161 |
|
|
|
8162 |
|
|
_Example_:
|
8163 |
|
|
program test_idate
|
8164 |
|
|
integer, dimension(3) :: tarray
|
8165 |
|
|
call idate(tarray)
|
8166 |
|
|
print *, tarray(1)
|
8167 |
|
|
print *, tarray(2)
|
8168 |
|
|
print *, tarray(3)
|
8169 |
|
|
end program test_idate
|
8170 |
|
|
|
8171 |
|
|
|
8172 |
|
|
File: gfortran.info, Node: IEOR, Next: IERRNO, Prev: IDATE, Up: Intrinsic Procedures
|
8173 |
|
|
|
8174 |
|
|
8.109 `IEOR' -- Bitwise logical exclusive or
|
8175 |
|
|
============================================
|
8176 |
|
|
|
8177 |
|
|
_Description_:
|
8178 |
|
|
`IEOR' returns the bitwise boolean exclusive-OR of I and J.
|
8179 |
|
|
|
8180 |
|
|
_Standard_:
|
8181 |
|
|
Fortran 95 and later
|
8182 |
|
|
|
8183 |
|
|
_Class_:
|
8184 |
|
|
Elemental function
|
8185 |
|
|
|
8186 |
|
|
_Syntax_:
|
8187 |
|
|
`RESULT = IEOR(I, J)'
|
8188 |
|
|
|
8189 |
|
|
_Arguments_:
|
8190 |
|
|
I The type shall be `INTEGER'.
|
8191 |
|
|
J The type shall be `INTEGER', of the same kind
|
8192 |
|
|
as I. (As a GNU extension, different kinds
|
8193 |
|
|
are also permitted.)
|
8194 |
|
|
|
8195 |
|
|
_Return value_:
|
8196 |
|
|
The return type is `INTEGER', of the same kind as the arguments.
|
8197 |
|
|
(If the argument kinds differ, it is of the same kind as the
|
8198 |
|
|
larger argument.)
|
8199 |
|
|
|
8200 |
|
|
_See also_:
|
8201 |
|
|
*note IOR::, *note IAND::, *note IBITS::, *note IBSET::, *note
|
8202 |
|
|
IBCLR::, *note NOT::
|
8203 |
|
|
|
8204 |
|
|
|
8205 |
|
|
File: gfortran.info, Node: IERRNO, Next: INDEX intrinsic, Prev: IEOR, Up: Intrinsic Procedures
|
8206 |
|
|
|
8207 |
|
|
8.110 `IERRNO' -- Get the last system error number
|
8208 |
|
|
==================================================
|
8209 |
|
|
|
8210 |
|
|
_Description_:
|
8211 |
|
|
Returns the last system error number, as given by the C `errno()'
|
8212 |
|
|
function.
|
8213 |
|
|
|
8214 |
|
|
_Standard_:
|
8215 |
|
|
GNU extension
|
8216 |
|
|
|
8217 |
|
|
_Class_:
|
8218 |
|
|
Function
|
8219 |
|
|
|
8220 |
|
|
_Syntax_:
|
8221 |
|
|
`RESULT = IERRNO()'
|
8222 |
|
|
|
8223 |
|
|
_Arguments_:
|
8224 |
|
|
None.
|
8225 |
|
|
|
8226 |
|
|
_Return value_:
|
8227 |
|
|
The return value is of type `INTEGER' and of the default integer
|
8228 |
|
|
kind.
|
8229 |
|
|
|
8230 |
|
|
_See also_:
|
8231 |
|
|
*note PERROR::
|
8232 |
|
|
|
8233 |
|
|
|
8234 |
|
|
File: gfortran.info, Node: INDEX intrinsic, Next: INT, Prev: IERRNO, Up: Intrinsic Procedures
|
8235 |
|
|
|
8236 |
|
|
8.111 `INDEX' -- Position of a substring within a string
|
8237 |
|
|
========================================================
|
8238 |
|
|
|
8239 |
|
|
_Description_:
|
8240 |
|
|
Returns the position of the start of the first occurrence of string
|
8241 |
|
|
SUBSTRING as a substring in STRING, counting from one. If
|
8242 |
|
|
SUBSTRING is not present in STRING, zero is returned. If the BACK
|
8243 |
|
|
argument is present and true, the return value is the start of the
|
8244 |
|
|
last occurrence rather than the first.
|
8245 |
|
|
|
8246 |
|
|
_Standard_:
|
8247 |
|
|
Fortran 77 and later, with KIND argument Fortran 2003 and later
|
8248 |
|
|
|
8249 |
|
|
_Class_:
|
8250 |
|
|
Elemental function
|
8251 |
|
|
|
8252 |
|
|
_Syntax_:
|
8253 |
|
|
`RESULT = INDEX(STRING, SUBSTRING [, BACK [, KIND]])'
|
8254 |
|
|
|
8255 |
|
|
_Arguments_:
|
8256 |
|
|
STRING Shall be a scalar `CHARACTER', with
|
8257 |
|
|
`INTENT(IN)'
|
8258 |
|
|
SUBSTRING Shall be a scalar `CHARACTER', with
|
8259 |
|
|
`INTENT(IN)'
|
8260 |
|
|
BACK (Optional) Shall be a scalar `LOGICAL', with
|
8261 |
|
|
`INTENT(IN)'
|
8262 |
|
|
KIND (Optional) An `INTEGER' initialization
|
8263 |
|
|
expression indicating the kind parameter of
|
8264 |
|
|
the result.
|
8265 |
|
|
|
8266 |
|
|
_Return value_:
|
8267 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
8268 |
|
|
absent, the return value is of default integer kind.
|
8269 |
|
|
|
8270 |
|
|
_See also_:
|
8271 |
|
|
*note SCAN::, *note VERIFY::
|
8272 |
|
|
|
8273 |
|
|
|
8274 |
|
|
File: gfortran.info, Node: INT, Next: INT2, Prev: INDEX intrinsic, Up: Intrinsic Procedures
|
8275 |
|
|
|
8276 |
|
|
8.112 `INT' -- Convert to integer type
|
8277 |
|
|
======================================
|
8278 |
|
|
|
8279 |
|
|
_Description_:
|
8280 |
|
|
Convert to integer type
|
8281 |
|
|
|
8282 |
|
|
_Standard_:
|
8283 |
|
|
Fortran 77 and later
|
8284 |
|
|
|
8285 |
|
|
_Class_:
|
8286 |
|
|
Elemental function
|
8287 |
|
|
|
8288 |
|
|
_Syntax_:
|
8289 |
|
|
`RESULT = INT(A [, KIND))'
|
8290 |
|
|
|
8291 |
|
|
_Arguments_:
|
8292 |
|
|
A Shall be of type `INTEGER', `REAL', or
|
8293 |
|
|
`COMPLEX'.
|
8294 |
|
|
KIND (Optional) An `INTEGER' initialization
|
8295 |
|
|
expression indicating the kind parameter of
|
8296 |
|
|
the result.
|
8297 |
|
|
|
8298 |
|
|
_Return value_:
|
8299 |
|
|
These functions return a `INTEGER' variable or array under the
|
8300 |
|
|
following rules:
|
8301 |
|
|
|
8302 |
|
|
(A)
|
8303 |
|
|
If A is of type `INTEGER', `INT(A) = A'
|
8304 |
|
|
|
8305 |
|
|
(B)
|
8306 |
|
|
If A is of type `REAL' and |A| < 1, `INT(A)' equals `0'. If
|
8307 |
|
|
|A| \geq 1, then `INT(A)' equals the largest integer that
|
8308 |
|
|
does not exceed the range of A and whose sign is the same as
|
8309 |
|
|
the sign of A.
|
8310 |
|
|
|
8311 |
|
|
(C)
|
8312 |
|
|
If A is of type `COMPLEX', rule B is applied to the real part
|
8313 |
|
|
of A.
|
8314 |
|
|
|
8315 |
|
|
_Example_:
|
8316 |
|
|
program test_int
|
8317 |
|
|
integer :: i = 42
|
8318 |
|
|
complex :: z = (-3.7, 1.0)
|
8319 |
|
|
print *, int(i)
|
8320 |
|
|
print *, int(z), int(z,8)
|
8321 |
|
|
end program
|
8322 |
|
|
|
8323 |
|
|
_Specific names_:
|
8324 |
|
|
Name Argument Return type Standard
|
8325 |
|
|
`IFIX(A)' `REAL(4) A' `INTEGER' Fortran 77 and
|
8326 |
|
|
later
|
8327 |
|
|
`IDINT(A)' `REAL(8) A' `INTEGER' Fortran 77 and
|
8328 |
|
|
later
|
8329 |
|
|
|
8330 |
|
|
|
8331 |
|
|
|
8332 |
|
|
File: gfortran.info, Node: INT2, Next: INT8, Prev: INT, Up: Intrinsic Procedures
|
8333 |
|
|
|
8334 |
|
|
8.113 `INT2' -- Convert to 16-bit integer type
|
8335 |
|
|
==============================================
|
8336 |
|
|
|
8337 |
|
|
_Description_:
|
8338 |
|
|
Convert to a `KIND=2' integer type. This is equivalent to the
|
8339 |
|
|
standard `INT' intrinsic with an optional argument of `KIND=2',
|
8340 |
|
|
and is only included for backwards compatibility.
|
8341 |
|
|
|
8342 |
|
|
The `SHORT' intrinsic is equivalent to `INT2'.
|
8343 |
|
|
|
8344 |
|
|
_Standard_:
|
8345 |
|
|
GNU extension
|
8346 |
|
|
|
8347 |
|
|
_Class_:
|
8348 |
|
|
Elemental function
|
8349 |
|
|
|
8350 |
|
|
_Syntax_:
|
8351 |
|
|
`RESULT = INT2(A)'
|
8352 |
|
|
|
8353 |
|
|
_Arguments_:
|
8354 |
|
|
A Shall be of type `INTEGER', `REAL', or
|
8355 |
|
|
`COMPLEX'.
|
8356 |
|
|
|
8357 |
|
|
_Return value_:
|
8358 |
|
|
The return value is a `INTEGER(2)' variable.
|
8359 |
|
|
|
8360 |
|
|
_See also_:
|
8361 |
|
|
*note INT::, *note INT8::, *note LONG::
|
8362 |
|
|
|
8363 |
|
|
|
8364 |
|
|
File: gfortran.info, Node: INT8, Next: IOR, Prev: INT2, Up: Intrinsic Procedures
|
8365 |
|
|
|
8366 |
|
|
8.114 `INT8' -- Convert to 64-bit integer type
|
8367 |
|
|
==============================================
|
8368 |
|
|
|
8369 |
|
|
_Description_:
|
8370 |
|
|
Convert to a `KIND=8' integer type. This is equivalent to the
|
8371 |
|
|
standard `INT' intrinsic with an optional argument of `KIND=8',
|
8372 |
|
|
and is only included for backwards compatibility.
|
8373 |
|
|
|
8374 |
|
|
_Standard_:
|
8375 |
|
|
GNU extension
|
8376 |
|
|
|
8377 |
|
|
_Class_:
|
8378 |
|
|
Elemental function
|
8379 |
|
|
|
8380 |
|
|
_Syntax_:
|
8381 |
|
|
`RESULT = INT8(A)'
|
8382 |
|
|
|
8383 |
|
|
_Arguments_:
|
8384 |
|
|
A Shall be of type `INTEGER', `REAL', or
|
8385 |
|
|
`COMPLEX'.
|
8386 |
|
|
|
8387 |
|
|
_Return value_:
|
8388 |
|
|
The return value is a `INTEGER(8)' variable.
|
8389 |
|
|
|
8390 |
|
|
_See also_:
|
8391 |
|
|
*note INT::, *note INT2::, *note LONG::
|
8392 |
|
|
|
8393 |
|
|
|
8394 |
|
|
File: gfortran.info, Node: IOR, Next: IRAND, Prev: INT8, Up: Intrinsic Procedures
|
8395 |
|
|
|
8396 |
|
|
8.115 `IOR' -- Bitwise logical or
|
8397 |
|
|
=================================
|
8398 |
|
|
|
8399 |
|
|
_Description_:
|
8400 |
|
|
`IOR' returns the bitwise boolean inclusive-OR of I and J.
|
8401 |
|
|
|
8402 |
|
|
_Standard_:
|
8403 |
|
|
Fortran 95 and later
|
8404 |
|
|
|
8405 |
|
|
_Class_:
|
8406 |
|
|
Elemental function
|
8407 |
|
|
|
8408 |
|
|
_Syntax_:
|
8409 |
|
|
`RESULT = IOR(I, J)'
|
8410 |
|
|
|
8411 |
|
|
_Arguments_:
|
8412 |
|
|
I The type shall be `INTEGER'.
|
8413 |
|
|
J The type shall be `INTEGER', of the same kind
|
8414 |
|
|
as I. (As a GNU extension, different kinds
|
8415 |
|
|
are also permitted.)
|
8416 |
|
|
|
8417 |
|
|
_Return value_:
|
8418 |
|
|
The return type is `INTEGER', of the same kind as the arguments.
|
8419 |
|
|
(If the argument kinds differ, it is of the same kind as the
|
8420 |
|
|
larger argument.)
|
8421 |
|
|
|
8422 |
|
|
_See also_:
|
8423 |
|
|
*note IEOR::, *note IAND::, *note IBITS::, *note IBSET::, *note
|
8424 |
|
|
IBCLR::, *note NOT::
|
8425 |
|
|
|
8426 |
|
|
|
8427 |
|
|
File: gfortran.info, Node: IRAND, Next: IS_IOSTAT_END, Prev: IOR, Up: Intrinsic Procedures
|
8428 |
|
|
|
8429 |
|
|
8.116 `IRAND' -- Integer pseudo-random number
|
8430 |
|
|
=============================================
|
8431 |
|
|
|
8432 |
|
|
_Description_:
|
8433 |
|
|
`IRAND(FLAG)' returns a pseudo-random number from a uniform
|
8434 |
|
|
distribution between 0 and a system-dependent limit (which is in
|
8435 |
|
|
most cases 2147483647). If FLAG is 0, the next number in the
|
8436 |
|
|
current sequence is returned; if FLAG is 1, the generator is
|
8437 |
|
|
restarted by `CALL SRAND(0)'; if FLAG has any other value, it is
|
8438 |
|
|
used as a new seed with `SRAND'.
|
8439 |
|
|
|
8440 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
8441 |
|
|
GNU Fortran 77. It implements a simple modulo generator as provided
|
8442 |
|
|
by `g77'. For new code, one should consider the use of *note
|
8443 |
|
|
RANDOM_NUMBER:: as it implements a superior algorithm.
|
8444 |
|
|
|
8445 |
|
|
_Standard_:
|
8446 |
|
|
GNU extension
|
8447 |
|
|
|
8448 |
|
|
_Class_:
|
8449 |
|
|
Function
|
8450 |
|
|
|
8451 |
|
|
_Syntax_:
|
8452 |
|
|
`RESULT = IRAND(I)'
|
8453 |
|
|
|
8454 |
|
|
_Arguments_:
|
8455 |
|
|
I Shall be a scalar `INTEGER' of kind 4.
|
8456 |
|
|
|
8457 |
|
|
_Return value_:
|
8458 |
|
|
The return value is of `INTEGER(kind=4)' type.
|
8459 |
|
|
|
8460 |
|
|
_Example_:
|
8461 |
|
|
program test_irand
|
8462 |
|
|
integer,parameter :: seed = 86456
|
8463 |
|
|
|
8464 |
|
|
call srand(seed)
|
8465 |
|
|
print *, irand(), irand(), irand(), irand()
|
8466 |
|
|
print *, irand(seed), irand(), irand(), irand()
|
8467 |
|
|
end program test_irand
|
8468 |
|
|
|
8469 |
|
|
|
8470 |
|
|
|
8471 |
|
|
File: gfortran.info, Node: IS_IOSTAT_END, Next: IS_IOSTAT_EOR, Prev: IRAND, Up: Intrinsic Procedures
|
8472 |
|
|
|
8473 |
|
|
8.117 `IS_IOSTAT_END' -- Test for end-of-file value
|
8474 |
|
|
===================================================
|
8475 |
|
|
|
8476 |
|
|
_Description_:
|
8477 |
|
|
`IS_IOSTAT_END' tests whether an variable has the value of the I/O
|
8478 |
|
|
status "end of file". The function is equivalent to comparing the
|
8479 |
|
|
variable with the `IOSTAT_END' parameter of the intrinsic module
|
8480 |
|
|
`ISO_FORTRAN_ENV'.
|
8481 |
|
|
|
8482 |
|
|
_Standard_:
|
8483 |
|
|
Fortran 2003 and later
|
8484 |
|
|
|
8485 |
|
|
_Class_:
|
8486 |
|
|
Elemental function
|
8487 |
|
|
|
8488 |
|
|
_Syntax_:
|
8489 |
|
|
`RESULT = IS_IOSTAT_END(I)'
|
8490 |
|
|
|
8491 |
|
|
_Arguments_:
|
8492 |
|
|
I Shall be of the type `INTEGER'.
|
8493 |
|
|
|
8494 |
|
|
_Return value_:
|
8495 |
|
|
Returns a `LOGICAL' of the default kind, which `.TRUE.' if I has
|
8496 |
|
|
the value which indicates an end of file condition for IOSTAT=
|
8497 |
|
|
specifiers, and is `.FALSE.' otherwise.
|
8498 |
|
|
|
8499 |
|
|
_Example_:
|
8500 |
|
|
PROGRAM iostat
|
8501 |
|
|
IMPLICIT NONE
|
8502 |
|
|
INTEGER :: stat, i
|
8503 |
|
|
OPEN(88, FILE='test.dat')
|
8504 |
|
|
READ(88, *, IOSTAT=stat) i
|
8505 |
|
|
IF(IS_IOSTAT_END(stat)) STOP 'END OF FILE'
|
8506 |
|
|
END PROGRAM
|
8507 |
|
|
|
8508 |
|
|
|
8509 |
|
|
File: gfortran.info, Node: IS_IOSTAT_EOR, Next: ISATTY, Prev: IS_IOSTAT_END, Up: Intrinsic Procedures
|
8510 |
|
|
|
8511 |
|
|
8.118 `IS_IOSTAT_EOR' -- Test for end-of-record value
|
8512 |
|
|
=====================================================
|
8513 |
|
|
|
8514 |
|
|
_Description_:
|
8515 |
|
|
`IS_IOSTAT_EOR' tests whether an variable has the value of the I/O
|
8516 |
|
|
status "end of record". The function is equivalent to comparing the
|
8517 |
|
|
variable with the `IOSTAT_EOR' parameter of the intrinsic module
|
8518 |
|
|
`ISO_FORTRAN_ENV'.
|
8519 |
|
|
|
8520 |
|
|
_Standard_:
|
8521 |
|
|
Fortran 2003 and later
|
8522 |
|
|
|
8523 |
|
|
_Class_:
|
8524 |
|
|
Elemental function
|
8525 |
|
|
|
8526 |
|
|
_Syntax_:
|
8527 |
|
|
`RESULT = IS_IOSTAT_EOR(I)'
|
8528 |
|
|
|
8529 |
|
|
_Arguments_:
|
8530 |
|
|
I Shall be of the type `INTEGER'.
|
8531 |
|
|
|
8532 |
|
|
_Return value_:
|
8533 |
|
|
Returns a `LOGICAL' of the default kind, which `.TRUE.' if I has
|
8534 |
|
|
the value which indicates an end of file condition for IOSTAT=
|
8535 |
|
|
specifiers, and is `.FALSE.' otherwise.
|
8536 |
|
|
|
8537 |
|
|
_Example_:
|
8538 |
|
|
PROGRAM iostat
|
8539 |
|
|
IMPLICIT NONE
|
8540 |
|
|
INTEGER :: stat, i(50)
|
8541 |
|
|
OPEN(88, FILE='test.dat', FORM='UNFORMATTED')
|
8542 |
|
|
READ(88, IOSTAT=stat) i
|
8543 |
|
|
IF(IS_IOSTAT_EOR(stat)) STOP 'END OF RECORD'
|
8544 |
|
|
END PROGRAM
|
8545 |
|
|
|
8546 |
|
|
|
8547 |
|
|
File: gfortran.info, Node: ISATTY, Next: ISHFT, Prev: IS_IOSTAT_EOR, Up: Intrinsic Procedures
|
8548 |
|
|
|
8549 |
|
|
8.119 `ISATTY' -- Whether a unit is a terminal device.
|
8550 |
|
|
======================================================
|
8551 |
|
|
|
8552 |
|
|
_Description_:
|
8553 |
|
|
Determine whether a unit is connected to a terminal device.
|
8554 |
|
|
|
8555 |
|
|
_Standard_:
|
8556 |
|
|
GNU extension
|
8557 |
|
|
|
8558 |
|
|
_Class_:
|
8559 |
|
|
Function
|
8560 |
|
|
|
8561 |
|
|
_Syntax_:
|
8562 |
|
|
`RESULT = ISATTY(UNIT)'
|
8563 |
|
|
|
8564 |
|
|
_Arguments_:
|
8565 |
|
|
UNIT Shall be a scalar `INTEGER'.
|
8566 |
|
|
|
8567 |
|
|
_Return value_:
|
8568 |
|
|
Returns `.TRUE.' if the UNIT is connected to a terminal device,
|
8569 |
|
|
`.FALSE.' otherwise.
|
8570 |
|
|
|
8571 |
|
|
_Example_:
|
8572 |
|
|
PROGRAM test_isatty
|
8573 |
|
|
INTEGER(kind=1) :: unit
|
8574 |
|
|
DO unit = 1, 10
|
8575 |
|
|
write(*,*) isatty(unit=unit)
|
8576 |
|
|
END DO
|
8577 |
|
|
END PROGRAM
|
8578 |
|
|
|
8579 |
|
|
_See also_:
|
8580 |
|
|
*note TTYNAM::
|
8581 |
|
|
|
8582 |
|
|
|
8583 |
|
|
File: gfortran.info, Node: ISHFT, Next: ISHFTC, Prev: ISATTY, Up: Intrinsic Procedures
|
8584 |
|
|
|
8585 |
|
|
8.120 `ISHFT' -- Shift bits
|
8586 |
|
|
===========================
|
8587 |
|
|
|
8588 |
|
|
_Description_:
|
8589 |
|
|
`ISHFT' returns a value corresponding to I with all of the bits
|
8590 |
|
|
shifted SHIFT places. A value of SHIFT greater than zero
|
8591 |
|
|
corresponds to a left shift, a value of zero corresponds to no
|
8592 |
|
|
shift, and a value less than zero corresponds to a right shift.
|
8593 |
|
|
If the absolute value of SHIFT is greater than `BIT_SIZE(I)', the
|
8594 |
|
|
value is undefined. Bits shifted out from the left end or right
|
8595 |
|
|
end are lost; zeros are shifted in from the opposite end.
|
8596 |
|
|
|
8597 |
|
|
_Standard_:
|
8598 |
|
|
Fortran 95 and later
|
8599 |
|
|
|
8600 |
|
|
_Class_:
|
8601 |
|
|
Elemental function
|
8602 |
|
|
|
8603 |
|
|
_Syntax_:
|
8604 |
|
|
`RESULT = ISHFT(I, SHIFT)'
|
8605 |
|
|
|
8606 |
|
|
_Arguments_:
|
8607 |
|
|
I The type shall be `INTEGER'.
|
8608 |
|
|
SHIFT The type shall be `INTEGER'.
|
8609 |
|
|
|
8610 |
|
|
_Return value_:
|
8611 |
|
|
The return value is of type `INTEGER' and of the same kind as I.
|
8612 |
|
|
|
8613 |
|
|
_See also_:
|
8614 |
|
|
*note ISHFTC::
|
8615 |
|
|
|
8616 |
|
|
|
8617 |
|
|
File: gfortran.info, Node: ISHFTC, Next: ISNAN, Prev: ISHFT, Up: Intrinsic Procedures
|
8618 |
|
|
|
8619 |
|
|
8.121 `ISHFTC' -- Shift bits circularly
|
8620 |
|
|
=======================================
|
8621 |
|
|
|
8622 |
|
|
_Description_:
|
8623 |
|
|
`ISHFTC' returns a value corresponding to I with the rightmost
|
8624 |
|
|
SIZE bits shifted circularly SHIFT places; that is, bits shifted
|
8625 |
|
|
out one end are shifted into the opposite end. A value of SHIFT
|
8626 |
|
|
greater than zero corresponds to a left shift, a value of zero
|
8627 |
|
|
corresponds to no shift, and a value less than zero corresponds to
|
8628 |
|
|
a right shift. The absolute value of SHIFT must be less than
|
8629 |
|
|
SIZE. If the SIZE argument is omitted, it is taken to be
|
8630 |
|
|
equivalent to `BIT_SIZE(I)'.
|
8631 |
|
|
|
8632 |
|
|
_Standard_:
|
8633 |
|
|
Fortran 95 and later
|
8634 |
|
|
|
8635 |
|
|
_Class_:
|
8636 |
|
|
Elemental function
|
8637 |
|
|
|
8638 |
|
|
_Syntax_:
|
8639 |
|
|
`RESULT = ISHFTC(I, SHIFT [, SIZE])'
|
8640 |
|
|
|
8641 |
|
|
_Arguments_:
|
8642 |
|
|
I The type shall be `INTEGER'.
|
8643 |
|
|
SHIFT The type shall be `INTEGER'.
|
8644 |
|
|
SIZE (Optional) The type shall be `INTEGER'; the
|
8645 |
|
|
value must be greater than zero and less than
|
8646 |
|
|
or equal to `BIT_SIZE(I)'.
|
8647 |
|
|
|
8648 |
|
|
_Return value_:
|
8649 |
|
|
The return value is of type `INTEGER' and of the same kind as I.
|
8650 |
|
|
|
8651 |
|
|
_See also_:
|
8652 |
|
|
*note ISHFT::
|
8653 |
|
|
|
8654 |
|
|
|
8655 |
|
|
File: gfortran.info, Node: ISNAN, Next: ITIME, Prev: ISHFTC, Up: Intrinsic Procedures
|
8656 |
|
|
|
8657 |
|
|
8.122 `ISNAN' -- Test for a NaN
|
8658 |
|
|
===============================
|
8659 |
|
|
|
8660 |
|
|
_Description_:
|
8661 |
|
|
`ISNAN' tests whether a floating-point value is an IEEE
|
8662 |
|
|
Not-a-Number (NaN).
|
8663 |
|
|
|
8664 |
|
|
_Standard_:
|
8665 |
|
|
GNU extension
|
8666 |
|
|
|
8667 |
|
|
_Class_:
|
8668 |
|
|
Elemental function
|
8669 |
|
|
|
8670 |
|
|
_Syntax_:
|
8671 |
|
|
`ISNAN(X)'
|
8672 |
|
|
|
8673 |
|
|
_Arguments_:
|
8674 |
|
|
X Variable of the type `REAL'.
|
8675 |
|
|
|
8676 |
|
|
_Return value_:
|
8677 |
|
|
Returns a default-kind `LOGICAL'. The returned value is `TRUE' if
|
8678 |
|
|
X is a NaN and `FALSE' otherwise.
|
8679 |
|
|
|
8680 |
|
|
_Example_:
|
8681 |
|
|
program test_nan
|
8682 |
|
|
implicit none
|
8683 |
|
|
real :: x
|
8684 |
|
|
x = -1.0
|
8685 |
|
|
x = sqrt(x)
|
8686 |
|
|
if (isnan(x)) stop '"x" is a NaN'
|
8687 |
|
|
end program test_nan
|
8688 |
|
|
|
8689 |
|
|
|
8690 |
|
|
File: gfortran.info, Node: ITIME, Next: KILL, Prev: ISNAN, Up: Intrinsic Procedures
|
8691 |
|
|
|
8692 |
|
|
8.123 `ITIME' -- Get current local time subroutine (hour/minutes/seconds)
|
8693 |
|
|
=========================================================================
|
8694 |
|
|
|
8695 |
|
|
_Description_:
|
8696 |
|
|
`IDATE(VALUES)' Fills VALUES with the numerical values at the
|
8697 |
|
|
current local time. The hour (in the range 1-24), minute (in the
|
8698 |
|
|
range 1-60), and seconds (in the range 1-60) appear in elements 1,
|
8699 |
|
|
2, and 3 of VALUES, respectively.
|
8700 |
|
|
|
8701 |
|
|
_Standard_:
|
8702 |
|
|
GNU extension
|
8703 |
|
|
|
8704 |
|
|
_Class_:
|
8705 |
|
|
Subroutine
|
8706 |
|
|
|
8707 |
|
|
_Syntax_:
|
8708 |
|
|
`CALL ITIME(VALUES)'
|
8709 |
|
|
|
8710 |
|
|
_Arguments_:
|
8711 |
|
|
VALUES The type shall be `INTEGER, DIMENSION(3)' and
|
8712 |
|
|
the kind shall be the default integer kind.
|
8713 |
|
|
|
8714 |
|
|
_Return value_:
|
8715 |
|
|
Does not return anything.
|
8716 |
|
|
|
8717 |
|
|
_Example_:
|
8718 |
|
|
program test_itime
|
8719 |
|
|
integer, dimension(3) :: tarray
|
8720 |
|
|
call itime(tarray)
|
8721 |
|
|
print *, tarray(1)
|
8722 |
|
|
print *, tarray(2)
|
8723 |
|
|
print *, tarray(3)
|
8724 |
|
|
end program test_itime
|
8725 |
|
|
|
8726 |
|
|
|
8727 |
|
|
File: gfortran.info, Node: KILL, Next: KIND, Prev: ITIME, Up: Intrinsic Procedures
|
8728 |
|
|
|
8729 |
|
|
8.124 `KILL' -- Send a signal to a process
|
8730 |
|
|
==========================================
|
8731 |
|
|
|
8732 |
|
|
_Description_:
|
8733 |
|
|
|
8734 |
|
|
_Standard_:
|
8735 |
|
|
Sends the signal specified by SIGNAL to the process PID. See
|
8736 |
|
|
`kill(2)'.
|
8737 |
|
|
|
8738 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
8739 |
|
|
however, only one form can be used in any given program unit.
|
8740 |
|
|
|
8741 |
|
|
_Class_:
|
8742 |
|
|
Subroutine, function
|
8743 |
|
|
|
8744 |
|
|
_Syntax_:
|
8745 |
|
|
`CALL KILL(C, VALUE [, STATUS])'
|
8746 |
|
|
|
8747 |
|
|
_Arguments_:
|
8748 |
|
|
C Shall be a scalar `INTEGER', with `INTENT(IN)'
|
8749 |
|
|
VALUE Shall be a scalar `INTEGER', with `INTENT(IN)'
|
8750 |
|
|
STATUS (Optional) status flag of type `INTEGER(4)' or
|
8751 |
|
|
`INTEGER(8)'. Returns 0 on success, or a
|
8752 |
|
|
system-specific error code otherwise.
|
8753 |
|
|
|
8754 |
|
|
_See also_:
|
8755 |
|
|
*note ABORT::, *note EXIT::
|
8756 |
|
|
|
8757 |
|
|
|
8758 |
|
|
File: gfortran.info, Node: KIND, Next: LBOUND, Prev: KILL, Up: Intrinsic Procedures
|
8759 |
|
|
|
8760 |
|
|
8.125 `KIND' -- Kind of an entity
|
8761 |
|
|
=================================
|
8762 |
|
|
|
8763 |
|
|
_Description_:
|
8764 |
|
|
`KIND(X)' returns the kind value of the entity X.
|
8765 |
|
|
|
8766 |
|
|
_Standard_:
|
8767 |
|
|
Fortran 95 and later
|
8768 |
|
|
|
8769 |
|
|
_Class_:
|
8770 |
|
|
Inquiry function
|
8771 |
|
|
|
8772 |
|
|
_Syntax_:
|
8773 |
|
|
`K = KIND(X)'
|
8774 |
|
|
|
8775 |
|
|
_Arguments_:
|
8776 |
|
|
X Shall be of type `LOGICAL', `INTEGER', `REAL',
|
8777 |
|
|
`COMPLEX' or `CHARACTER'.
|
8778 |
|
|
|
8779 |
|
|
_Return value_:
|
8780 |
|
|
The return value is a scalar of type `INTEGER' and of the default
|
8781 |
|
|
integer kind.
|
8782 |
|
|
|
8783 |
|
|
_Example_:
|
8784 |
|
|
program test_kind
|
8785 |
|
|
integer,parameter :: kc = kind(' ')
|
8786 |
|
|
integer,parameter :: kl = kind(.true.)
|
8787 |
|
|
|
8788 |
|
|
print *, "The default character kind is ", kc
|
8789 |
|
|
print *, "The default logical kind is ", kl
|
8790 |
|
|
end program test_kind
|
8791 |
|
|
|
8792 |
|
|
|
8793 |
|
|
|
8794 |
|
|
File: gfortran.info, Node: LBOUND, Next: LEADZ, Prev: KIND, Up: Intrinsic Procedures
|
8795 |
|
|
|
8796 |
|
|
8.126 `LBOUND' -- Lower dimension bounds of an array
|
8797 |
|
|
====================================================
|
8798 |
|
|
|
8799 |
|
|
_Description_:
|
8800 |
|
|
Returns the lower bounds of an array, or a single lower bound
|
8801 |
|
|
along the DIM dimension.
|
8802 |
|
|
|
8803 |
|
|
_Standard_:
|
8804 |
|
|
Fortran 95 and later, with KIND argument Fortran 2003 and later
|
8805 |
|
|
|
8806 |
|
|
_Class_:
|
8807 |
|
|
Inquiry function
|
8808 |
|
|
|
8809 |
|
|
_Syntax_:
|
8810 |
|
|
`RESULT = LBOUND(ARRAY [, DIM [, KIND]])'
|
8811 |
|
|
|
8812 |
|
|
_Arguments_:
|
8813 |
|
|
ARRAY Shall be an array, of any type.
|
8814 |
|
|
DIM (Optional) Shall be a scalar `INTEGER'.
|
8815 |
|
|
KIND (Optional) An `INTEGER' initialization
|
8816 |
|
|
expression indicating the kind parameter of
|
8817 |
|
|
the result.
|
8818 |
|
|
|
8819 |
|
|
_Return value_:
|
8820 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
8821 |
|
|
absent, the return value is of default integer kind. If DIM is
|
8822 |
|
|
absent, the result is an array of the lower bounds of ARRAY. If
|
8823 |
|
|
DIM is present, the result is a scalar corresponding to the lower
|
8824 |
|
|
bound of the array along that dimension. If ARRAY is an
|
8825 |
|
|
expression rather than a whole array or array structure component,
|
8826 |
|
|
or if it has a zero extent along the relevant dimension, the lower
|
8827 |
|
|
bound is taken to be 1.
|
8828 |
|
|
|
8829 |
|
|
_See also_:
|
8830 |
|
|
*note UBOUND::
|
8831 |
|
|
|
8832 |
|
|
|
8833 |
|
|
File: gfortran.info, Node: LEADZ, Next: LEN, Prev: LBOUND, Up: Intrinsic Procedures
|
8834 |
|
|
|
8835 |
|
|
8.127 `LEADZ' -- Number of leading zero bits of an integer
|
8836 |
|
|
==========================================================
|
8837 |
|
|
|
8838 |
|
|
_Description_:
|
8839 |
|
|
`LEADZ' returns the number of leading zero bits of an integer.
|
8840 |
|
|
|
8841 |
|
|
_Standard_:
|
8842 |
|
|
Fortran 2008 and later
|
8843 |
|
|
|
8844 |
|
|
_Class_:
|
8845 |
|
|
Elemental function
|
8846 |
|
|
|
8847 |
|
|
_Syntax_:
|
8848 |
|
|
`RESULT = LEADZ(I)'
|
8849 |
|
|
|
8850 |
|
|
_Arguments_:
|
8851 |
|
|
I Shall be of type `INTEGER'.
|
8852 |
|
|
|
8853 |
|
|
_Return value_:
|
8854 |
|
|
The type of the return value is the default `INTEGER'. If all the
|
8855 |
|
|
bits of `I' are zero, the result value is `BIT_SIZE(I)'.
|
8856 |
|
|
|
8857 |
|
|
_Example_:
|
8858 |
|
|
PROGRAM test_leadz
|
8859 |
|
|
WRITE (*,*) LEADZ(1) ! prints 8 if BITSIZE(I) has the value 32
|
8860 |
|
|
END PROGRAM
|
8861 |
|
|
|
8862 |
|
|
_See also_:
|
8863 |
|
|
*note BIT_SIZE::, *note TRAILZ::
|
8864 |
|
|
|
8865 |
|
|
|
8866 |
|
|
File: gfortran.info, Node: LEN, Next: LEN_TRIM, Prev: LEADZ, Up: Intrinsic Procedures
|
8867 |
|
|
|
8868 |
|
|
8.128 `LEN' -- Length of a character entity
|
8869 |
|
|
===========================================
|
8870 |
|
|
|
8871 |
|
|
_Description_:
|
8872 |
|
|
Returns the length of a character string. If STRING is an array,
|
8873 |
|
|
the length of an element of STRING is returned. Note that STRING
|
8874 |
|
|
need not be defined when this intrinsic is invoked, since only the
|
8875 |
|
|
length, not the content, of STRING is needed.
|
8876 |
|
|
|
8877 |
|
|
_Standard_:
|
8878 |
|
|
Fortran 77 and later, with KIND argument Fortran 2003 and later
|
8879 |
|
|
|
8880 |
|
|
_Class_:
|
8881 |
|
|
Inquiry function
|
8882 |
|
|
|
8883 |
|
|
_Syntax_:
|
8884 |
|
|
`L = LEN(STRING [, KIND])'
|
8885 |
|
|
|
8886 |
|
|
_Arguments_:
|
8887 |
|
|
STRING Shall be a scalar or array of type
|
8888 |
|
|
`CHARACTER', with `INTENT(IN)'
|
8889 |
|
|
KIND (Optional) An `INTEGER' initialization
|
8890 |
|
|
expression indicating the kind parameter of
|
8891 |
|
|
the result.
|
8892 |
|
|
|
8893 |
|
|
_Return value_:
|
8894 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
8895 |
|
|
absent, the return value is of default integer kind.
|
8896 |
|
|
|
8897 |
|
|
_See also_:
|
8898 |
|
|
*note LEN_TRIM::, *note ADJUSTL::, *note ADJUSTR::
|
8899 |
|
|
|
8900 |
|
|
|
8901 |
|
|
File: gfortran.info, Node: LEN_TRIM, Next: LGE, Prev: LEN, Up: Intrinsic Procedures
|
8902 |
|
|
|
8903 |
|
|
8.129 `LEN_TRIM' -- Length of a character entity without trailing blank characters
|
8904 |
|
|
==================================================================================
|
8905 |
|
|
|
8906 |
|
|
_Description_:
|
8907 |
|
|
Returns the length of a character string, ignoring any trailing
|
8908 |
|
|
blanks.
|
8909 |
|
|
|
8910 |
|
|
_Standard_:
|
8911 |
|
|
Fortran 95 and later, with KIND argument Fortran 2003 and later
|
8912 |
|
|
|
8913 |
|
|
_Class_:
|
8914 |
|
|
Elemental function
|
8915 |
|
|
|
8916 |
|
|
_Syntax_:
|
8917 |
|
|
`RESULT = LEN_TRIM(STRING [, KIND])'
|
8918 |
|
|
|
8919 |
|
|
_Arguments_:
|
8920 |
|
|
STRING Shall be a scalar of type `CHARACTER', with
|
8921 |
|
|
`INTENT(IN)'
|
8922 |
|
|
KIND (Optional) An `INTEGER' initialization
|
8923 |
|
|
expression indicating the kind parameter of
|
8924 |
|
|
the result.
|
8925 |
|
|
|
8926 |
|
|
_Return value_:
|
8927 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
8928 |
|
|
absent, the return value is of default integer kind.
|
8929 |
|
|
|
8930 |
|
|
_See also_:
|
8931 |
|
|
*note LEN::, *note ADJUSTL::, *note ADJUSTR::
|
8932 |
|
|
|
8933 |
|
|
|
8934 |
|
|
File: gfortran.info, Node: LGE, Next: LGT, Prev: LEN_TRIM, Up: Intrinsic Procedures
|
8935 |
|
|
|
8936 |
|
|
8.130 `LGE' -- Lexical greater than or equal
|
8937 |
|
|
============================================
|
8938 |
|
|
|
8939 |
|
|
_Description_:
|
8940 |
|
|
Determines whether one string is lexically greater than or equal to
|
8941 |
|
|
another string, where the two strings are interpreted as containing
|
8942 |
|
|
ASCII character codes. If the String A and String B are not the
|
8943 |
|
|
same length, the shorter is compared as if spaces were appended to
|
8944 |
|
|
it to form a value that has the same length as the longer.
|
8945 |
|
|
|
8946 |
|
|
In general, the lexical comparison intrinsics `LGE', `LGT', `LLE',
|
8947 |
|
|
and `LLT' differ from the corresponding intrinsic operators
|
8948 |
|
|
`.GE.', `.GT.', `.LE.', and `.LT.', in that the latter use the
|
8949 |
|
|
processor's character ordering (which is not ASCII on some
|
8950 |
|
|
targets), whereas the former always use the ASCII ordering.
|
8951 |
|
|
|
8952 |
|
|
_Standard_:
|
8953 |
|
|
Fortran 77 and later
|
8954 |
|
|
|
8955 |
|
|
_Class_:
|
8956 |
|
|
Elemental function
|
8957 |
|
|
|
8958 |
|
|
_Syntax_:
|
8959 |
|
|
`RESULT = LGE(STRING_A, STRING_B)'
|
8960 |
|
|
|
8961 |
|
|
_Arguments_:
|
8962 |
|
|
STRING_A Shall be of default `CHARACTER' type.
|
8963 |
|
|
STRING_B Shall be of default `CHARACTER' type.
|
8964 |
|
|
|
8965 |
|
|
_Return value_:
|
8966 |
|
|
Returns `.TRUE.' if `STRING_A >= STRING_B', and `.FALSE.'
|
8967 |
|
|
otherwise, based on the ASCII ordering.
|
8968 |
|
|
|
8969 |
|
|
_See also_:
|
8970 |
|
|
*note LGT::, *note LLE::, *note LLT::
|
8971 |
|
|
|
8972 |
|
|
|
8973 |
|
|
File: gfortran.info, Node: LGT, Next: LINK, Prev: LGE, Up: Intrinsic Procedures
|
8974 |
|
|
|
8975 |
|
|
8.131 `LGT' -- Lexical greater than
|
8976 |
|
|
===================================
|
8977 |
|
|
|
8978 |
|
|
_Description_:
|
8979 |
|
|
Determines whether one string is lexically greater than another
|
8980 |
|
|
string, where the two strings are interpreted as containing ASCII
|
8981 |
|
|
character codes. If the String A and String B are not the same
|
8982 |
|
|
length, the shorter is compared as if spaces were appended to it
|
8983 |
|
|
to form a value that has the same length as the longer.
|
8984 |
|
|
|
8985 |
|
|
In general, the lexical comparison intrinsics `LGE', `LGT', `LLE',
|
8986 |
|
|
and `LLT' differ from the corresponding intrinsic operators
|
8987 |
|
|
`.GE.', `.GT.', `.LE.', and `.LT.', in that the latter use the
|
8988 |
|
|
processor's character ordering (which is not ASCII on some
|
8989 |
|
|
targets), whereas the former always use the ASCII ordering.
|
8990 |
|
|
|
8991 |
|
|
_Standard_:
|
8992 |
|
|
Fortran 77 and later
|
8993 |
|
|
|
8994 |
|
|
_Class_:
|
8995 |
|
|
Elemental function
|
8996 |
|
|
|
8997 |
|
|
_Syntax_:
|
8998 |
|
|
`RESULT = LGT(STRING_A, STRING_B)'
|
8999 |
|
|
|
9000 |
|
|
_Arguments_:
|
9001 |
|
|
STRING_A Shall be of default `CHARACTER' type.
|
9002 |
|
|
STRING_B Shall be of default `CHARACTER' type.
|
9003 |
|
|
|
9004 |
|
|
_Return value_:
|
9005 |
|
|
Returns `.TRUE.' if `STRING_A > STRING_B', and `.FALSE.'
|
9006 |
|
|
otherwise, based on the ASCII ordering.
|
9007 |
|
|
|
9008 |
|
|
_See also_:
|
9009 |
|
|
*note LGE::, *note LLE::, *note LLT::
|
9010 |
|
|
|
9011 |
|
|
|
9012 |
|
|
File: gfortran.info, Node: LINK, Next: LLE, Prev: LGT, Up: Intrinsic Procedures
|
9013 |
|
|
|
9014 |
|
|
8.132 `LINK' -- Create a hard link
|
9015 |
|
|
==================================
|
9016 |
|
|
|
9017 |
|
|
_Description_:
|
9018 |
|
|
Makes a (hard) link from file PATH1 to PATH2. A null character
|
9019 |
|
|
(`CHAR(0)') can be used to mark the end of the names in PATH1 and
|
9020 |
|
|
PATH2; otherwise, trailing blanks in the file names are ignored.
|
9021 |
|
|
If the STATUS argument is supplied, it contains 0 on success or a
|
9022 |
|
|
nonzero error code upon return; see `link(2)'.
|
9023 |
|
|
|
9024 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
9025 |
|
|
however, only one form can be used in any given program unit.
|
9026 |
|
|
|
9027 |
|
|
_Standard_:
|
9028 |
|
|
GNU extension
|
9029 |
|
|
|
9030 |
|
|
_Class_:
|
9031 |
|
|
Subroutine, function
|
9032 |
|
|
|
9033 |
|
|
_Syntax_:
|
9034 |
|
|
`CALL LINK(PATH1, PATH2 [, STATUS])'
|
9035 |
|
|
`STATUS = LINK(PATH1, PATH2)'
|
9036 |
|
|
|
9037 |
|
|
_Arguments_:
|
9038 |
|
|
PATH1 Shall be of default `CHARACTER' type.
|
9039 |
|
|
PATH2 Shall be of default `CHARACTER' type.
|
9040 |
|
|
STATUS (Optional) Shall be of default `INTEGER' type.
|
9041 |
|
|
|
9042 |
|
|
_See also_:
|
9043 |
|
|
*note SYMLNK::, *note UNLINK::
|
9044 |
|
|
|
9045 |
|
|
|
9046 |
|
|
File: gfortran.info, Node: LLE, Next: LLT, Prev: LINK, Up: Intrinsic Procedures
|
9047 |
|
|
|
9048 |
|
|
8.133 `LLE' -- Lexical less than or equal
|
9049 |
|
|
=========================================
|
9050 |
|
|
|
9051 |
|
|
_Description_:
|
9052 |
|
|
Determines whether one string is lexically less than or equal to
|
9053 |
|
|
another string, where the two strings are interpreted as
|
9054 |
|
|
containing ASCII character codes. If the String A and String B
|
9055 |
|
|
are not the same length, the shorter is compared as if spaces were
|
9056 |
|
|
appended to it to form a value that has the same length as the
|
9057 |
|
|
longer.
|
9058 |
|
|
|
9059 |
|
|
In general, the lexical comparison intrinsics `LGE', `LGT', `LLE',
|
9060 |
|
|
and `LLT' differ from the corresponding intrinsic operators
|
9061 |
|
|
`.GE.', `.GT.', `.LE.', and `.LT.', in that the latter use the
|
9062 |
|
|
processor's character ordering (which is not ASCII on some
|
9063 |
|
|
targets), whereas the former always use the ASCII ordering.
|
9064 |
|
|
|
9065 |
|
|
_Standard_:
|
9066 |
|
|
Fortran 77 and later
|
9067 |
|
|
|
9068 |
|
|
_Class_:
|
9069 |
|
|
Elemental function
|
9070 |
|
|
|
9071 |
|
|
_Syntax_:
|
9072 |
|
|
`RESULT = LLE(STRING_A, STRING_B)'
|
9073 |
|
|
|
9074 |
|
|
_Arguments_:
|
9075 |
|
|
STRING_A Shall be of default `CHARACTER' type.
|
9076 |
|
|
STRING_B Shall be of default `CHARACTER' type.
|
9077 |
|
|
|
9078 |
|
|
_Return value_:
|
9079 |
|
|
Returns `.TRUE.' if `STRING_A <= STRING_B', and `.FALSE.'
|
9080 |
|
|
otherwise, based on the ASCII ordering.
|
9081 |
|
|
|
9082 |
|
|
_See also_:
|
9083 |
|
|
*note LGE::, *note LGT::, *note LLT::
|
9084 |
|
|
|
9085 |
|
|
|
9086 |
|
|
File: gfortran.info, Node: LLT, Next: LNBLNK, Prev: LLE, Up: Intrinsic Procedures
|
9087 |
|
|
|
9088 |
|
|
8.134 `LLT' -- Lexical less than
|
9089 |
|
|
================================
|
9090 |
|
|
|
9091 |
|
|
_Description_:
|
9092 |
|
|
Determines whether one string is lexically less than another
|
9093 |
|
|
string, where the two strings are interpreted as containing ASCII
|
9094 |
|
|
character codes. If the String A and String B are not the same
|
9095 |
|
|
length, the shorter is compared as if spaces were appended to it
|
9096 |
|
|
to form a value that has the same length as the longer.
|
9097 |
|
|
|
9098 |
|
|
In general, the lexical comparison intrinsics `LGE', `LGT', `LLE',
|
9099 |
|
|
and `LLT' differ from the corresponding intrinsic operators
|
9100 |
|
|
`.GE.', `.GT.', `.LE.', and `.LT.', in that the latter use the
|
9101 |
|
|
processor's character ordering (which is not ASCII on some
|
9102 |
|
|
targets), whereas the former always use the ASCII ordering.
|
9103 |
|
|
|
9104 |
|
|
_Standard_:
|
9105 |
|
|
Fortran 77 and later
|
9106 |
|
|
|
9107 |
|
|
_Class_:
|
9108 |
|
|
Elemental function
|
9109 |
|
|
|
9110 |
|
|
_Syntax_:
|
9111 |
|
|
`RESULT = LLT(STRING_A, STRING_B)'
|
9112 |
|
|
|
9113 |
|
|
_Arguments_:
|
9114 |
|
|
STRING_A Shall be of default `CHARACTER' type.
|
9115 |
|
|
STRING_B Shall be of default `CHARACTER' type.
|
9116 |
|
|
|
9117 |
|
|
_Return value_:
|
9118 |
|
|
Returns `.TRUE.' if `STRING_A < STRING_B', and `.FALSE.'
|
9119 |
|
|
otherwise, based on the ASCII ordering.
|
9120 |
|
|
|
9121 |
|
|
_See also_:
|
9122 |
|
|
*note LGE::, *note LGT::, *note LLE::
|
9123 |
|
|
|
9124 |
|
|
|
9125 |
|
|
File: gfortran.info, Node: LNBLNK, Next: LOC, Prev: LLT, Up: Intrinsic Procedures
|
9126 |
|
|
|
9127 |
|
|
8.135 `LNBLNK' -- Index of the last non-blank character in a string
|
9128 |
|
|
===================================================================
|
9129 |
|
|
|
9130 |
|
|
_Description_:
|
9131 |
|
|
Returns the length of a character string, ignoring any trailing
|
9132 |
|
|
blanks. This is identical to the standard `LEN_TRIM' intrinsic,
|
9133 |
|
|
and is only included for backwards compatibility.
|
9134 |
|
|
|
9135 |
|
|
_Standard_:
|
9136 |
|
|
GNU extension
|
9137 |
|
|
|
9138 |
|
|
_Class_:
|
9139 |
|
|
Elemental function
|
9140 |
|
|
|
9141 |
|
|
_Syntax_:
|
9142 |
|
|
`RESULT = LNBLNK(STRING)'
|
9143 |
|
|
|
9144 |
|
|
_Arguments_:
|
9145 |
|
|
STRING Shall be a scalar of type `CHARACTER', with
|
9146 |
|
|
`INTENT(IN)'
|
9147 |
|
|
|
9148 |
|
|
_Return value_:
|
9149 |
|
|
The return value is of `INTEGER(kind=4)' type.
|
9150 |
|
|
|
9151 |
|
|
_See also_:
|
9152 |
|
|
*note INDEX intrinsic::, *note LEN_TRIM::
|
9153 |
|
|
|
9154 |
|
|
|
9155 |
|
|
File: gfortran.info, Node: LOC, Next: LOG, Prev: LNBLNK, Up: Intrinsic Procedures
|
9156 |
|
|
|
9157 |
|
|
8.136 `LOC' -- Returns the address of a variable
|
9158 |
|
|
================================================
|
9159 |
|
|
|
9160 |
|
|
_Description_:
|
9161 |
|
|
`LOC(X)' returns the address of X as an integer.
|
9162 |
|
|
|
9163 |
|
|
_Standard_:
|
9164 |
|
|
GNU extension
|
9165 |
|
|
|
9166 |
|
|
_Class_:
|
9167 |
|
|
Inquiry function
|
9168 |
|
|
|
9169 |
|
|
_Syntax_:
|
9170 |
|
|
`RESULT = LOC(X)'
|
9171 |
|
|
|
9172 |
|
|
_Arguments_:
|
9173 |
|
|
X Variable of any type.
|
9174 |
|
|
|
9175 |
|
|
_Return value_:
|
9176 |
|
|
The return value is of type `INTEGER', with a `KIND' corresponding
|
9177 |
|
|
to the size (in bytes) of a memory address on the target machine.
|
9178 |
|
|
|
9179 |
|
|
_Example_:
|
9180 |
|
|
program test_loc
|
9181 |
|
|
integer :: i
|
9182 |
|
|
real :: r
|
9183 |
|
|
i = loc(r)
|
9184 |
|
|
print *, i
|
9185 |
|
|
end program test_loc
|
9186 |
|
|
|
9187 |
|
|
|
9188 |
|
|
File: gfortran.info, Node: LOG, Next: LOG10, Prev: LOC, Up: Intrinsic Procedures
|
9189 |
|
|
|
9190 |
|
|
8.137 `LOG' -- Logarithm function
|
9191 |
|
|
=================================
|
9192 |
|
|
|
9193 |
|
|
_Description_:
|
9194 |
|
|
`LOG(X)' computes the logarithm of X.
|
9195 |
|
|
|
9196 |
|
|
_Standard_:
|
9197 |
|
|
Fortran 77 and later
|
9198 |
|
|
|
9199 |
|
|
_Class_:
|
9200 |
|
|
Elemental function
|
9201 |
|
|
|
9202 |
|
|
_Syntax_:
|
9203 |
|
|
`RESULT = LOG(X)'
|
9204 |
|
|
|
9205 |
|
|
_Arguments_:
|
9206 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
9207 |
|
|
|
9208 |
|
|
_Return value_:
|
9209 |
|
|
The return value is of type `REAL' or `COMPLEX'. The kind type
|
9210 |
|
|
parameter is the same as X. If X is `COMPLEX', the imaginary part
|
9211 |
|
|
\omega is in the range -\pi \leq \omega \leq \pi.
|
9212 |
|
|
|
9213 |
|
|
_Example_:
|
9214 |
|
|
program test_log
|
9215 |
|
|
real(8) :: x = 1.0_8
|
9216 |
|
|
complex :: z = (1.0, 2.0)
|
9217 |
|
|
x = log(x)
|
9218 |
|
|
z = log(z)
|
9219 |
|
|
end program test_log
|
9220 |
|
|
|
9221 |
|
|
_Specific names_:
|
9222 |
|
|
Name Argument Return type Standard
|
9223 |
|
|
`ALOG(X)' `REAL(4) X' `REAL(4)' f95, gnu
|
9224 |
|
|
`DLOG(X)' `REAL(8) X' `REAL(8)' f95, gnu
|
9225 |
|
|
`CLOG(X)' `COMPLEX(4) `COMPLEX(4)' f95, gnu
|
9226 |
|
|
X'
|
9227 |
|
|
`ZLOG(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
|
9228 |
|
|
X'
|
9229 |
|
|
`CDLOG(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
|
9230 |
|
|
X'
|
9231 |
|
|
|
9232 |
|
|
|
9233 |
|
|
File: gfortran.info, Node: LOG10, Next: LOG_GAMMA, Prev: LOG, Up: Intrinsic Procedures
|
9234 |
|
|
|
9235 |
|
|
8.138 `LOG10' -- Base 10 logarithm function
|
9236 |
|
|
===========================================
|
9237 |
|
|
|
9238 |
|
|
_Description_:
|
9239 |
|
|
`LOG10(X)' computes the base 10 logarithm of X.
|
9240 |
|
|
|
9241 |
|
|
_Standard_:
|
9242 |
|
|
Fortran 77 and later
|
9243 |
|
|
|
9244 |
|
|
_Class_:
|
9245 |
|
|
Elemental function
|
9246 |
|
|
|
9247 |
|
|
_Syntax_:
|
9248 |
|
|
`RESULT = LOG10(X)'
|
9249 |
|
|
|
9250 |
|
|
_Arguments_:
|
9251 |
|
|
X The type shall be `REAL'.
|
9252 |
|
|
|
9253 |
|
|
_Return value_:
|
9254 |
|
|
The return value is of type `REAL' or `COMPLEX'. The kind type
|
9255 |
|
|
parameter is the same as X.
|
9256 |
|
|
|
9257 |
|
|
_Example_:
|
9258 |
|
|
program test_log10
|
9259 |
|
|
real(8) :: x = 10.0_8
|
9260 |
|
|
x = log10(x)
|
9261 |
|
|
end program test_log10
|
9262 |
|
|
|
9263 |
|
|
_Specific names_:
|
9264 |
|
|
Name Argument Return type Standard
|
9265 |
|
|
`ALOG10(X)' `REAL(4) X' `REAL(4)' Fortran 95 and
|
9266 |
|
|
later
|
9267 |
|
|
`DLOG10(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
|
9268 |
|
|
later
|
9269 |
|
|
|
9270 |
|
|
|
9271 |
|
|
File: gfortran.info, Node: LOG_GAMMA, Next: LOGICAL, Prev: LOG10, Up: Intrinsic Procedures
|
9272 |
|
|
|
9273 |
|
|
8.139 `LOG_GAMMA' -- Logarithm of the Gamma function
|
9274 |
|
|
====================================================
|
9275 |
|
|
|
9276 |
|
|
_Description_:
|
9277 |
|
|
`LOG_GAMMA(X)' computes the natural logarithm of the absolute value
|
9278 |
|
|
of the Gamma (\Gamma) function.
|
9279 |
|
|
|
9280 |
|
|
_Standard_:
|
9281 |
|
|
Fortran 2008 and later
|
9282 |
|
|
|
9283 |
|
|
_Class_:
|
9284 |
|
|
Elemental function
|
9285 |
|
|
|
9286 |
|
|
_Syntax_:
|
9287 |
|
|
`X = LOG_GAMMA(X)'
|
9288 |
|
|
|
9289 |
|
|
_Arguments_:
|
9290 |
|
|
X Shall be of type `REAL' and neither zero nor a
|
9291 |
|
|
negative integer.
|
9292 |
|
|
|
9293 |
|
|
_Return value_:
|
9294 |
|
|
The return value is of type `REAL' of the same kind as X.
|
9295 |
|
|
|
9296 |
|
|
_Example_:
|
9297 |
|
|
program test_log_gamma
|
9298 |
|
|
real :: x = 1.0
|
9299 |
|
|
x = lgamma(x) ! returns 0.0
|
9300 |
|
|
end program test_log_gamma
|
9301 |
|
|
|
9302 |
|
|
_Specific names_:
|
9303 |
|
|
Name Argument Return type Standard
|
9304 |
|
|
`LGAMMA(X)' `REAL(4) X' `REAL(4)' GNU Extension
|
9305 |
|
|
`ALGAMA(X)' `REAL(4) X' `REAL(4)' GNU Extension
|
9306 |
|
|
`DLGAMA(X)' `REAL(8) X' `REAL(8)' GNU Extension
|
9307 |
|
|
|
9308 |
|
|
_See also_:
|
9309 |
|
|
Gamma function: *note GAMMA::
|
9310 |
|
|
|
9311 |
|
|
|
9312 |
|
|
|
9313 |
|
|
File: gfortran.info, Node: LOGICAL, Next: LONG, Prev: LOG_GAMMA, Up: Intrinsic Procedures
|
9314 |
|
|
|
9315 |
|
|
8.140 `LOGICAL' -- Convert to logical type
|
9316 |
|
|
==========================================
|
9317 |
|
|
|
9318 |
|
|
_Description_:
|
9319 |
|
|
Converts one kind of `LOGICAL' variable to another.
|
9320 |
|
|
|
9321 |
|
|
_Standard_:
|
9322 |
|
|
Fortran 95 and later
|
9323 |
|
|
|
9324 |
|
|
_Class_:
|
9325 |
|
|
Elemental function
|
9326 |
|
|
|
9327 |
|
|
_Syntax_:
|
9328 |
|
|
`RESULT = LOGICAL(L [, KIND])'
|
9329 |
|
|
|
9330 |
|
|
_Arguments_:
|
9331 |
|
|
L The type shall be `LOGICAL'.
|
9332 |
|
|
KIND (Optional) An `INTEGER' initialization
|
9333 |
|
|
expression indicating the kind parameter of
|
9334 |
|
|
the result.
|
9335 |
|
|
|
9336 |
|
|
_Return value_:
|
9337 |
|
|
The return value is a `LOGICAL' value equal to L, with a kind
|
9338 |
|
|
corresponding to KIND, or of the default logical kind if KIND is
|
9339 |
|
|
not given.
|
9340 |
|
|
|
9341 |
|
|
_See also_:
|
9342 |
|
|
*note INT::, *note REAL::, *note CMPLX::
|
9343 |
|
|
|
9344 |
|
|
|
9345 |
|
|
File: gfortran.info, Node: LONG, Next: LSHIFT, Prev: LOGICAL, Up: Intrinsic Procedures
|
9346 |
|
|
|
9347 |
|
|
8.141 `LONG' -- Convert to integer type
|
9348 |
|
|
=======================================
|
9349 |
|
|
|
9350 |
|
|
_Description_:
|
9351 |
|
|
Convert to a `KIND=4' integer type, which is the same size as a C
|
9352 |
|
|
`long' integer. This is equivalent to the standard `INT'
|
9353 |
|
|
intrinsic with an optional argument of `KIND=4', and is only
|
9354 |
|
|
included for backwards compatibility.
|
9355 |
|
|
|
9356 |
|
|
_Standard_:
|
9357 |
|
|
GNU extension
|
9358 |
|
|
|
9359 |
|
|
_Class_:
|
9360 |
|
|
Elemental function
|
9361 |
|
|
|
9362 |
|
|
_Syntax_:
|
9363 |
|
|
`RESULT = LONG(A)'
|
9364 |
|
|
|
9365 |
|
|
_Arguments_:
|
9366 |
|
|
A Shall be of type `INTEGER', `REAL', or
|
9367 |
|
|
`COMPLEX'.
|
9368 |
|
|
|
9369 |
|
|
_Return value_:
|
9370 |
|
|
The return value is a `INTEGER(4)' variable.
|
9371 |
|
|
|
9372 |
|
|
_See also_:
|
9373 |
|
|
*note INT::, *note INT2::, *note INT8::
|
9374 |
|
|
|
9375 |
|
|
|
9376 |
|
|
File: gfortran.info, Node: LSHIFT, Next: LSTAT, Prev: LONG, Up: Intrinsic Procedures
|
9377 |
|
|
|
9378 |
|
|
8.142 `LSHIFT' -- Left shift bits
|
9379 |
|
|
=================================
|
9380 |
|
|
|
9381 |
|
|
_Description_:
|
9382 |
|
|
`LSHIFT' returns a value corresponding to I with all of the bits
|
9383 |
|
|
shifted left by SHIFT places. If the absolute value of SHIFT is
|
9384 |
|
|
greater than `BIT_SIZE(I)', the value is undefined. Bits shifted
|
9385 |
|
|
out from the left end are lost; zeros are shifted in from the
|
9386 |
|
|
opposite end.
|
9387 |
|
|
|
9388 |
|
|
This function has been superseded by the `ISHFT' intrinsic, which
|
9389 |
|
|
is standard in Fortran 95 and later.
|
9390 |
|
|
|
9391 |
|
|
_Standard_:
|
9392 |
|
|
GNU extension
|
9393 |
|
|
|
9394 |
|
|
_Class_:
|
9395 |
|
|
Elemental function
|
9396 |
|
|
|
9397 |
|
|
_Syntax_:
|
9398 |
|
|
`RESULT = LSHIFT(I, SHIFT)'
|
9399 |
|
|
|
9400 |
|
|
_Arguments_:
|
9401 |
|
|
I The type shall be `INTEGER'.
|
9402 |
|
|
SHIFT The type shall be `INTEGER'.
|
9403 |
|
|
|
9404 |
|
|
_Return value_:
|
9405 |
|
|
The return value is of type `INTEGER' and of the same kind as I.
|
9406 |
|
|
|
9407 |
|
|
_See also_:
|
9408 |
|
|
*note ISHFT::, *note ISHFTC::, *note RSHIFT::
|
9409 |
|
|
|
9410 |
|
|
|
9411 |
|
|
|
9412 |
|
|
File: gfortran.info, Node: LSTAT, Next: LTIME, Prev: LSHIFT, Up: Intrinsic Procedures
|
9413 |
|
|
|
9414 |
|
|
8.143 `LSTAT' -- Get file status
|
9415 |
|
|
================================
|
9416 |
|
|
|
9417 |
|
|
_Description_:
|
9418 |
|
|
`LSTAT' is identical to *note STAT::, except that if path is a
|
9419 |
|
|
symbolic link, then the link itself is statted, not the file that
|
9420 |
|
|
it refers to.
|
9421 |
|
|
|
9422 |
|
|
The elements in `VALUES' are the same as described by *note STAT::.
|
9423 |
|
|
|
9424 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
9425 |
|
|
however, only one form can be used in any given program unit.
|
9426 |
|
|
|
9427 |
|
|
_Standard_:
|
9428 |
|
|
GNU extension
|
9429 |
|
|
|
9430 |
|
|
_Class_:
|
9431 |
|
|
Subroutine, function
|
9432 |
|
|
|
9433 |
|
|
_Syntax_:
|
9434 |
|
|
`CALL LSTAT(NAME, VALUES [, STATUS])'
|
9435 |
|
|
|
9436 |
|
|
_Arguments_:
|
9437 |
|
|
NAME The type shall be `CHARACTER' of the default
|
9438 |
|
|
kind, a valid path within the file system.
|
9439 |
|
|
VALUES The type shall be `INTEGER(4), DIMENSION(13)'.
|
9440 |
|
|
STATUS (Optional) status flag of type `INTEGER(4)'.
|
9441 |
|
|
Returns 0 on success and a system specific
|
9442 |
|
|
error code otherwise.
|
9443 |
|
|
|
9444 |
|
|
_Example_:
|
9445 |
|
|
See *note STAT:: for an example.
|
9446 |
|
|
|
9447 |
|
|
_See also_:
|
9448 |
|
|
To stat an open file: *note FSTAT::, to stat a file: *note STAT::
|
9449 |
|
|
|
9450 |
|
|
|
9451 |
|
|
File: gfortran.info, Node: LTIME, Next: MALLOC, Prev: LSTAT, Up: Intrinsic Procedures
|
9452 |
|
|
|
9453 |
|
|
8.144 `LTIME' -- Convert time to local time info
|
9454 |
|
|
================================================
|
9455 |
|
|
|
9456 |
|
|
_Description_:
|
9457 |
|
|
Given a system time value TIME (as provided by the `TIME8()'
|
9458 |
|
|
intrinsic), fills VALUES with values extracted from it appropriate
|
9459 |
|
|
to the local time zone using `localtime(3)'.
|
9460 |
|
|
|
9461 |
|
|
_Standard_:
|
9462 |
|
|
GNU extension
|
9463 |
|
|
|
9464 |
|
|
_Class_:
|
9465 |
|
|
Subroutine
|
9466 |
|
|
|
9467 |
|
|
_Syntax_:
|
9468 |
|
|
`CALL LTIME(TIME, VALUES)'
|
9469 |
|
|
|
9470 |
|
|
_Arguments_:
|
9471 |
|
|
TIME An `INTEGER' scalar expression corresponding
|
9472 |
|
|
to a system time, with `INTENT(IN)'.
|
9473 |
|
|
VALUES A default `INTEGER' array with 9 elements,
|
9474 |
|
|
with `INTENT(OUT)'.
|
9475 |
|
|
|
9476 |
|
|
_Return value_:
|
9477 |
|
|
The elements of VALUES are assigned as follows:
|
9478 |
|
|
1. Seconds after the minute, range 0-59 or 0-61 to allow for leap
|
9479 |
|
|
seconds
|
9480 |
|
|
|
9481 |
|
|
2. Minutes after the hour, range 0-59
|
9482 |
|
|
|
9483 |
|
|
3. Hours past midnight, range 0-23
|
9484 |
|
|
|
9485 |
|
|
4. Day of month, range 0-31
|
9486 |
|
|
|
9487 |
|
|
5. Number of months since January, range 0-12
|
9488 |
|
|
|
9489 |
|
|
6. Years since 1900
|
9490 |
|
|
|
9491 |
|
|
7. Number of days since Sunday, range 0-6
|
9492 |
|
|
|
9493 |
|
|
8. Days since January 1
|
9494 |
|
|
|
9495 |
|
|
9. Daylight savings indicator: positive if daylight savings is in
|
9496 |
|
|
effect, zero if not, and negative if the information is not
|
9497 |
|
|
available.
|
9498 |
|
|
|
9499 |
|
|
_See also_:
|
9500 |
|
|
*note CTIME::, *note GMTIME::, *note TIME::, *note TIME8::
|
9501 |
|
|
|
9502 |
|
|
|
9503 |
|
|
|
9504 |
|
|
File: gfortran.info, Node: MALLOC, Next: MATMUL, Prev: LTIME, Up: Intrinsic Procedures
|
9505 |
|
|
|
9506 |
|
|
8.145 `MALLOC' -- Allocate dynamic memory
|
9507 |
|
|
=========================================
|
9508 |
|
|
|
9509 |
|
|
_Description_:
|
9510 |
|
|
`MALLOC(SIZE)' allocates SIZE bytes of dynamic memory and returns
|
9511 |
|
|
the address of the allocated memory. The `MALLOC' intrinsic is an
|
9512 |
|
|
extension intended to be used with Cray pointers, and is provided
|
9513 |
|
|
in GNU Fortran to allow the user to compile legacy code. For new
|
9514 |
|
|
code using Fortran 95 pointers, the memory allocation intrinsic is
|
9515 |
|
|
`ALLOCATE'.
|
9516 |
|
|
|
9517 |
|
|
_Standard_:
|
9518 |
|
|
GNU extension
|
9519 |
|
|
|
9520 |
|
|
_Class_:
|
9521 |
|
|
Function
|
9522 |
|
|
|
9523 |
|
|
_Syntax_:
|
9524 |
|
|
`PTR = MALLOC(SIZE)'
|
9525 |
|
|
|
9526 |
|
|
_Arguments_:
|
9527 |
|
|
SIZE The type shall be `INTEGER'.
|
9528 |
|
|
|
9529 |
|
|
_Return value_:
|
9530 |
|
|
The return value is of type `INTEGER(K)', with K such that
|
9531 |
|
|
variables of type `INTEGER(K)' have the same size as C pointers
|
9532 |
|
|
(`sizeof(void *)').
|
9533 |
|
|
|
9534 |
|
|
_Example_:
|
9535 |
|
|
The following example demonstrates the use of `MALLOC' and `FREE'
|
9536 |
|
|
with Cray pointers.
|
9537 |
|
|
|
9538 |
|
|
program test_malloc
|
9539 |
|
|
implicit none
|
9540 |
|
|
integer i
|
9541 |
|
|
real*8 x(*), z
|
9542 |
|
|
pointer(ptr_x,x)
|
9543 |
|
|
|
9544 |
|
|
ptr_x = malloc(20*8)
|
9545 |
|
|
do i = 1, 20
|
9546 |
|
|
x(i) = sqrt(1.0d0 / i)
|
9547 |
|
|
end do
|
9548 |
|
|
z = 0
|
9549 |
|
|
do i = 1, 20
|
9550 |
|
|
z = z + x(i)
|
9551 |
|
|
print *, z
|
9552 |
|
|
end do
|
9553 |
|
|
call free(ptr_x)
|
9554 |
|
|
end program test_malloc
|
9555 |
|
|
|
9556 |
|
|
_See also_:
|
9557 |
|
|
*note FREE::
|
9558 |
|
|
|
9559 |
|
|
|
9560 |
|
|
File: gfortran.info, Node: MATMUL, Next: MAX, Prev: MALLOC, Up: Intrinsic Procedures
|
9561 |
|
|
|
9562 |
|
|
8.146 `MATMUL' -- matrix multiplication
|
9563 |
|
|
=======================================
|
9564 |
|
|
|
9565 |
|
|
_Description_:
|
9566 |
|
|
Performs a matrix multiplication on numeric or logical arguments.
|
9567 |
|
|
|
9568 |
|
|
_Standard_:
|
9569 |
|
|
Fortran 95 and later
|
9570 |
|
|
|
9571 |
|
|
_Class_:
|
9572 |
|
|
Transformational function
|
9573 |
|
|
|
9574 |
|
|
_Syntax_:
|
9575 |
|
|
`RESULT = MATMUL(MATRIX_A, MATRIX_B)'
|
9576 |
|
|
|
9577 |
|
|
_Arguments_:
|
9578 |
|
|
MATRIX_A An array of `INTEGER', `REAL', `COMPLEX', or
|
9579 |
|
|
`LOGICAL' type, with a rank of one or two.
|
9580 |
|
|
MATRIX_B An array of `INTEGER', `REAL', or `COMPLEX'
|
9581 |
|
|
type if MATRIX_A is of a numeric type;
|
9582 |
|
|
otherwise, an array of `LOGICAL' type. The
|
9583 |
|
|
rank shall be one or two, and the first (or
|
9584 |
|
|
only) dimension of MATRIX_B shall be equal to
|
9585 |
|
|
the last (or only) dimension of MATRIX_A.
|
9586 |
|
|
|
9587 |
|
|
_Return value_:
|
9588 |
|
|
The matrix product of MATRIX_A and MATRIX_B. The type and kind of
|
9589 |
|
|
the result follow the usual type and kind promotion rules, as for
|
9590 |
|
|
the `*' or `.AND.' operators.
|
9591 |
|
|
|
9592 |
|
|
_See also_:
|
9593 |
|
|
|
9594 |
|
|
|
9595 |
|
|
File: gfortran.info, Node: MAX, Next: MAXEXPONENT, Prev: MATMUL, Up: Intrinsic Procedures
|
9596 |
|
|
|
9597 |
|
|
8.147 `MAX' -- Maximum value of an argument list
|
9598 |
|
|
================================================
|
9599 |
|
|
|
9600 |
|
|
_Description_:
|
9601 |
|
|
Returns the argument with the largest (most positive) value.
|
9602 |
|
|
|
9603 |
|
|
_Standard_:
|
9604 |
|
|
Fortran 77 and later
|
9605 |
|
|
|
9606 |
|
|
_Class_:
|
9607 |
|
|
Elemental function
|
9608 |
|
|
|
9609 |
|
|
_Syntax_:
|
9610 |
|
|
`RESULT = MAX(A1, A2 [, A3 [, ...]])'
|
9611 |
|
|
|
9612 |
|
|
_Arguments_:
|
9613 |
|
|
A1 The type shall be `INTEGER' or `REAL'.
|
9614 |
|
|
A2, A3, An expression of the same type and kind as A1.
|
9615 |
|
|
... (As a GNU extension, arguments of different
|
9616 |
|
|
kinds are permitted.)
|
9617 |
|
|
|
9618 |
|
|
_Return value_:
|
9619 |
|
|
The return value corresponds to the maximum value among the
|
9620 |
|
|
arguments, and has the same type and kind as the first argument.
|
9621 |
|
|
|
9622 |
|
|
_Specific names_:
|
9623 |
|
|
Name Argument Return type Standard
|
9624 |
|
|
`MAX0(I)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
|
9625 |
|
|
I' later
|
9626 |
|
|
`AMAX0(I)' `INTEGER(4) `REAL(MAX(X))'Fortran 77 and
|
9627 |
|
|
I' later
|
9628 |
|
|
`MAX1(X)' `REAL X' `INT(MAX(X))' Fortran 77 and
|
9629 |
|
|
later
|
9630 |
|
|
`AMAX1(X)' `REAL(4) `REAL(4)' Fortran 77 and
|
9631 |
|
|
X' later
|
9632 |
|
|
`DMAX1(X)' `REAL(8) `REAL(8)' Fortran 77 and
|
9633 |
|
|
X' later
|
9634 |
|
|
|
9635 |
|
|
_See also_:
|
9636 |
|
|
*note MAXLOC:: *note MAXVAL::, *note MIN::
|
9637 |
|
|
|
9638 |
|
|
|
9639 |
|
|
|
9640 |
|
|
File: gfortran.info, Node: MAXEXPONENT, Next: MAXLOC, Prev: MAX, Up: Intrinsic Procedures
|
9641 |
|
|
|
9642 |
|
|
8.148 `MAXEXPONENT' -- Maximum exponent of a real kind
|
9643 |
|
|
======================================================
|
9644 |
|
|
|
9645 |
|
|
_Description_:
|
9646 |
|
|
`MAXEXPONENT(X)' returns the maximum exponent in the model of the
|
9647 |
|
|
type of `X'.
|
9648 |
|
|
|
9649 |
|
|
_Standard_:
|
9650 |
|
|
Fortran 95 and later
|
9651 |
|
|
|
9652 |
|
|
_Class_:
|
9653 |
|
|
Inquiry function
|
9654 |
|
|
|
9655 |
|
|
_Syntax_:
|
9656 |
|
|
`RESULT = MAXEXPONENT(X)'
|
9657 |
|
|
|
9658 |
|
|
_Arguments_:
|
9659 |
|
|
X Shall be of type `REAL'.
|
9660 |
|
|
|
9661 |
|
|
_Return value_:
|
9662 |
|
|
The return value is of type `INTEGER' and of the default integer
|
9663 |
|
|
kind.
|
9664 |
|
|
|
9665 |
|
|
_Example_:
|
9666 |
|
|
program exponents
|
9667 |
|
|
real(kind=4) :: x
|
9668 |
|
|
real(kind=8) :: y
|
9669 |
|
|
|
9670 |
|
|
print *, minexponent(x), maxexponent(x)
|
9671 |
|
|
print *, minexponent(y), maxexponent(y)
|
9672 |
|
|
end program exponents
|
9673 |
|
|
|
9674 |
|
|
|
9675 |
|
|
File: gfortran.info, Node: MAXLOC, Next: MAXVAL, Prev: MAXEXPONENT, Up: Intrinsic Procedures
|
9676 |
|
|
|
9677 |
|
|
8.149 `MAXLOC' -- Location of the maximum value within an array
|
9678 |
|
|
===============================================================
|
9679 |
|
|
|
9680 |
|
|
_Description_:
|
9681 |
|
|
Determines the location of the element in the array with the
|
9682 |
|
|
maximum value, or, if the DIM argument is supplied, determines the
|
9683 |
|
|
locations of the maximum element along each row of the array in the
|
9684 |
|
|
DIM direction. If MASK is present, only the elements for which
|
9685 |
|
|
MASK is `.TRUE.' are considered. If more than one element in the
|
9686 |
|
|
array has the maximum value, the location returned is that of the
|
9687 |
|
|
first such element in array element order. If the array has zero
|
9688 |
|
|
size, or all of the elements of MASK are `.FALSE.', then the
|
9689 |
|
|
result is an array of zeroes. Similarly, if DIM is supplied and
|
9690 |
|
|
all of the elements of MASK along a given row are zero, the result
|
9691 |
|
|
value for that row is zero.
|
9692 |
|
|
|
9693 |
|
|
_Standard_:
|
9694 |
|
|
Fortran 95 and later
|
9695 |
|
|
|
9696 |
|
|
_Class_:
|
9697 |
|
|
Transformational function
|
9698 |
|
|
|
9699 |
|
|
_Syntax_:
|
9700 |
|
|
`RESULT = MAXLOC(ARRAY, DIM [, MASK])'
|
9701 |
|
|
`RESULT = MAXLOC(ARRAY [, MASK])'
|
9702 |
|
|
|
9703 |
|
|
_Arguments_:
|
9704 |
|
|
ARRAY Shall be an array of type `INTEGER' or `REAL'.
|
9705 |
|
|
DIM (Optional) Shall be a scalar of type
|
9706 |
|
|
`INTEGER', with a value between one and the
|
9707 |
|
|
rank of ARRAY, inclusive. It may not be an
|
9708 |
|
|
optional dummy argument.
|
9709 |
|
|
MASK Shall be an array of type `LOGICAL', and
|
9710 |
|
|
conformable with ARRAY.
|
9711 |
|
|
|
9712 |
|
|
_Return value_:
|
9713 |
|
|
If DIM is absent, the result is a rank-one array with a length
|
9714 |
|
|
equal to the rank of ARRAY. If DIM is present, the result is an
|
9715 |
|
|
array with a rank one less than the rank of ARRAY, and a size
|
9716 |
|
|
corresponding to the size of ARRAY with the DIM dimension removed.
|
9717 |
|
|
If DIM is present and ARRAY has a rank of one, the result is a
|
9718 |
|
|
scalar. In all cases, the result is of default `INTEGER' type.
|
9719 |
|
|
|
9720 |
|
|
_See also_:
|
9721 |
|
|
*note MAX::, *note MAXVAL::
|
9722 |
|
|
|
9723 |
|
|
|
9724 |
|
|
|
9725 |
|
|
File: gfortran.info, Node: MAXVAL, Next: MCLOCK, Prev: MAXLOC, Up: Intrinsic Procedures
|
9726 |
|
|
|
9727 |
|
|
8.150 `MAXVAL' -- Maximum value of an array
|
9728 |
|
|
===========================================
|
9729 |
|
|
|
9730 |
|
|
_Description_:
|
9731 |
|
|
Determines the maximum value of the elements in an array value,
|
9732 |
|
|
or, if the DIM argument is supplied, determines the maximum value
|
9733 |
|
|
along each row of the array in the DIM direction. If MASK is
|
9734 |
|
|
present, only the elements for which MASK is `.TRUE.' are
|
9735 |
|
|
considered. If the array has zero size, or all of the elements of
|
9736 |
|
|
MASK are `.FALSE.', then the result is `-HUGE(ARRAY)' if ARRAY is
|
9737 |
|
|
numeric, or a string of nulls if ARRAY is of character type.
|
9738 |
|
|
|
9739 |
|
|
_Standard_:
|
9740 |
|
|
Fortran 95 and later
|
9741 |
|
|
|
9742 |
|
|
_Class_:
|
9743 |
|
|
Transformational function
|
9744 |
|
|
|
9745 |
|
|
_Syntax_:
|
9746 |
|
|
`RESULT = MAXVAL(ARRAY, DIM [, MASK])'
|
9747 |
|
|
`RESULT = MAXVAL(ARRAY [, MASK])'
|
9748 |
|
|
|
9749 |
|
|
_Arguments_:
|
9750 |
|
|
ARRAY Shall be an array of type `INTEGER' or `REAL'.
|
9751 |
|
|
DIM (Optional) Shall be a scalar of type
|
9752 |
|
|
`INTEGER', with a value between one and the
|
9753 |
|
|
rank of ARRAY, inclusive. It may not be an
|
9754 |
|
|
optional dummy argument.
|
9755 |
|
|
MASK Shall be an array of type `LOGICAL', and
|
9756 |
|
|
conformable with ARRAY.
|
9757 |
|
|
|
9758 |
|
|
_Return value_:
|
9759 |
|
|
If DIM is absent, or if ARRAY has a rank of one, the result is a
|
9760 |
|
|
scalar. If DIM is present, the result is an array with a rank one
|
9761 |
|
|
less than the rank of ARRAY, and a size corresponding to the size
|
9762 |
|
|
of ARRAY with the DIM dimension removed. In all cases, the result
|
9763 |
|
|
is of the same type and kind as ARRAY.
|
9764 |
|
|
|
9765 |
|
|
_See also_:
|
9766 |
|
|
*note MAX::, *note MAXLOC::
|
9767 |
|
|
|
9768 |
|
|
|
9769 |
|
|
File: gfortran.info, Node: MCLOCK, Next: MCLOCK8, Prev: MAXVAL, Up: Intrinsic Procedures
|
9770 |
|
|
|
9771 |
|
|
8.151 `MCLOCK' -- Time function
|
9772 |
|
|
===============================
|
9773 |
|
|
|
9774 |
|
|
_Description_:
|
9775 |
|
|
Returns the number of clock ticks since the start of the process,
|
9776 |
|
|
based on the UNIX function `clock(3)'.
|
9777 |
|
|
|
9778 |
|
|
This intrinsic is not fully portable, such as to systems with
|
9779 |
|
|
32-bit `INTEGER' types but supporting times wider than 32 bits.
|
9780 |
|
|
Therefore, the values returned by this intrinsic might be, or
|
9781 |
|
|
become, negative, or numerically less than previous values, during
|
9782 |
|
|
a single run of the compiled program.
|
9783 |
|
|
|
9784 |
|
|
_Standard_:
|
9785 |
|
|
GNU extension
|
9786 |
|
|
|
9787 |
|
|
_Class_:
|
9788 |
|
|
Function
|
9789 |
|
|
|
9790 |
|
|
_Syntax_:
|
9791 |
|
|
`RESULT = MCLOCK()'
|
9792 |
|
|
|
9793 |
|
|
_Return value_:
|
9794 |
|
|
The return value is a scalar of type `INTEGER(4)', equal to the
|
9795 |
|
|
number of clock ticks since the start of the process, or `-1' if
|
9796 |
|
|
the system does not support `clock(3)'.
|
9797 |
|
|
|
9798 |
|
|
_See also_:
|
9799 |
|
|
*note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::,
|
9800 |
|
|
*note TIME::
|
9801 |
|
|
|
9802 |
|
|
|
9803 |
|
|
|
9804 |
|
|
File: gfortran.info, Node: MCLOCK8, Next: MERGE, Prev: MCLOCK, Up: Intrinsic Procedures
|
9805 |
|
|
|
9806 |
|
|
8.152 `MCLOCK8' -- Time function (64-bit)
|
9807 |
|
|
=========================================
|
9808 |
|
|
|
9809 |
|
|
_Description_:
|
9810 |
|
|
Returns the number of clock ticks since the start of the process,
|
9811 |
|
|
based on the UNIX function `clock(3)'.
|
9812 |
|
|
|
9813 |
|
|
_Warning:_ this intrinsic does not increase the range of the timing
|
9814 |
|
|
values over that returned by `clock(3)'. On a system with a 32-bit
|
9815 |
|
|
`clock(3)', `MCLOCK8()' will return a 32-bit value, even though it
|
9816 |
|
|
is converted to a 64-bit `INTEGER(8)' value. That means overflows
|
9817 |
|
|
of the 32-bit value can still occur. Therefore, the values
|
9818 |
|
|
returned by this intrinsic might be or become negative or
|
9819 |
|
|
numerically less than previous values during a single run of the
|
9820 |
|
|
compiled program.
|
9821 |
|
|
|
9822 |
|
|
_Standard_:
|
9823 |
|
|
GNU extension
|
9824 |
|
|
|
9825 |
|
|
_Class_:
|
9826 |
|
|
Function
|
9827 |
|
|
|
9828 |
|
|
_Syntax_:
|
9829 |
|
|
`RESULT = MCLOCK8()'
|
9830 |
|
|
|
9831 |
|
|
_Return value_:
|
9832 |
|
|
The return value is a scalar of type `INTEGER(8)', equal to the
|
9833 |
|
|
number of clock ticks since the start of the process, or `-1' if
|
9834 |
|
|
the system does not support `clock(3)'.
|
9835 |
|
|
|
9836 |
|
|
_See also_:
|
9837 |
|
|
*note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::,
|
9838 |
|
|
*note TIME8::
|
9839 |
|
|
|
9840 |
|
|
|
9841 |
|
|
|
9842 |
|
|
File: gfortran.info, Node: MERGE, Next: MIN, Prev: MCLOCK8, Up: Intrinsic Procedures
|
9843 |
|
|
|
9844 |
|
|
8.153 `MERGE' -- Merge variables
|
9845 |
|
|
================================
|
9846 |
|
|
|
9847 |
|
|
_Description_:
|
9848 |
|
|
Select values from two arrays according to a logical mask. The
|
9849 |
|
|
result is equal to TSOURCE if MASK is `.TRUE.', or equal to
|
9850 |
|
|
FSOURCE if it is `.FALSE.'.
|
9851 |
|
|
|
9852 |
|
|
_Standard_:
|
9853 |
|
|
Fortran 95 and later
|
9854 |
|
|
|
9855 |
|
|
_Class_:
|
9856 |
|
|
Elemental function
|
9857 |
|
|
|
9858 |
|
|
_Syntax_:
|
9859 |
|
|
`RESULT = MERGE(TSOURCE, FSOURCE, MASK)'
|
9860 |
|
|
|
9861 |
|
|
_Arguments_:
|
9862 |
|
|
TSOURCE May be of any type.
|
9863 |
|
|
FSOURCE Shall be of the same type and type parameters
|
9864 |
|
|
as TSOURCE.
|
9865 |
|
|
MASK Shall be of type `LOGICAL'.
|
9866 |
|
|
|
9867 |
|
|
_Return value_:
|
9868 |
|
|
The result is of the same type and type parameters as TSOURCE.
|
9869 |
|
|
|
9870 |
|
|
|
9871 |
|
|
|
9872 |
|
|
File: gfortran.info, Node: MIN, Next: MINEXPONENT, Prev: MERGE, Up: Intrinsic Procedures
|
9873 |
|
|
|
9874 |
|
|
8.154 `MIN' -- Minimum value of an argument list
|
9875 |
|
|
================================================
|
9876 |
|
|
|
9877 |
|
|
_Description_:
|
9878 |
|
|
Returns the argument with the smallest (most negative) value.
|
9879 |
|
|
|
9880 |
|
|
_Standard_:
|
9881 |
|
|
Fortran 77 and later
|
9882 |
|
|
|
9883 |
|
|
_Class_:
|
9884 |
|
|
Elemental function
|
9885 |
|
|
|
9886 |
|
|
_Syntax_:
|
9887 |
|
|
`RESULT = MIN(A1, A2 [, A3, ...])'
|
9888 |
|
|
|
9889 |
|
|
_Arguments_:
|
9890 |
|
|
A1 The type shall be `INTEGER' or `REAL'.
|
9891 |
|
|
A2, A3, An expression of the same type and kind as A1.
|
9892 |
|
|
... (As a GNU extension, arguments of different
|
9893 |
|
|
kinds are permitted.)
|
9894 |
|
|
|
9895 |
|
|
_Return value_:
|
9896 |
|
|
The return value corresponds to the maximum value among the
|
9897 |
|
|
arguments, and has the same type and kind as the first argument.
|
9898 |
|
|
|
9899 |
|
|
_Specific names_:
|
9900 |
|
|
Name Argument Return type Standard
|
9901 |
|
|
`MIN0(I)' `INTEGER(4) `INTEGER(4)' Fortran 77 and
|
9902 |
|
|
I' later
|
9903 |
|
|
`AMIN0(I)' `INTEGER(4) `REAL(MIN(X))'Fortran 77 and
|
9904 |
|
|
I' later
|
9905 |
|
|
`MIN1(X)' `REAL X' `INT(MIN(X))' Fortran 77 and
|
9906 |
|
|
later
|
9907 |
|
|
`AMIN1(X)' `REAL(4) `REAL(4)' Fortran 77 and
|
9908 |
|
|
X' later
|
9909 |
|
|
`DMIN1(X)' `REAL(8) `REAL(8)' Fortran 77 and
|
9910 |
|
|
X' later
|
9911 |
|
|
|
9912 |
|
|
_See also_:
|
9913 |
|
|
*note MAX::, *note MINLOC::, *note MINVAL::
|
9914 |
|
|
|
9915 |
|
|
|
9916 |
|
|
File: gfortran.info, Node: MINEXPONENT, Next: MINLOC, Prev: MIN, Up: Intrinsic Procedures
|
9917 |
|
|
|
9918 |
|
|
8.155 `MINEXPONENT' -- Minimum exponent of a real kind
|
9919 |
|
|
======================================================
|
9920 |
|
|
|
9921 |
|
|
_Description_:
|
9922 |
|
|
`MINEXPONENT(X)' returns the minimum exponent in the model of the
|
9923 |
|
|
type of `X'.
|
9924 |
|
|
|
9925 |
|
|
_Standard_:
|
9926 |
|
|
Fortran 95 and later
|
9927 |
|
|
|
9928 |
|
|
_Class_:
|
9929 |
|
|
Inquiry function
|
9930 |
|
|
|
9931 |
|
|
_Syntax_:
|
9932 |
|
|
`RESULT = MINEXPONENT(X)'
|
9933 |
|
|
|
9934 |
|
|
_Arguments_:
|
9935 |
|
|
X Shall be of type `REAL'.
|
9936 |
|
|
|
9937 |
|
|
_Return value_:
|
9938 |
|
|
The return value is of type `INTEGER' and of the default integer
|
9939 |
|
|
kind.
|
9940 |
|
|
|
9941 |
|
|
_Example_:
|
9942 |
|
|
See `MAXEXPONENT' for an example.
|
9943 |
|
|
|
9944 |
|
|
|
9945 |
|
|
File: gfortran.info, Node: MINLOC, Next: MINVAL, Prev: MINEXPONENT, Up: Intrinsic Procedures
|
9946 |
|
|
|
9947 |
|
|
8.156 `MINLOC' -- Location of the minimum value within an array
|
9948 |
|
|
===============================================================
|
9949 |
|
|
|
9950 |
|
|
_Description_:
|
9951 |
|
|
Determines the location of the element in the array with the
|
9952 |
|
|
minimum value, or, if the DIM argument is supplied, determines the
|
9953 |
|
|
locations of the minimum element along each row of the array in the
|
9954 |
|
|
DIM direction. If MASK is present, only the elements for which
|
9955 |
|
|
MASK is `.TRUE.' are considered. If more than one element in the
|
9956 |
|
|
array has the minimum value, the location returned is that of the
|
9957 |
|
|
first such element in array element order. If the array has zero
|
9958 |
|
|
size, or all of the elements of MASK are `.FALSE.', then the
|
9959 |
|
|
result is an array of zeroes. Similarly, if DIM is supplied and
|
9960 |
|
|
all of the elements of MASK along a given row are zero, the result
|
9961 |
|
|
value for that row is zero.
|
9962 |
|
|
|
9963 |
|
|
_Standard_:
|
9964 |
|
|
Fortran 95 and later
|
9965 |
|
|
|
9966 |
|
|
_Class_:
|
9967 |
|
|
Transformational function
|
9968 |
|
|
|
9969 |
|
|
_Syntax_:
|
9970 |
|
|
`RESULT = MINLOC(ARRAY, DIM [, MASK])'
|
9971 |
|
|
`RESULT = MINLOC(ARRAY [, MASK])'
|
9972 |
|
|
|
9973 |
|
|
_Arguments_:
|
9974 |
|
|
ARRAY Shall be an array of type `INTEGER' or `REAL'.
|
9975 |
|
|
DIM (Optional) Shall be a scalar of type
|
9976 |
|
|
`INTEGER', with a value between one and the
|
9977 |
|
|
rank of ARRAY, inclusive. It may not be an
|
9978 |
|
|
optional dummy argument.
|
9979 |
|
|
MASK Shall be an array of type `LOGICAL', and
|
9980 |
|
|
conformable with ARRAY.
|
9981 |
|
|
|
9982 |
|
|
_Return value_:
|
9983 |
|
|
If DIM is absent, the result is a rank-one array with a length
|
9984 |
|
|
equal to the rank of ARRAY. If DIM is present, the result is an
|
9985 |
|
|
array with a rank one less than the rank of ARRAY, and a size
|
9986 |
|
|
corresponding to the size of ARRAY with the DIM dimension removed.
|
9987 |
|
|
If DIM is present and ARRAY has a rank of one, the result is a
|
9988 |
|
|
scalar. In all cases, the result is of default `INTEGER' type.
|
9989 |
|
|
|
9990 |
|
|
_See also_:
|
9991 |
|
|
*note MIN::, *note MINVAL::
|
9992 |
|
|
|
9993 |
|
|
|
9994 |
|
|
|
9995 |
|
|
File: gfortran.info, Node: MINVAL, Next: MOD, Prev: MINLOC, Up: Intrinsic Procedures
|
9996 |
|
|
|
9997 |
|
|
8.157 `MINVAL' -- Minimum value of an array
|
9998 |
|
|
===========================================
|
9999 |
|
|
|
10000 |
|
|
_Description_:
|
10001 |
|
|
Determines the minimum value of the elements in an array value,
|
10002 |
|
|
or, if the DIM argument is supplied, determines the minimum value
|
10003 |
|
|
along each row of the array in the DIM direction. If MASK is
|
10004 |
|
|
present, only the elements for which MASK is `.TRUE.' are
|
10005 |
|
|
considered. If the array has zero size, or all of the elements of
|
10006 |
|
|
MASK are `.FALSE.', then the result is `HUGE(ARRAY)' if ARRAY is
|
10007 |
|
|
numeric, or a string of `CHAR(255)' characters if ARRAY is of
|
10008 |
|
|
character type.
|
10009 |
|
|
|
10010 |
|
|
_Standard_:
|
10011 |
|
|
Fortran 95 and later
|
10012 |
|
|
|
10013 |
|
|
_Class_:
|
10014 |
|
|
Transformational function
|
10015 |
|
|
|
10016 |
|
|
_Syntax_:
|
10017 |
|
|
`RESULT = MINVAL(ARRAY, DIM [, MASK])'
|
10018 |
|
|
`RESULT = MINVAL(ARRAY [, MASK])'
|
10019 |
|
|
|
10020 |
|
|
_Arguments_:
|
10021 |
|
|
ARRAY Shall be an array of type `INTEGER' or `REAL'.
|
10022 |
|
|
DIM (Optional) Shall be a scalar of type
|
10023 |
|
|
`INTEGER', with a value between one and the
|
10024 |
|
|
rank of ARRAY, inclusive. It may not be an
|
10025 |
|
|
optional dummy argument.
|
10026 |
|
|
MASK Shall be an array of type `LOGICAL', and
|
10027 |
|
|
conformable with ARRAY.
|
10028 |
|
|
|
10029 |
|
|
_Return value_:
|
10030 |
|
|
If DIM is absent, or if ARRAY has a rank of one, the result is a
|
10031 |
|
|
scalar. If DIM is present, the result is an array with a rank one
|
10032 |
|
|
less than the rank of ARRAY, and a size corresponding to the size
|
10033 |
|
|
of ARRAY with the DIM dimension removed. In all cases, the result
|
10034 |
|
|
is of the same type and kind as ARRAY.
|
10035 |
|
|
|
10036 |
|
|
_See also_:
|
10037 |
|
|
*note MIN::, *note MINLOC::
|
10038 |
|
|
|
10039 |
|
|
|
10040 |
|
|
|
10041 |
|
|
File: gfortran.info, Node: MOD, Next: MODULO, Prev: MINVAL, Up: Intrinsic Procedures
|
10042 |
|
|
|
10043 |
|
|
8.158 `MOD' -- Remainder function
|
10044 |
|
|
=================================
|
10045 |
|
|
|
10046 |
|
|
_Description_:
|
10047 |
|
|
`MOD(A,P)' computes the remainder of the division of A by P. It is
|
10048 |
|
|
calculated as `A - (INT(A/P) * P)'.
|
10049 |
|
|
|
10050 |
|
|
_Standard_:
|
10051 |
|
|
Fortran 77 and later
|
10052 |
|
|
|
10053 |
|
|
_Class_:
|
10054 |
|
|
Elemental function
|
10055 |
|
|
|
10056 |
|
|
_Syntax_:
|
10057 |
|
|
`RESULT = MOD(A, P)'
|
10058 |
|
|
|
10059 |
|
|
_Arguments_:
|
10060 |
|
|
A Shall be a scalar of type `INTEGER' or `REAL'
|
10061 |
|
|
P Shall be a scalar of the same type as A and not
|
10062 |
|
|
equal to zero
|
10063 |
|
|
|
10064 |
|
|
_Return value_:
|
10065 |
|
|
The kind of the return value is the result of cross-promoting the
|
10066 |
|
|
kinds of the arguments.
|
10067 |
|
|
|
10068 |
|
|
_Example_:
|
10069 |
|
|
program test_mod
|
10070 |
|
|
print *, mod(17,3)
|
10071 |
|
|
print *, mod(17.5,5.5)
|
10072 |
|
|
print *, mod(17.5d0,5.5)
|
10073 |
|
|
print *, mod(17.5,5.5d0)
|
10074 |
|
|
|
10075 |
|
|
print *, mod(-17,3)
|
10076 |
|
|
print *, mod(-17.5,5.5)
|
10077 |
|
|
print *, mod(-17.5d0,5.5)
|
10078 |
|
|
print *, mod(-17.5,5.5d0)
|
10079 |
|
|
|
10080 |
|
|
print *, mod(17,-3)
|
10081 |
|
|
print *, mod(17.5,-5.5)
|
10082 |
|
|
print *, mod(17.5d0,-5.5)
|
10083 |
|
|
print *, mod(17.5,-5.5d0)
|
10084 |
|
|
end program test_mod
|
10085 |
|
|
|
10086 |
|
|
_Specific names_:
|
10087 |
|
|
Name Arguments Return type Standard
|
10088 |
|
|
`AMOD(A,P)' `REAL(4)' `REAL(4)' Fortran 95 and
|
10089 |
|
|
later
|
10090 |
|
|
`DMOD(A,P)' `REAL(8)' `REAL(8)' Fortran 95 and
|
10091 |
|
|
later
|
10092 |
|
|
|
10093 |
|
|
|
10094 |
|
|
File: gfortran.info, Node: MODULO, Next: MOVE_ALLOC, Prev: MOD, Up: Intrinsic Procedures
|
10095 |
|
|
|
10096 |
|
|
8.159 `MODULO' -- Modulo function
|
10097 |
|
|
=================================
|
10098 |
|
|
|
10099 |
|
|
_Description_:
|
10100 |
|
|
`MODULO(A,P)' computes the A modulo P.
|
10101 |
|
|
|
10102 |
|
|
_Standard_:
|
10103 |
|
|
Fortran 95 and later
|
10104 |
|
|
|
10105 |
|
|
_Class_:
|
10106 |
|
|
Elemental function
|
10107 |
|
|
|
10108 |
|
|
_Syntax_:
|
10109 |
|
|
`RESULT = MODULO(A, P)'
|
10110 |
|
|
|
10111 |
|
|
_Arguments_:
|
10112 |
|
|
A Shall be a scalar of type `INTEGER' or `REAL'
|
10113 |
|
|
P Shall be a scalar of the same type and kind as
|
10114 |
|
|
A
|
10115 |
|
|
|
10116 |
|
|
_Return value_:
|
10117 |
|
|
The type and kind of the result are those of the arguments.
|
10118 |
|
|
If A and P are of type `INTEGER':
|
10119 |
|
|
`MODULO(A,P)' has the value R such that `A=Q*P+R', where Q is
|
10120 |
|
|
an integer and R is between 0 (inclusive) and P (exclusive).
|
10121 |
|
|
|
10122 |
|
|
If A and P are of type `REAL':
|
10123 |
|
|
`MODULO(A,P)' has the value of `A - FLOOR (A / P) * P'.
|
10124 |
|
|
In all cases, if P is zero the result is processor-dependent.
|
10125 |
|
|
|
10126 |
|
|
_Example_:
|
10127 |
|
|
program test_modulo
|
10128 |
|
|
print *, modulo(17,3)
|
10129 |
|
|
print *, modulo(17.5,5.5)
|
10130 |
|
|
|
10131 |
|
|
print *, modulo(-17,3)
|
10132 |
|
|
print *, modulo(-17.5,5.5)
|
10133 |
|
|
|
10134 |
|
|
print *, modulo(17,-3)
|
10135 |
|
|
print *, modulo(17.5,-5.5)
|
10136 |
|
|
end program
|
10137 |
|
|
|
10138 |
|
|
|
10139 |
|
|
|
10140 |
|
|
File: gfortran.info, Node: MOVE_ALLOC, Next: MVBITS, Prev: MODULO, Up: Intrinsic Procedures
|
10141 |
|
|
|
10142 |
|
|
8.160 `MOVE_ALLOC' -- Move allocation from one object to another
|
10143 |
|
|
================================================================
|
10144 |
|
|
|
10145 |
|
|
_Description_:
|
10146 |
|
|
`MOVE_ALLOC(FROM, TO)' moves the allocation from FROM to TO. FROM
|
10147 |
|
|
will become deallocated in the process.
|
10148 |
|
|
|
10149 |
|
|
_Standard_:
|
10150 |
|
|
Fortran 2003 and later
|
10151 |
|
|
|
10152 |
|
|
_Class_:
|
10153 |
|
|
Subroutine
|
10154 |
|
|
|
10155 |
|
|
_Syntax_:
|
10156 |
|
|
`CALL MOVE_ALLOC(FROM, TO)'
|
10157 |
|
|
|
10158 |
|
|
_Arguments_:
|
10159 |
|
|
FROM `ALLOCATABLE', `INTENT(INOUT)', may be of any
|
10160 |
|
|
type and kind.
|
10161 |
|
|
TO `ALLOCATABLE', `INTENT(OUT)', shall be of the
|
10162 |
|
|
same type, kind and rank as FROM.
|
10163 |
|
|
|
10164 |
|
|
_Return value_:
|
10165 |
|
|
None
|
10166 |
|
|
|
10167 |
|
|
_Example_:
|
10168 |
|
|
program test_move_alloc
|
10169 |
|
|
integer, allocatable :: a(:), b(:)
|
10170 |
|
|
|
10171 |
|
|
allocate(a(3))
|
10172 |
|
|
a = [ 1, 2, 3 ]
|
10173 |
|
|
call move_alloc(a, b)
|
10174 |
|
|
print *, allocated(a), allocated(b)
|
10175 |
|
|
print *, b
|
10176 |
|
|
end program test_move_alloc
|
10177 |
|
|
|
10178 |
|
|
|
10179 |
|
|
File: gfortran.info, Node: MVBITS, Next: NEAREST, Prev: MOVE_ALLOC, Up: Intrinsic Procedures
|
10180 |
|
|
|
10181 |
|
|
8.161 `MVBITS' -- Move bits from one integer to another
|
10182 |
|
|
=======================================================
|
10183 |
|
|
|
10184 |
|
|
_Description_:
|
10185 |
|
|
Moves LEN bits from positions FROMPOS through `FROMPOS+LEN-1' of
|
10186 |
|
|
FROM to positions TOPOS through `TOPOS+LEN-1' of TO. The portion
|
10187 |
|
|
of argument TO not affected by the movement of bits is unchanged.
|
10188 |
|
|
The values of `FROMPOS+LEN-1' and `TOPOS+LEN-1' must be less than
|
10189 |
|
|
`BIT_SIZE(FROM)'.
|
10190 |
|
|
|
10191 |
|
|
_Standard_:
|
10192 |
|
|
Fortran 95 and later
|
10193 |
|
|
|
10194 |
|
|
_Class_:
|
10195 |
|
|
Elemental subroutine
|
10196 |
|
|
|
10197 |
|
|
_Syntax_:
|
10198 |
|
|
`CALL MVBITS(FROM, FROMPOS, LEN, TO, TOPOS)'
|
10199 |
|
|
|
10200 |
|
|
_Arguments_:
|
10201 |
|
|
FROM The type shall be `INTEGER'.
|
10202 |
|
|
FROMPOS The type shall be `INTEGER'.
|
10203 |
|
|
LEN The type shall be `INTEGER'.
|
10204 |
|
|
TO The type shall be `INTEGER', of the same kind
|
10205 |
|
|
as FROM.
|
10206 |
|
|
TOPOS The type shall be `INTEGER'.
|
10207 |
|
|
|
10208 |
|
|
_See also_:
|
10209 |
|
|
*note IBCLR::, *note IBSET::, *note IBITS::, *note IAND::, *note
|
10210 |
|
|
IOR::, *note IEOR::
|
10211 |
|
|
|
10212 |
|
|
|
10213 |
|
|
File: gfortran.info, Node: NEAREST, Next: NEW_LINE, Prev: MVBITS, Up: Intrinsic Procedures
|
10214 |
|
|
|
10215 |
|
|
8.162 `NEAREST' -- Nearest representable number
|
10216 |
|
|
===============================================
|
10217 |
|
|
|
10218 |
|
|
_Description_:
|
10219 |
|
|
`NEAREST(X, S)' returns the processor-representable number nearest
|
10220 |
|
|
to `X' in the direction indicated by the sign of `S'.
|
10221 |
|
|
|
10222 |
|
|
_Standard_:
|
10223 |
|
|
Fortran 95 and later
|
10224 |
|
|
|
10225 |
|
|
_Class_:
|
10226 |
|
|
Elemental function
|
10227 |
|
|
|
10228 |
|
|
_Syntax_:
|
10229 |
|
|
`RESULT = NEAREST(X, S)'
|
10230 |
|
|
|
10231 |
|
|
_Arguments_:
|
10232 |
|
|
X Shall be of type `REAL'.
|
10233 |
|
|
S (Optional) shall be of type `REAL' and not
|
10234 |
|
|
equal to zero.
|
10235 |
|
|
|
10236 |
|
|
_Return value_:
|
10237 |
|
|
The return value is of the same type as `X'. If `S' is positive,
|
10238 |
|
|
`NEAREST' returns the processor-representable number greater than
|
10239 |
|
|
`X' and nearest to it. If `S' is negative, `NEAREST' returns the
|
10240 |
|
|
processor-representable number smaller than `X' and nearest to it.
|
10241 |
|
|
|
10242 |
|
|
_Example_:
|
10243 |
|
|
program test_nearest
|
10244 |
|
|
real :: x, y
|
10245 |
|
|
x = nearest(42.0, 1.0)
|
10246 |
|
|
y = nearest(42.0, -1.0)
|
10247 |
|
|
write (*,"(3(G20.15))") x, y, x - y
|
10248 |
|
|
end program test_nearest
|
10249 |
|
|
|
10250 |
|
|
|
10251 |
|
|
File: gfortran.info, Node: NEW_LINE, Next: NINT, Prev: NEAREST, Up: Intrinsic Procedures
|
10252 |
|
|
|
10253 |
|
|
8.163 `NEW_LINE' -- New line character
|
10254 |
|
|
======================================
|
10255 |
|
|
|
10256 |
|
|
_Description_:
|
10257 |
|
|
`NEW_LINE(C)' returns the new-line character.
|
10258 |
|
|
|
10259 |
|
|
_Standard_:
|
10260 |
|
|
Fortran 2003 and later
|
10261 |
|
|
|
10262 |
|
|
_Class_:
|
10263 |
|
|
Inquiry function
|
10264 |
|
|
|
10265 |
|
|
_Syntax_:
|
10266 |
|
|
`RESULT = NEW_LINE(C)'
|
10267 |
|
|
|
10268 |
|
|
_Arguments_:
|
10269 |
|
|
C The argument shall be a scalar or array of the
|
10270 |
|
|
type `CHARACTER'.
|
10271 |
|
|
|
10272 |
|
|
_Return value_:
|
10273 |
|
|
Returns a CHARACTER scalar of length one with the new-line
|
10274 |
|
|
character of the same kind as parameter C.
|
10275 |
|
|
|
10276 |
|
|
_Example_:
|
10277 |
|
|
program newline
|
10278 |
|
|
implicit none
|
10279 |
|
|
write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.'
|
10280 |
|
|
end program newline
|
10281 |
|
|
|
10282 |
|
|
|
10283 |
|
|
File: gfortran.info, Node: NINT, Next: NOT, Prev: NEW_LINE, Up: Intrinsic Procedures
|
10284 |
|
|
|
10285 |
|
|
8.164 `NINT' -- Nearest whole number
|
10286 |
|
|
====================================
|
10287 |
|
|
|
10288 |
|
|
_Description_:
|
10289 |
|
|
`NINT(A)' rounds its argument to the nearest whole number.
|
10290 |
|
|
|
10291 |
|
|
_Standard_:
|
10292 |
|
|
Fortran 77 and later, with KIND argument Fortran 90 and later
|
10293 |
|
|
|
10294 |
|
|
_Class_:
|
10295 |
|
|
Elemental function
|
10296 |
|
|
|
10297 |
|
|
_Syntax_:
|
10298 |
|
|
`RESULT = NINT(A [, KIND])'
|
10299 |
|
|
|
10300 |
|
|
_Arguments_:
|
10301 |
|
|
A The type of the argument shall be `REAL'.
|
10302 |
|
|
KIND (Optional) An `INTEGER' initialization
|
10303 |
|
|
expression indicating the kind parameter of
|
10304 |
|
|
the result.
|
10305 |
|
|
|
10306 |
|
|
_Return value_:
|
10307 |
|
|
Returns A with the fractional portion of its magnitude eliminated
|
10308 |
|
|
by rounding to the nearest whole number and with its sign
|
10309 |
|
|
preserved, converted to an `INTEGER' of the default kind.
|
10310 |
|
|
|
10311 |
|
|
_Example_:
|
10312 |
|
|
program test_nint
|
10313 |
|
|
real(4) x4
|
10314 |
|
|
real(8) x8
|
10315 |
|
|
x4 = 1.234E0_4
|
10316 |
|
|
x8 = 4.321_8
|
10317 |
|
|
print *, nint(x4), idnint(x8)
|
10318 |
|
|
end program test_nint
|
10319 |
|
|
|
10320 |
|
|
_Specific names_:
|
10321 |
|
|
Name Argument Standard
|
10322 |
|
|
`IDNINT(X)' `REAL(8)' Fortran 95 and
|
10323 |
|
|
later
|
10324 |
|
|
|
10325 |
|
|
_See also_:
|
10326 |
|
|
*note CEILING::, *note FLOOR::
|
10327 |
|
|
|
10328 |
|
|
|
10329 |
|
|
|
10330 |
|
|
File: gfortran.info, Node: NOT, Next: NULL, Prev: NINT, Up: Intrinsic Procedures
|
10331 |
|
|
|
10332 |
|
|
8.165 `NOT' -- Logical negation
|
10333 |
|
|
===============================
|
10334 |
|
|
|
10335 |
|
|
_Description_:
|
10336 |
|
|
`NOT' returns the bitwise boolean inverse of I.
|
10337 |
|
|
|
10338 |
|
|
_Standard_:
|
10339 |
|
|
Fortran 95 and later
|
10340 |
|
|
|
10341 |
|
|
_Class_:
|
10342 |
|
|
Elemental function
|
10343 |
|
|
|
10344 |
|
|
_Syntax_:
|
10345 |
|
|
`RESULT = NOT(I)'
|
10346 |
|
|
|
10347 |
|
|
_Arguments_:
|
10348 |
|
|
I The type shall be `INTEGER'.
|
10349 |
|
|
|
10350 |
|
|
_Return value_:
|
10351 |
|
|
The return type is `INTEGER', of the same kind as the argument.
|
10352 |
|
|
|
10353 |
|
|
_See also_:
|
10354 |
|
|
*note IAND::, *note IEOR::, *note IOR::, *note IBITS::, *note
|
10355 |
|
|
IBSET::, *note IBCLR::
|
10356 |
|
|
|
10357 |
|
|
|
10358 |
|
|
|
10359 |
|
|
File: gfortran.info, Node: NULL, Next: OR, Prev: NOT, Up: Intrinsic Procedures
|
10360 |
|
|
|
10361 |
|
|
8.166 `NULL' -- Function that returns an disassociated pointer
|
10362 |
|
|
==============================================================
|
10363 |
|
|
|
10364 |
|
|
_Description_:
|
10365 |
|
|
Returns a disassociated pointer.
|
10366 |
|
|
|
10367 |
|
|
If MOLD is present, a dissassociated pointer of the same type is
|
10368 |
|
|
returned, otherwise the type is determined by context.
|
10369 |
|
|
|
10370 |
|
|
In Fortran 95, MOLD is optional. Please note that Fortran 2003
|
10371 |
|
|
includes cases where it is required.
|
10372 |
|
|
|
10373 |
|
|
_Standard_:
|
10374 |
|
|
Fortran 95 and later
|
10375 |
|
|
|
10376 |
|
|
_Class_:
|
10377 |
|
|
Transformational function
|
10378 |
|
|
|
10379 |
|
|
_Syntax_:
|
10380 |
|
|
`PTR => NULL([MOLD])'
|
10381 |
|
|
|
10382 |
|
|
_Arguments_:
|
10383 |
|
|
MOLD (Optional) shall be a pointer of any
|
10384 |
|
|
association status and of any type.
|
10385 |
|
|
|
10386 |
|
|
_Return value_:
|
10387 |
|
|
A disassociated pointer.
|
10388 |
|
|
|
10389 |
|
|
_Example_:
|
10390 |
|
|
REAL, POINTER, DIMENSION(:) :: VEC => NULL ()
|
10391 |
|
|
|
10392 |
|
|
_See also_:
|
10393 |
|
|
*note ASSOCIATED::
|
10394 |
|
|
|
10395 |
|
|
|
10396 |
|
|
File: gfortran.info, Node: OR, Next: PACK, Prev: NULL, Up: Intrinsic Procedures
|
10397 |
|
|
|
10398 |
|
|
8.167 `OR' -- Bitwise logical OR
|
10399 |
|
|
================================
|
10400 |
|
|
|
10401 |
|
|
_Description_:
|
10402 |
|
|
Bitwise logical `OR'.
|
10403 |
|
|
|
10404 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
10405 |
|
|
GNU Fortran 77. For integer arguments, programmers should consider
|
10406 |
|
|
the use of the *note IOR:: intrinsic defined by the Fortran
|
10407 |
|
|
standard.
|
10408 |
|
|
|
10409 |
|
|
_Standard_:
|
10410 |
|
|
GNU extension
|
10411 |
|
|
|
10412 |
|
|
_Class_:
|
10413 |
|
|
Function
|
10414 |
|
|
|
10415 |
|
|
_Syntax_:
|
10416 |
|
|
`RESULT = OR(I, J)'
|
10417 |
|
|
|
10418 |
|
|
_Arguments_:
|
10419 |
|
|
I The type shall be either a scalar `INTEGER'
|
10420 |
|
|
type or a scalar `LOGICAL' type.
|
10421 |
|
|
J The type shall be the same as the type of J.
|
10422 |
|
|
|
10423 |
|
|
_Return value_:
|
10424 |
|
|
The return type is either a scalar `INTEGER' or a scalar
|
10425 |
|
|
`LOGICAL'. If the kind type parameters differ, then the smaller
|
10426 |
|
|
kind type is implicitly converted to larger kind, and the return
|
10427 |
|
|
has the larger kind.
|
10428 |
|
|
|
10429 |
|
|
_Example_:
|
10430 |
|
|
PROGRAM test_or
|
10431 |
|
|
LOGICAL :: T = .TRUE., F = .FALSE.
|
10432 |
|
|
INTEGER :: a, b
|
10433 |
|
|
DATA a / Z'F' /, b / Z'3' /
|
10434 |
|
|
|
10435 |
|
|
WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F)
|
10436 |
|
|
WRITE (*,*) OR(a, b)
|
10437 |
|
|
END PROGRAM
|
10438 |
|
|
|
10439 |
|
|
_See also_:
|
10440 |
|
|
Fortran 95 elemental function: *note IOR::
|
10441 |
|
|
|
10442 |
|
|
|
10443 |
|
|
File: gfortran.info, Node: PACK, Next: PERROR, Prev: OR, Up: Intrinsic Procedures
|
10444 |
|
|
|
10445 |
|
|
8.168 `PACK' -- Pack an array into an array of rank one
|
10446 |
|
|
=======================================================
|
10447 |
|
|
|
10448 |
|
|
_Description_:
|
10449 |
|
|
Stores the elements of ARRAY in an array of rank one.
|
10450 |
|
|
|
10451 |
|
|
The beginning of the resulting array is made up of elements whose
|
10452 |
|
|
MASK equals `TRUE'. Afterwards, positions are filled with elements
|
10453 |
|
|
taken from VECTOR.
|
10454 |
|
|
|
10455 |
|
|
_Standard_:
|
10456 |
|
|
Fortran 95 and later
|
10457 |
|
|
|
10458 |
|
|
_Class_:
|
10459 |
|
|
Transformational function
|
10460 |
|
|
|
10461 |
|
|
_Syntax_:
|
10462 |
|
|
`RESULT = PACK(ARRAY, MASK[,VECTOR]'
|
10463 |
|
|
|
10464 |
|
|
_Arguments_:
|
10465 |
|
|
ARRAY Shall be an array of any type.
|
10466 |
|
|
MASK Shall be an array of type `LOGICAL' and of the
|
10467 |
|
|
same size as ARRAY. Alternatively, it may be a
|
10468 |
|
|
`LOGICAL' scalar.
|
10469 |
|
|
VECTOR (Optional) shall be an array of the same type
|
10470 |
|
|
as ARRAY and of rank one. If present, the
|
10471 |
|
|
number of elements in VECTOR shall be equal to
|
10472 |
|
|
or greater than the number of true elements in
|
10473 |
|
|
MASK. If MASK is scalar, the number of
|
10474 |
|
|
elements in VECTOR shall be equal to or
|
10475 |
|
|
greater than the number of elements in ARRAY.
|
10476 |
|
|
|
10477 |
|
|
_Return value_:
|
10478 |
|
|
The result is an array of rank one and the same type as that of
|
10479 |
|
|
ARRAY. If VECTOR is present, the result size is that of VECTOR,
|
10480 |
|
|
the number of `TRUE' values in MASK otherwise.
|
10481 |
|
|
|
10482 |
|
|
_Example_:
|
10483 |
|
|
Gathering nonzero elements from an array:
|
10484 |
|
|
PROGRAM test_pack_1
|
10485 |
|
|
INTEGER :: m(6)
|
10486 |
|
|
m = (/ 1, 0, 0, 0, 5, 0 /)
|
10487 |
|
|
WRITE(*, FMT="(6(I0, ' '))") pack(m, m /= 0) ! "1 5"
|
10488 |
|
|
END PROGRAM
|
10489 |
|
|
|
10490 |
|
|
Gathering nonzero elements from an array and appending elements
|
10491 |
|
|
from VECTOR:
|
10492 |
|
|
PROGRAM test_pack_2
|
10493 |
|
|
INTEGER :: m(4)
|
10494 |
|
|
m = (/ 1, 0, 0, 2 /)
|
10495 |
|
|
WRITE(*, FMT="(4(I0, ' '))") pack(m, m /= 0, (/ 0, 0, 3, 4 /)) ! "1 2 3 4"
|
10496 |
|
|
END PROGRAM
|
10497 |
|
|
|
10498 |
|
|
_See also_:
|
10499 |
|
|
*note UNPACK::
|
10500 |
|
|
|
10501 |
|
|
|
10502 |
|
|
File: gfortran.info, Node: PERROR, Next: PRECISION, Prev: PACK, Up: Intrinsic Procedures
|
10503 |
|
|
|
10504 |
|
|
8.169 `PERROR' -- Print system error message
|
10505 |
|
|
============================================
|
10506 |
|
|
|
10507 |
|
|
_Description_:
|
10508 |
|
|
Prints (on the C `stderr' stream) a newline-terminated error
|
10509 |
|
|
message corresponding to the last system error. This is prefixed by
|
10510 |
|
|
STRING, a colon and a space. See `perror(3)'.
|
10511 |
|
|
|
10512 |
|
|
_Standard_:
|
10513 |
|
|
GNU extension
|
10514 |
|
|
|
10515 |
|
|
_Class_:
|
10516 |
|
|
Subroutine
|
10517 |
|
|
|
10518 |
|
|
_Syntax_:
|
10519 |
|
|
`CALL PERROR(STRING)'
|
10520 |
|
|
|
10521 |
|
|
_Arguments_:
|
10522 |
|
|
STRING A scalar of type `CHARACTER' and of the
|
10523 |
|
|
default kind.
|
10524 |
|
|
|
10525 |
|
|
_See also_:
|
10526 |
|
|
*note IERRNO::
|
10527 |
|
|
|
10528 |
|
|
|
10529 |
|
|
File: gfortran.info, Node: PRECISION, Next: PRESENT, Prev: PERROR, Up: Intrinsic Procedures
|
10530 |
|
|
|
10531 |
|
|
8.170 `PRECISION' -- Decimal precision of a real kind
|
10532 |
|
|
=====================================================
|
10533 |
|
|
|
10534 |
|
|
_Description_:
|
10535 |
|
|
`PRECISION(X)' returns the decimal precision in the model of the
|
10536 |
|
|
type of `X'.
|
10537 |
|
|
|
10538 |
|
|
_Standard_:
|
10539 |
|
|
Fortran 95 and later
|
10540 |
|
|
|
10541 |
|
|
_Class_:
|
10542 |
|
|
Inquiry function
|
10543 |
|
|
|
10544 |
|
|
_Syntax_:
|
10545 |
|
|
`RESULT = PRECISION(X)'
|
10546 |
|
|
|
10547 |
|
|
_Arguments_:
|
10548 |
|
|
X Shall be of type `REAL' or `COMPLEX'.
|
10549 |
|
|
|
10550 |
|
|
_Return value_:
|
10551 |
|
|
The return value is of type `INTEGER' and of the default integer
|
10552 |
|
|
kind.
|
10553 |
|
|
|
10554 |
|
|
_Example_:
|
10555 |
|
|
program prec_and_range
|
10556 |
|
|
real(kind=4) :: x(2)
|
10557 |
|
|
complex(kind=8) :: y
|
10558 |
|
|
|
10559 |
|
|
print *, precision(x), range(x)
|
10560 |
|
|
print *, precision(y), range(y)
|
10561 |
|
|
end program prec_and_range
|
10562 |
|
|
|
10563 |
|
|
|
10564 |
|
|
File: gfortran.info, Node: PRESENT, Next: PRODUCT, Prev: PRECISION, Up: Intrinsic Procedures
|
10565 |
|
|
|
10566 |
|
|
8.171 `PRESENT' -- Determine whether an optional dummy argument is specified
|
10567 |
|
|
============================================================================
|
10568 |
|
|
|
10569 |
|
|
_Description_:
|
10570 |
|
|
Determines whether an optional dummy argument is present.
|
10571 |
|
|
|
10572 |
|
|
_Standard_:
|
10573 |
|
|
Fortran 95 and later
|
10574 |
|
|
|
10575 |
|
|
_Class_:
|
10576 |
|
|
Inquiry function
|
10577 |
|
|
|
10578 |
|
|
_Syntax_:
|
10579 |
|
|
`RESULT = PRESENT(A)'
|
10580 |
|
|
|
10581 |
|
|
_Arguments_:
|
10582 |
|
|
A May be of any type and may be a pointer,
|
10583 |
|
|
scalar or array value, or a dummy procedure.
|
10584 |
|
|
It shall be the name of an optional dummy
|
10585 |
|
|
argument accessible within the current
|
10586 |
|
|
subroutine or function.
|
10587 |
|
|
|
10588 |
|
|
_Return value_:
|
10589 |
|
|
Returns either `TRUE' if the optional argument A is present, or
|
10590 |
|
|
`FALSE' otherwise.
|
10591 |
|
|
|
10592 |
|
|
_Example_:
|
10593 |
|
|
PROGRAM test_present
|
10594 |
|
|
WRITE(*,*) f(), f(42) ! "F T"
|
10595 |
|
|
CONTAINS
|
10596 |
|
|
LOGICAL FUNCTION f(x)
|
10597 |
|
|
INTEGER, INTENT(IN), OPTIONAL :: x
|
10598 |
|
|
f = PRESENT(x)
|
10599 |
|
|
END FUNCTION
|
10600 |
|
|
END PROGRAM
|
10601 |
|
|
|
10602 |
|
|
|
10603 |
|
|
File: gfortran.info, Node: PRODUCT, Next: RADIX, Prev: PRESENT, Up: Intrinsic Procedures
|
10604 |
|
|
|
10605 |
|
|
8.172 `PRODUCT' -- Product of array elements
|
10606 |
|
|
============================================
|
10607 |
|
|
|
10608 |
|
|
_Description_:
|
10609 |
|
|
Multiplies the elements of ARRAY along dimension DIM if the
|
10610 |
|
|
corresponding element in MASK is `TRUE'.
|
10611 |
|
|
|
10612 |
|
|
_Standard_:
|
10613 |
|
|
Fortran 95 and later
|
10614 |
|
|
|
10615 |
|
|
_Class_:
|
10616 |
|
|
Transformational function
|
10617 |
|
|
|
10618 |
|
|
_Syntax_:
|
10619 |
|
|
`RESULT = PRODUCT(ARRAY[, MASK])'
|
10620 |
|
|
`RESULT = PRODUCT(ARRAY, DIM[, MASK])'
|
10621 |
|
|
|
10622 |
|
|
_Arguments_:
|
10623 |
|
|
ARRAY Shall be an array of type `INTEGER', `REAL' or
|
10624 |
|
|
`COMPLEX'.
|
10625 |
|
|
DIM (Optional) shall be a scalar of type `INTEGER'
|
10626 |
|
|
with a value in the range from 1 to n, where n
|
10627 |
|
|
equals the rank of ARRAY.
|
10628 |
|
|
MASK (Optional) shall be of type `LOGICAL' and
|
10629 |
|
|
either be a scalar or an array of the same
|
10630 |
|
|
shape as ARRAY.
|
10631 |
|
|
|
10632 |
|
|
_Return value_:
|
10633 |
|
|
The result is of the same type as ARRAY.
|
10634 |
|
|
|
10635 |
|
|
If DIM is absent, a scalar with the product of all elements in
|
10636 |
|
|
ARRAY is returned. Otherwise, an array of rank n-1, where n equals
|
10637 |
|
|
the rank of ARRAY, and a shape similar to that of ARRAY with
|
10638 |
|
|
dimension DIM dropped is returned.
|
10639 |
|
|
|
10640 |
|
|
_Example_:
|
10641 |
|
|
PROGRAM test_product
|
10642 |
|
|
INTEGER :: x(5) = (/ 1, 2, 3, 4 ,5 /)
|
10643 |
|
|
print *, PRODUCT(x) ! all elements, product = 120
|
10644 |
|
|
print *, PRODUCT(x, MASK=MOD(x, 2)==1) ! odd elements, product = 15
|
10645 |
|
|
END PROGRAM
|
10646 |
|
|
|
10647 |
|
|
_See also_:
|
10648 |
|
|
*note SUM::
|
10649 |
|
|
|
10650 |
|
|
|
10651 |
|
|
File: gfortran.info, Node: RADIX, Next: RANDOM_NUMBER, Prev: PRODUCT, Up: Intrinsic Procedures
|
10652 |
|
|
|
10653 |
|
|
8.173 `RADIX' -- Base of a model number
|
10654 |
|
|
=======================================
|
10655 |
|
|
|
10656 |
|
|
_Description_:
|
10657 |
|
|
`RADIX(X)' returns the base of the model representing the entity X.
|
10658 |
|
|
|
10659 |
|
|
_Standard_:
|
10660 |
|
|
Fortran 95 and later
|
10661 |
|
|
|
10662 |
|
|
_Class_:
|
10663 |
|
|
Inquiry function
|
10664 |
|
|
|
10665 |
|
|
_Syntax_:
|
10666 |
|
|
`RESULT = RADIX(X)'
|
10667 |
|
|
|
10668 |
|
|
_Arguments_:
|
10669 |
|
|
X Shall be of type `INTEGER' or `REAL'
|
10670 |
|
|
|
10671 |
|
|
_Return value_:
|
10672 |
|
|
The return value is a scalar of type `INTEGER' and of the default
|
10673 |
|
|
integer kind.
|
10674 |
|
|
|
10675 |
|
|
_Example_:
|
10676 |
|
|
program test_radix
|
10677 |
|
|
print *, "The radix for the default integer kind is", radix(0)
|
10678 |
|
|
print *, "The radix for the default real kind is", radix(0.0)
|
10679 |
|
|
end program test_radix
|
10680 |
|
|
|
10681 |
|
|
|
10682 |
|
|
|
10683 |
|
|
File: gfortran.info, Node: RAN, Next: REAL, Prev: RANGE, Up: Intrinsic Procedures
|
10684 |
|
|
|
10685 |
|
|
8.174 `RAN' -- Real pseudo-random number
|
10686 |
|
|
========================================
|
10687 |
|
|
|
10688 |
|
|
_Description_:
|
10689 |
|
|
For compatibility with HP FORTRAN 77/iX, the `RAN' intrinsic is
|
10690 |
|
|
provided as an alias for `RAND'. See *note RAND:: for complete
|
10691 |
|
|
documentation.
|
10692 |
|
|
|
10693 |
|
|
_Standard_:
|
10694 |
|
|
GNU extension
|
10695 |
|
|
|
10696 |
|
|
_Class_:
|
10697 |
|
|
Function
|
10698 |
|
|
|
10699 |
|
|
_See also_:
|
10700 |
|
|
*note RAND::, *note RANDOM_NUMBER::
|
10701 |
|
|
|
10702 |
|
|
|
10703 |
|
|
File: gfortran.info, Node: RAND, Next: RANGE, Prev: RANDOM_SEED, Up: Intrinsic Procedures
|
10704 |
|
|
|
10705 |
|
|
8.175 `RAND' -- Real pseudo-random number
|
10706 |
|
|
=========================================
|
10707 |
|
|
|
10708 |
|
|
_Description_:
|
10709 |
|
|
`RAND(FLAG)' returns a pseudo-random number from a uniform
|
10710 |
|
|
distribution between 0 and 1. If FLAG is 0, the next number in the
|
10711 |
|
|
current sequence is returned; if FLAG is 1, the generator is
|
10712 |
|
|
restarted by `CALL SRAND(0)'; if FLAG has any other value, it is
|
10713 |
|
|
used as a new seed with `SRAND'.
|
10714 |
|
|
|
10715 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
10716 |
|
|
GNU Fortran 77. It implements a simple modulo generator as provided
|
10717 |
|
|
by `g77'. For new code, one should consider the use of *note
|
10718 |
|
|
RANDOM_NUMBER:: as it implements a superior algorithm.
|
10719 |
|
|
|
10720 |
|
|
_Standard_:
|
10721 |
|
|
GNU extension
|
10722 |
|
|
|
10723 |
|
|
_Class_:
|
10724 |
|
|
Function
|
10725 |
|
|
|
10726 |
|
|
_Syntax_:
|
10727 |
|
|
`RESULT = RAND(I)'
|
10728 |
|
|
|
10729 |
|
|
_Arguments_:
|
10730 |
|
|
I Shall be a scalar `INTEGER' of kind 4.
|
10731 |
|
|
|
10732 |
|
|
_Return value_:
|
10733 |
|
|
The return value is of `REAL' type and the default kind.
|
10734 |
|
|
|
10735 |
|
|
_Example_:
|
10736 |
|
|
program test_rand
|
10737 |
|
|
integer,parameter :: seed = 86456
|
10738 |
|
|
|
10739 |
|
|
call srand(seed)
|
10740 |
|
|
print *, rand(), rand(), rand(), rand()
|
10741 |
|
|
print *, rand(seed), rand(), rand(), rand()
|
10742 |
|
|
end program test_rand
|
10743 |
|
|
|
10744 |
|
|
_See also_:
|
10745 |
|
|
*note SRAND::, *note RANDOM_NUMBER::
|
10746 |
|
|
|
10747 |
|
|
|
10748 |
|
|
|
10749 |
|
|
File: gfortran.info, Node: RANDOM_NUMBER, Next: RANDOM_SEED, Prev: RADIX, Up: Intrinsic Procedures
|
10750 |
|
|
|
10751 |
|
|
8.176 `RANDOM_NUMBER' -- Pseudo-random number
|
10752 |
|
|
=============================================
|
10753 |
|
|
|
10754 |
|
|
_Description_:
|
10755 |
|
|
Returns a single pseudorandom number or an array of pseudorandom
|
10756 |
|
|
numbers from the uniform distribution over the range 0 \leq x < 1.
|
10757 |
|
|
|
10758 |
|
|
The runtime-library implements George Marsaglia's KISS (Keep It
|
10759 |
|
|
Simple Stupid) random number generator (RNG). This RNG combines:
|
10760 |
|
|
1. The congruential generator x(n) = 69069 \cdot x(n-1) +
|
10761 |
|
|
1327217885 with a period of 2^32,
|
10762 |
|
|
|
10763 |
|
|
2. A 3-shift shift-register generator with a period of 2^32 - 1,
|
10764 |
|
|
|
10765 |
|
|
3. Two 16-bit multiply-with-carry generators with a period of
|
10766 |
|
|
597273182964842497 > 2^59.
|
10767 |
|
|
The overall period exceeds 2^123.
|
10768 |
|
|
|
10769 |
|
|
Please note, this RNG is thread safe if used within OpenMP
|
10770 |
|
|
directives, i.e., its state will be consistent while called from
|
10771 |
|
|
multiple threads. However, the KISS generator does not create
|
10772 |
|
|
random numbers in parallel from multiple sources, but in sequence
|
10773 |
|
|
from a single source. If an OpenMP-enabled application heavily
|
10774 |
|
|
relies on random numbers, one should consider employing a
|
10775 |
|
|
dedicated parallel random number generator instead.
|
10776 |
|
|
|
10777 |
|
|
_Standard_:
|
10778 |
|
|
Fortran 95 and later
|
10779 |
|
|
|
10780 |
|
|
_Class_:
|
10781 |
|
|
Subroutine
|
10782 |
|
|
|
10783 |
|
|
_Syntax_:
|
10784 |
|
|
`RANDOM_NUMBER(HARVEST)'
|
10785 |
|
|
|
10786 |
|
|
_Arguments_:
|
10787 |
|
|
HARVEST Shall be a scalar or an array of type `REAL'.
|
10788 |
|
|
|
10789 |
|
|
_Example_:
|
10790 |
|
|
program test_random_number
|
10791 |
|
|
REAL :: r(5,5)
|
10792 |
|
|
CALL init_random_seed() ! see example of RANDOM_SEED
|
10793 |
|
|
CALL RANDOM_NUMBER(r)
|
10794 |
|
|
end program
|
10795 |
|
|
|
10796 |
|
|
_See also_:
|
10797 |
|
|
*note RANDOM_SEED::
|
10798 |
|
|
|
10799 |
|
|
|
10800 |
|
|
File: gfortran.info, Node: RANDOM_SEED, Next: RAND, Prev: RANDOM_NUMBER, Up: Intrinsic Procedures
|
10801 |
|
|
|
10802 |
|
|
8.177 `RANDOM_SEED' -- Initialize a pseudo-random number sequence
|
10803 |
|
|
=================================================================
|
10804 |
|
|
|
10805 |
|
|
_Description_:
|
10806 |
|
|
Restarts or queries the state of the pseudorandom number generator
|
10807 |
|
|
used by `RANDOM_NUMBER'.
|
10808 |
|
|
|
10809 |
|
|
If `RANDOM_SEED' is called without arguments, it is initialized to
|
10810 |
|
|
a default state. The example below shows how to initialize the
|
10811 |
|
|
random seed based on the system's time.
|
10812 |
|
|
|
10813 |
|
|
_Standard_:
|
10814 |
|
|
Fortran 95 and later
|
10815 |
|
|
|
10816 |
|
|
_Class_:
|
10817 |
|
|
Subroutine
|
10818 |
|
|
|
10819 |
|
|
_Syntax_:
|
10820 |
|
|
`CALL RANDOM_SEED([SIZE, PUT, GET])'
|
10821 |
|
|
|
10822 |
|
|
_Arguments_:
|
10823 |
|
|
SIZE (Optional) Shall be a scalar and of type
|
10824 |
|
|
default `INTEGER', with `INTENT(OUT)'. It
|
10825 |
|
|
specifies the minimum size of the arrays used
|
10826 |
|
|
with the PUT and GET arguments.
|
10827 |
|
|
PUT (Optional) Shall be an array of type default
|
10828 |
|
|
`INTEGER' and rank one. It is `INTENT(IN)' and
|
10829 |
|
|
the size of the array must be larger than or
|
10830 |
|
|
equal to the number returned by the SIZE
|
10831 |
|
|
argument.
|
10832 |
|
|
GET (Optional) Shall be an array of type default
|
10833 |
|
|
`INTEGER' and rank one. It is `INTENT(OUT)'
|
10834 |
|
|
and the size of the array must be larger than
|
10835 |
|
|
or equal to the number returned by the SIZE
|
10836 |
|
|
argument.
|
10837 |
|
|
|
10838 |
|
|
_Example_:
|
10839 |
|
|
SUBROUTINE init_random_seed()
|
10840 |
|
|
INTEGER :: i, n, clock
|
10841 |
|
|
INTEGER, DIMENSION(:), ALLOCATABLE :: seed
|
10842 |
|
|
|
10843 |
|
|
CALL RANDOM_SEED(size = n)
|
10844 |
|
|
ALLOCATE(seed(n))
|
10845 |
|
|
|
10846 |
|
|
CALL SYSTEM_CLOCK(COUNT=clock)
|
10847 |
|
|
|
10848 |
|
|
seed = clock + 37 * (/ (i - 1, i = 1, n) /)
|
10849 |
|
|
CALL RANDOM_SEED(PUT = seed)
|
10850 |
|
|
|
10851 |
|
|
DEALLOCATE(seed)
|
10852 |
|
|
END SUBROUTINE
|
10853 |
|
|
|
10854 |
|
|
_See also_:
|
10855 |
|
|
*note RANDOM_NUMBER::
|
10856 |
|
|
|
10857 |
|
|
|
10858 |
|
|
File: gfortran.info, Node: RANGE, Next: RAN, Prev: RAND, Up: Intrinsic Procedures
|
10859 |
|
|
|
10860 |
|
|
8.178 `RANGE' -- Decimal exponent range
|
10861 |
|
|
=======================================
|
10862 |
|
|
|
10863 |
|
|
_Description_:
|
10864 |
|
|
`RANGE(X)' returns the decimal exponent range in the model of the
|
10865 |
|
|
type of `X'.
|
10866 |
|
|
|
10867 |
|
|
_Standard_:
|
10868 |
|
|
Fortran 95 and later
|
10869 |
|
|
|
10870 |
|
|
_Class_:
|
10871 |
|
|
Inquiry function
|
10872 |
|
|
|
10873 |
|
|
_Syntax_:
|
10874 |
|
|
`RESULT = RANGE(X)'
|
10875 |
|
|
|
10876 |
|
|
_Arguments_:
|
10877 |
|
|
X Shall be of type `INTEGER', `REAL' or
|
10878 |
|
|
`COMPLEX'.
|
10879 |
|
|
|
10880 |
|
|
_Return value_:
|
10881 |
|
|
The return value is of type `INTEGER' and of the default integer
|
10882 |
|
|
kind.
|
10883 |
|
|
|
10884 |
|
|
_Example_:
|
10885 |
|
|
See `PRECISION' for an example.
|
10886 |
|
|
|
10887 |
|
|
|
10888 |
|
|
File: gfortran.info, Node: REAL, Next: RENAME, Prev: RAN, Up: Intrinsic Procedures
|
10889 |
|
|
|
10890 |
|
|
8.179 `REAL' -- Convert to real type
|
10891 |
|
|
====================================
|
10892 |
|
|
|
10893 |
|
|
_Description_:
|
10894 |
|
|
`REAL(A [, KIND])' converts its argument A to a real type. The
|
10895 |
|
|
`REALPART' function is provided for compatibility with `g77', and
|
10896 |
|
|
its use is strongly discouraged.
|
10897 |
|
|
|
10898 |
|
|
_Standard_:
|
10899 |
|
|
Fortran 77 and later
|
10900 |
|
|
|
10901 |
|
|
_Class_:
|
10902 |
|
|
Elemental function
|
10903 |
|
|
|
10904 |
|
|
_Syntax_:
|
10905 |
|
|
`RESULT = REAL(A [, KIND])'
|
10906 |
|
|
`RESULT = REALPART(Z)'
|
10907 |
|
|
|
10908 |
|
|
_Arguments_:
|
10909 |
|
|
A Shall be `INTEGER', `REAL', or `COMPLEX'.
|
10910 |
|
|
KIND (Optional) An `INTEGER' initialization
|
10911 |
|
|
expression indicating the kind parameter of
|
10912 |
|
|
the result.
|
10913 |
|
|
|
10914 |
|
|
_Return value_:
|
10915 |
|
|
These functions return a `REAL' variable or array under the
|
10916 |
|
|
following rules:
|
10917 |
|
|
|
10918 |
|
|
(A)
|
10919 |
|
|
`REAL(A)' is converted to a default real type if A is an
|
10920 |
|
|
integer or real variable.
|
10921 |
|
|
|
10922 |
|
|
(B)
|
10923 |
|
|
`REAL(A)' is converted to a real type with the kind type
|
10924 |
|
|
parameter of A if A is a complex variable.
|
10925 |
|
|
|
10926 |
|
|
(C)
|
10927 |
|
|
`REAL(A, KIND)' is converted to a real type with kind type
|
10928 |
|
|
parameter KIND if A is a complex, integer, or real variable.
|
10929 |
|
|
|
10930 |
|
|
_Example_:
|
10931 |
|
|
program test_real
|
10932 |
|
|
complex :: x = (1.0, 2.0)
|
10933 |
|
|
print *, real(x), real(x,8), realpart(x)
|
10934 |
|
|
end program test_real
|
10935 |
|
|
|
10936 |
|
|
_See also_:
|
10937 |
|
|
*note DBLE::, *note DFLOAT::, *note FLOAT::
|
10938 |
|
|
|
10939 |
|
|
|
10940 |
|
|
|
10941 |
|
|
File: gfortran.info, Node: RENAME, Next: REPEAT, Prev: REAL, Up: Intrinsic Procedures
|
10942 |
|
|
|
10943 |
|
|
8.180 `RENAME' -- Rename a file
|
10944 |
|
|
===============================
|
10945 |
|
|
|
10946 |
|
|
_Description_:
|
10947 |
|
|
Renames a file from file PATH1 to PATH2. A null character
|
10948 |
|
|
(`CHAR(0)') can be used to mark the end of the names in PATH1 and
|
10949 |
|
|
PATH2; otherwise, trailing blanks in the file names are ignored.
|
10950 |
|
|
If the STATUS argument is supplied, it contains 0 on success or a
|
10951 |
|
|
nonzero error code upon return; see `rename(2)'.
|
10952 |
|
|
|
10953 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
10954 |
|
|
however, only one form can be used in any given program unit.
|
10955 |
|
|
|
10956 |
|
|
_Standard_:
|
10957 |
|
|
GNU extension
|
10958 |
|
|
|
10959 |
|
|
_Class_:
|
10960 |
|
|
Subroutine, function
|
10961 |
|
|
|
10962 |
|
|
_Syntax_:
|
10963 |
|
|
`CALL RENAME(PATH1, PATH2 [, STATUS])'
|
10964 |
|
|
`STATUS = RENAME(PATH1, PATH2)'
|
10965 |
|
|
|
10966 |
|
|
_Arguments_:
|
10967 |
|
|
PATH1 Shall be of default `CHARACTER' type.
|
10968 |
|
|
PATH2 Shall be of default `CHARACTER' type.
|
10969 |
|
|
STATUS (Optional) Shall be of default `INTEGER' type.
|
10970 |
|
|
|
10971 |
|
|
_See also_:
|
10972 |
|
|
*note LINK::
|
10973 |
|
|
|
10974 |
|
|
|
10975 |
|
|
|
10976 |
|
|
File: gfortran.info, Node: REPEAT, Next: RESHAPE, Prev: RENAME, Up: Intrinsic Procedures
|
10977 |
|
|
|
10978 |
|
|
8.181 `REPEAT' -- Repeated string concatenation
|
10979 |
|
|
===============================================
|
10980 |
|
|
|
10981 |
|
|
_Description_:
|
10982 |
|
|
Concatenates NCOPIES copies of a string.
|
10983 |
|
|
|
10984 |
|
|
_Standard_:
|
10985 |
|
|
Fortran 95 and later
|
10986 |
|
|
|
10987 |
|
|
_Class_:
|
10988 |
|
|
Transformational function
|
10989 |
|
|
|
10990 |
|
|
_Syntax_:
|
10991 |
|
|
`RESULT = REPEAT(STRING, NCOPIES)'
|
10992 |
|
|
|
10993 |
|
|
_Arguments_:
|
10994 |
|
|
STRING Shall be scalar and of type `CHARACTER'.
|
10995 |
|
|
NCOPIES Shall be scalar and of type `INTEGER'.
|
10996 |
|
|
|
10997 |
|
|
_Return value_:
|
10998 |
|
|
A new scalar of type `CHARACTER' built up from NCOPIES copies of
|
10999 |
|
|
STRING.
|
11000 |
|
|
|
11001 |
|
|
_Example_:
|
11002 |
|
|
program test_repeat
|
11003 |
|
|
write(*,*) repeat("x", 5) ! "xxxxx"
|
11004 |
|
|
end program
|
11005 |
|
|
|
11006 |
|
|
|
11007 |
|
|
File: gfortran.info, Node: RESHAPE, Next: RRSPACING, Prev: REPEAT, Up: Intrinsic Procedures
|
11008 |
|
|
|
11009 |
|
|
8.182 `RESHAPE' -- Function to reshape an array
|
11010 |
|
|
===============================================
|
11011 |
|
|
|
11012 |
|
|
_Description_:
|
11013 |
|
|
Reshapes SOURCE to correspond to SHAPE. If necessary, the new
|
11014 |
|
|
array may be padded with elements from PAD or permuted as defined
|
11015 |
|
|
by ORDER.
|
11016 |
|
|
|
11017 |
|
|
_Standard_:
|
11018 |
|
|
Fortran 95 and later
|
11019 |
|
|
|
11020 |
|
|
_Class_:
|
11021 |
|
|
Transformational function
|
11022 |
|
|
|
11023 |
|
|
_Syntax_:
|
11024 |
|
|
`RESULT = RESHAPE(SOURCE, SHAPE[, PAD, ORDER])'
|
11025 |
|
|
|
11026 |
|
|
_Arguments_:
|
11027 |
|
|
SOURCE Shall be an array of any type.
|
11028 |
|
|
SHAPE Shall be of type `INTEGER' and an array of
|
11029 |
|
|
rank one. Its values must be positive or zero.
|
11030 |
|
|
PAD (Optional) shall be an array of the same type
|
11031 |
|
|
as SOURCE.
|
11032 |
|
|
ORDER (Optional) shall be of type `INTEGER' and an
|
11033 |
|
|
array of the same shape as SHAPE. Its values
|
11034 |
|
|
shall be a permutation of the numbers from 1
|
11035 |
|
|
to n, where n is the size of SHAPE. If ORDER
|
11036 |
|
|
is absent, the natural ordering shall be
|
11037 |
|
|
assumed.
|
11038 |
|
|
|
11039 |
|
|
_Return value_:
|
11040 |
|
|
The result is an array of shape SHAPE with the same type as SOURCE.
|
11041 |
|
|
|
11042 |
|
|
_Example_:
|
11043 |
|
|
PROGRAM test_reshape
|
11044 |
|
|
INTEGER, DIMENSION(4) :: x
|
11045 |
|
|
WRITE(*,*) SHAPE(x) ! prints "4"
|
11046 |
|
|
WRITE(*,*) SHAPE(RESHAPE(x, (/2, 2/))) ! prints "2 2"
|
11047 |
|
|
END PROGRAM
|
11048 |
|
|
|
11049 |
|
|
_See also_:
|
11050 |
|
|
*note SHAPE::
|
11051 |
|
|
|
11052 |
|
|
|
11053 |
|
|
File: gfortran.info, Node: RRSPACING, Next: RSHIFT, Prev: RESHAPE, Up: Intrinsic Procedures
|
11054 |
|
|
|
11055 |
|
|
8.183 `RRSPACING' -- Reciprocal of the relative spacing
|
11056 |
|
|
=======================================================
|
11057 |
|
|
|
11058 |
|
|
_Description_:
|
11059 |
|
|
`RRSPACING(X)' returns the reciprocal of the relative spacing of
|
11060 |
|
|
model numbers near X.
|
11061 |
|
|
|
11062 |
|
|
_Standard_:
|
11063 |
|
|
Fortran 95 and later
|
11064 |
|
|
|
11065 |
|
|
_Class_:
|
11066 |
|
|
Elemental function
|
11067 |
|
|
|
11068 |
|
|
_Syntax_:
|
11069 |
|
|
`RESULT = RRSPACING(X)'
|
11070 |
|
|
|
11071 |
|
|
_Arguments_:
|
11072 |
|
|
X Shall be of type `REAL'.
|
11073 |
|
|
|
11074 |
|
|
_Return value_:
|
11075 |
|
|
The return value is of the same type and kind as X. The value
|
11076 |
|
|
returned is equal to `ABS(FRACTION(X)) *
|
11077 |
|
|
FLOAT(RADIX(X))**DIGITS(X)'.
|
11078 |
|
|
|
11079 |
|
|
_See also_:
|
11080 |
|
|
*note SPACING::
|
11081 |
|
|
|
11082 |
|
|
|
11083 |
|
|
File: gfortran.info, Node: RSHIFT, Next: SCALE, Prev: RRSPACING, Up: Intrinsic Procedures
|
11084 |
|
|
|
11085 |
|
|
8.184 `RSHIFT' -- Right shift bits
|
11086 |
|
|
==================================
|
11087 |
|
|
|
11088 |
|
|
_Description_:
|
11089 |
|
|
`RSHIFT' returns a value corresponding to I with all of the bits
|
11090 |
|
|
shifted right by SHIFT places. If the absolute value of SHIFT is
|
11091 |
|
|
greater than `BIT_SIZE(I)', the value is undefined. Bits shifted
|
11092 |
|
|
out from the left end are lost; zeros are shifted in from the
|
11093 |
|
|
opposite end.
|
11094 |
|
|
|
11095 |
|
|
This function has been superseded by the `ISHFT' intrinsic, which
|
11096 |
|
|
is standard in Fortran 95 and later.
|
11097 |
|
|
|
11098 |
|
|
_Standard_:
|
11099 |
|
|
GNU extension
|
11100 |
|
|
|
11101 |
|
|
_Class_:
|
11102 |
|
|
Elemental function
|
11103 |
|
|
|
11104 |
|
|
_Syntax_:
|
11105 |
|
|
`RESULT = RSHIFT(I, SHIFT)'
|
11106 |
|
|
|
11107 |
|
|
_Arguments_:
|
11108 |
|
|
I The type shall be `INTEGER'.
|
11109 |
|
|
SHIFT The type shall be `INTEGER'.
|
11110 |
|
|
|
11111 |
|
|
_Return value_:
|
11112 |
|
|
The return value is of type `INTEGER' and of the same kind as I.
|
11113 |
|
|
|
11114 |
|
|
_See also_:
|
11115 |
|
|
*note ISHFT::, *note ISHFTC::, *note LSHIFT::
|
11116 |
|
|
|
11117 |
|
|
|
11118 |
|
|
|
11119 |
|
|
File: gfortran.info, Node: SCALE, Next: SCAN, Prev: RSHIFT, Up: Intrinsic Procedures
|
11120 |
|
|
|
11121 |
|
|
8.185 `SCALE' -- Scale a real value
|
11122 |
|
|
===================================
|
11123 |
|
|
|
11124 |
|
|
_Description_:
|
11125 |
|
|
`SCALE(X,I)' returns `X * RADIX(X)**I'.
|
11126 |
|
|
|
11127 |
|
|
_Standard_:
|
11128 |
|
|
Fortran 95 and later
|
11129 |
|
|
|
11130 |
|
|
_Class_:
|
11131 |
|
|
Elemental function
|
11132 |
|
|
|
11133 |
|
|
_Syntax_:
|
11134 |
|
|
`RESULT = SCALE(X, I)'
|
11135 |
|
|
|
11136 |
|
|
_Arguments_:
|
11137 |
|
|
X The type of the argument shall be a `REAL'.
|
11138 |
|
|
I The type of the argument shall be a `INTEGER'.
|
11139 |
|
|
|
11140 |
|
|
_Return value_:
|
11141 |
|
|
The return value is of the same type and kind as X. Its value is
|
11142 |
|
|
`X * RADIX(X)**I'.
|
11143 |
|
|
|
11144 |
|
|
_Example_:
|
11145 |
|
|
program test_scale
|
11146 |
|
|
real :: x = 178.1387e-4
|
11147 |
|
|
integer :: i = 5
|
11148 |
|
|
print *, scale(x,i), x*radix(x)**i
|
11149 |
|
|
end program test_scale
|
11150 |
|
|
|
11151 |
|
|
|
11152 |
|
|
|
11153 |
|
|
File: gfortran.info, Node: SCAN, Next: SECNDS, Prev: SCALE, Up: Intrinsic Procedures
|
11154 |
|
|
|
11155 |
|
|
8.186 `SCAN' -- Scan a string for the presence of a set of characters
|
11156 |
|
|
=====================================================================
|
11157 |
|
|
|
11158 |
|
|
_Description_:
|
11159 |
|
|
Scans a STRING for any of the characters in a SET of characters.
|
11160 |
|
|
|
11161 |
|
|
If BACK is either absent or equals `FALSE', this function returns
|
11162 |
|
|
the position of the leftmost character of STRING that is in SET.
|
11163 |
|
|
If BACK equals `TRUE', the rightmost position is returned. If no
|
11164 |
|
|
character of SET is found in STRING, the result is zero.
|
11165 |
|
|
|
11166 |
|
|
_Standard_:
|
11167 |
|
|
Fortran 95 and later, with KIND argument Fortran 2003 and later
|
11168 |
|
|
|
11169 |
|
|
_Class_:
|
11170 |
|
|
Elemental function
|
11171 |
|
|
|
11172 |
|
|
_Syntax_:
|
11173 |
|
|
`RESULT = SCAN(STRING, SET[, BACK [, KIND]])'
|
11174 |
|
|
|
11175 |
|
|
_Arguments_:
|
11176 |
|
|
STRING Shall be of type `CHARACTER'.
|
11177 |
|
|
SET Shall be of type `CHARACTER'.
|
11178 |
|
|
BACK (Optional) shall be of type `LOGICAL'.
|
11179 |
|
|
KIND (Optional) An `INTEGER' initialization
|
11180 |
|
|
expression indicating the kind parameter of
|
11181 |
|
|
the result.
|
11182 |
|
|
|
11183 |
|
|
_Return value_:
|
11184 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
11185 |
|
|
absent, the return value is of default integer kind.
|
11186 |
|
|
|
11187 |
|
|
_Example_:
|
11188 |
|
|
PROGRAM test_scan
|
11189 |
|
|
WRITE(*,*) SCAN("FORTRAN", "AO") ! 2, found 'O'
|
11190 |
|
|
WRITE(*,*) SCAN("FORTRAN", "AO", .TRUE.) ! 6, found 'A'
|
11191 |
|
|
WRITE(*,*) SCAN("FORTRAN", "C++") ! 0, found none
|
11192 |
|
|
END PROGRAM
|
11193 |
|
|
|
11194 |
|
|
_See also_:
|
11195 |
|
|
*note INDEX intrinsic::, *note VERIFY::
|
11196 |
|
|
|
11197 |
|
|
|
11198 |
|
|
File: gfortran.info, Node: SECNDS, Next: SECOND, Prev: SCAN, Up: Intrinsic Procedures
|
11199 |
|
|
|
11200 |
|
|
8.187 `SECNDS' -- Time function
|
11201 |
|
|
===============================
|
11202 |
|
|
|
11203 |
|
|
_Description_:
|
11204 |
|
|
`SECNDS(X)' gets the time in seconds from the real-time system
|
11205 |
|
|
clock. X is a reference time, also in seconds. If this is zero,
|
11206 |
|
|
the time in seconds from midnight is returned. This function is
|
11207 |
|
|
non-standard and its use is discouraged.
|
11208 |
|
|
|
11209 |
|
|
_Standard_:
|
11210 |
|
|
GNU extension
|
11211 |
|
|
|
11212 |
|
|
_Class_:
|
11213 |
|
|
Function
|
11214 |
|
|
|
11215 |
|
|
_Syntax_:
|
11216 |
|
|
`RESULT = SECNDS (X)'
|
11217 |
|
|
|
11218 |
|
|
_Arguments_:
|
11219 |
|
|
T Shall be of type `REAL(4)'.
|
11220 |
|
|
X Shall be of type `REAL(4)'.
|
11221 |
|
|
|
11222 |
|
|
_Return value_:
|
11223 |
|
|
None
|
11224 |
|
|
|
11225 |
|
|
_Example_:
|
11226 |
|
|
program test_secnds
|
11227 |
|
|
integer :: i
|
11228 |
|
|
real(4) :: t1, t2
|
11229 |
|
|
print *, secnds (0.0) ! seconds since midnight
|
11230 |
|
|
t1 = secnds (0.0) ! reference time
|
11231 |
|
|
do i = 1, 10000000 ! do something
|
11232 |
|
|
end do
|
11233 |
|
|
t2 = secnds (t1) ! elapsed time
|
11234 |
|
|
print *, "Something took ", t2, " seconds."
|
11235 |
|
|
end program test_secnds
|
11236 |
|
|
|
11237 |
|
|
|
11238 |
|
|
File: gfortran.info, Node: SECOND, Next: SELECTED_CHAR_KIND, Prev: SECNDS, Up: Intrinsic Procedures
|
11239 |
|
|
|
11240 |
|
|
8.188 `SECOND' -- CPU time function
|
11241 |
|
|
===================================
|
11242 |
|
|
|
11243 |
|
|
_Description_:
|
11244 |
|
|
Returns a `REAL(4)' value representing the elapsed CPU time in
|
11245 |
|
|
seconds. This provides the same functionality as the standard
|
11246 |
|
|
`CPU_TIME' intrinsic, and is only included for backwards
|
11247 |
|
|
compatibility.
|
11248 |
|
|
|
11249 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
11250 |
|
|
however, only one form can be used in any given program unit.
|
11251 |
|
|
|
11252 |
|
|
_Standard_:
|
11253 |
|
|
GNU extension
|
11254 |
|
|
|
11255 |
|
|
_Class_:
|
11256 |
|
|
Subroutine, function
|
11257 |
|
|
|
11258 |
|
|
_Syntax_:
|
11259 |
|
|
`CALL SECOND(TIME)'
|
11260 |
|
|
`TIME = SECOND()'
|
11261 |
|
|
|
11262 |
|
|
_Arguments_:
|
11263 |
|
|
TIME Shall be of type `REAL(4)'.
|
11264 |
|
|
|
11265 |
|
|
_Return value_:
|
11266 |
|
|
In either syntax, TIME is set to the process's current runtime in
|
11267 |
|
|
seconds.
|
11268 |
|
|
|
11269 |
|
|
_See also_:
|
11270 |
|
|
*note CPU_TIME::
|
11271 |
|
|
|
11272 |
|
|
|
11273 |
|
|
|
11274 |
|
|
File: gfortran.info, Node: SELECTED_CHAR_KIND, Next: SELECTED_INT_KIND, Prev: SECOND, Up: Intrinsic Procedures
|
11275 |
|
|
|
11276 |
|
|
8.189 `SELECTED_CHAR_KIND' -- Choose character kind
|
11277 |
|
|
===================================================
|
11278 |
|
|
|
11279 |
|
|
_Description_:
|
11280 |
|
|
`SELECTED_CHAR_KIND(NAME)' returns the kind value for the character
|
11281 |
|
|
set named NAME, if a character set with such a name is supported,
|
11282 |
|
|
or -1 otherwise. Currently, supported character sets include
|
11283 |
|
|
"ASCII" and "DEFAULT", which are equivalent.
|
11284 |
|
|
|
11285 |
|
|
_Standard_:
|
11286 |
|
|
Fortran 2003 and later
|
11287 |
|
|
|
11288 |
|
|
_Class_:
|
11289 |
|
|
Transformational function
|
11290 |
|
|
|
11291 |
|
|
_Syntax_:
|
11292 |
|
|
`RESULT = SELECTED_CHAR_KIND(NAME)'
|
11293 |
|
|
|
11294 |
|
|
_Arguments_:
|
11295 |
|
|
NAME Shall be a scalar and of the default character
|
11296 |
|
|
type.
|
11297 |
|
|
|
11298 |
|
|
_Example_:
|
11299 |
|
|
program ascii_kind
|
11300 |
|
|
integer,parameter :: ascii = selected_char_kind("ascii")
|
11301 |
|
|
character(kind=ascii, len=26) :: s
|
11302 |
|
|
|
11303 |
|
|
s = ascii_"abcdefghijklmnopqrstuvwxyz"
|
11304 |
|
|
print *, s
|
11305 |
|
|
end program ascii_kind
|
11306 |
|
|
|
11307 |
|
|
|
11308 |
|
|
File: gfortran.info, Node: SELECTED_INT_KIND, Next: SELECTED_REAL_KIND, Prev: SELECTED_CHAR_KIND, Up: Intrinsic Procedures
|
11309 |
|
|
|
11310 |
|
|
8.190 `SELECTED_INT_KIND' -- Choose integer kind
|
11311 |
|
|
================================================
|
11312 |
|
|
|
11313 |
|
|
_Description_:
|
11314 |
|
|
`SELECTED_INT_KIND(R)' return the kind value of the smallest
|
11315 |
|
|
integer type that can represent all values ranging from -10^R
|
11316 |
|
|
(exclusive) to 10^R (exclusive). If there is no integer kind that
|
11317 |
|
|
accommodates this range, `SELECTED_INT_KIND' returns -1.
|
11318 |
|
|
|
11319 |
|
|
_Standard_:
|
11320 |
|
|
Fortran 95 and later
|
11321 |
|
|
|
11322 |
|
|
_Class_:
|
11323 |
|
|
Transformational function
|
11324 |
|
|
|
11325 |
|
|
_Syntax_:
|
11326 |
|
|
`RESULT = SELECTED_INT_KIND(R)'
|
11327 |
|
|
|
11328 |
|
|
_Arguments_:
|
11329 |
|
|
R Shall be a scalar and of type `INTEGER'.
|
11330 |
|
|
|
11331 |
|
|
_Example_:
|
11332 |
|
|
program large_integers
|
11333 |
|
|
integer,parameter :: k5 = selected_int_kind(5)
|
11334 |
|
|
integer,parameter :: k15 = selected_int_kind(15)
|
11335 |
|
|
integer(kind=k5) :: i5
|
11336 |
|
|
integer(kind=k15) :: i15
|
11337 |
|
|
|
11338 |
|
|
print *, huge(i5), huge(i15)
|
11339 |
|
|
|
11340 |
|
|
! The following inequalities are always true
|
11341 |
|
|
print *, huge(i5) >= 10_k5**5-1
|
11342 |
|
|
print *, huge(i15) >= 10_k15**15-1
|
11343 |
|
|
end program large_integers
|
11344 |
|
|
|
11345 |
|
|
|
11346 |
|
|
File: gfortran.info, Node: SELECTED_REAL_KIND, Next: SET_EXPONENT, Prev: SELECTED_INT_KIND, Up: Intrinsic Procedures
|
11347 |
|
|
|
11348 |
|
|
8.191 `SELECTED_REAL_KIND' -- Choose real kind
|
11349 |
|
|
==============================================
|
11350 |
|
|
|
11351 |
|
|
_Description_:
|
11352 |
|
|
`SELECTED_REAL_KIND(P,R)' returns the kind value of a real data
|
11353 |
|
|
type with decimal precision of at least `P' digits and exponent
|
11354 |
|
|
range greater at least `R'.
|
11355 |
|
|
|
11356 |
|
|
_Standard_:
|
11357 |
|
|
Fortran 95 and later
|
11358 |
|
|
|
11359 |
|
|
_Class_:
|
11360 |
|
|
Transformational function
|
11361 |
|
|
|
11362 |
|
|
_Syntax_:
|
11363 |
|
|
`RESULT = SELECTED_REAL_KIND([P, R])'
|
11364 |
|
|
|
11365 |
|
|
_Arguments_:
|
11366 |
|
|
P (Optional) shall be a scalar and of type
|
11367 |
|
|
`INTEGER'.
|
11368 |
|
|
R (Optional) shall be a scalar and of type
|
11369 |
|
|
`INTEGER'.
|
11370 |
|
|
At least one argument shall be present.
|
11371 |
|
|
|
11372 |
|
|
_Return value_:
|
11373 |
|
|
`SELECTED_REAL_KIND' returns the value of the kind type parameter
|
11374 |
|
|
of a real data type with decimal precision of at least `P' digits
|
11375 |
|
|
and a decimal exponent range of at least `R'. If more than one
|
11376 |
|
|
real data type meet the criteria, the kind of the data type with
|
11377 |
|
|
the smallest decimal precision is returned. If no real data type
|
11378 |
|
|
matches the criteria, the result is
|
11379 |
|
|
-1 if the processor does not support a real data type with a
|
11380 |
|
|
precision greater than or equal to `P'
|
11381 |
|
|
|
11382 |
|
|
-2 if the processor does not support a real type with an exponent
|
11383 |
|
|
range greater than or equal to `R'
|
11384 |
|
|
|
11385 |
|
|
-3 if neither is supported.
|
11386 |
|
|
|
11387 |
|
|
_Example_:
|
11388 |
|
|
program real_kinds
|
11389 |
|
|
integer,parameter :: p6 = selected_real_kind(6)
|
11390 |
|
|
integer,parameter :: p10r100 = selected_real_kind(10,100)
|
11391 |
|
|
integer,parameter :: r400 = selected_real_kind(r=400)
|
11392 |
|
|
real(kind=p6) :: x
|
11393 |
|
|
real(kind=p10r100) :: y
|
11394 |
|
|
real(kind=r400) :: z
|
11395 |
|
|
|
11396 |
|
|
print *, precision(x), range(x)
|
11397 |
|
|
print *, precision(y), range(y)
|
11398 |
|
|
print *, precision(z), range(z)
|
11399 |
|
|
end program real_kinds
|
11400 |
|
|
|
11401 |
|
|
|
11402 |
|
|
File: gfortran.info, Node: SET_EXPONENT, Next: SHAPE, Prev: SELECTED_REAL_KIND, Up: Intrinsic Procedures
|
11403 |
|
|
|
11404 |
|
|
8.192 `SET_EXPONENT' -- Set the exponent of the model
|
11405 |
|
|
=====================================================
|
11406 |
|
|
|
11407 |
|
|
_Description_:
|
11408 |
|
|
`SET_EXPONENT(X, I)' returns the real number whose fractional part
|
11409 |
|
|
is that that of X and whose exponent part is I.
|
11410 |
|
|
|
11411 |
|
|
_Standard_:
|
11412 |
|
|
Fortran 95 and later
|
11413 |
|
|
|
11414 |
|
|
_Class_:
|
11415 |
|
|
Elemental function
|
11416 |
|
|
|
11417 |
|
|
_Syntax_:
|
11418 |
|
|
`RESULT = SET_EXPONENT(X, I)'
|
11419 |
|
|
|
11420 |
|
|
_Arguments_:
|
11421 |
|
|
X Shall be of type `REAL'.
|
11422 |
|
|
I Shall be of type `INTEGER'.
|
11423 |
|
|
|
11424 |
|
|
_Return value_:
|
11425 |
|
|
The return value is of the same type and kind as X. The real
|
11426 |
|
|
number whose fractional part is that that of X and whose exponent
|
11427 |
|
|
part if I is returned; it is `FRACTION(X) * RADIX(X)**I'.
|
11428 |
|
|
|
11429 |
|
|
_Example_:
|
11430 |
|
|
PROGRAM test_setexp
|
11431 |
|
|
REAL :: x = 178.1387e-4
|
11432 |
|
|
INTEGER :: i = 17
|
11433 |
|
|
PRINT *, SET_EXPONENT(x, i), FRACTION(x) * RADIX(x)**i
|
11434 |
|
|
END PROGRAM
|
11435 |
|
|
|
11436 |
|
|
|
11437 |
|
|
|
11438 |
|
|
File: gfortran.info, Node: SHAPE, Next: SIGN, Prev: SET_EXPONENT, Up: Intrinsic Procedures
|
11439 |
|
|
|
11440 |
|
|
8.193 `SHAPE' -- Determine the shape of an array
|
11441 |
|
|
================================================
|
11442 |
|
|
|
11443 |
|
|
_Description_:
|
11444 |
|
|
Determines the shape of an array.
|
11445 |
|
|
|
11446 |
|
|
_Standard_:
|
11447 |
|
|
Fortran 95 and later
|
11448 |
|
|
|
11449 |
|
|
_Class_:
|
11450 |
|
|
Inquiry function
|
11451 |
|
|
|
11452 |
|
|
_Syntax_:
|
11453 |
|
|
`RESULT = SHAPE(SOURCE)'
|
11454 |
|
|
|
11455 |
|
|
_Arguments_:
|
11456 |
|
|
SOURCE Shall be an array or scalar of any type. If
|
11457 |
|
|
SOURCE is a pointer it must be associated and
|
11458 |
|
|
allocatable arrays must be allocated.
|
11459 |
|
|
|
11460 |
|
|
_Return value_:
|
11461 |
|
|
An `INTEGER' array of rank one with as many elements as SOURCE has
|
11462 |
|
|
dimensions. The elements of the resulting array correspond to the
|
11463 |
|
|
extend of SOURCE along the respective dimensions. If SOURCE is a
|
11464 |
|
|
scalar, the result is the rank one array of size zero.
|
11465 |
|
|
|
11466 |
|
|
_Example_:
|
11467 |
|
|
PROGRAM test_shape
|
11468 |
|
|
INTEGER, DIMENSION(-1:1, -1:2) :: A
|
11469 |
|
|
WRITE(*,*) SHAPE(A) ! (/ 3, 4 /)
|
11470 |
|
|
WRITE(*,*) SIZE(SHAPE(42)) ! (/ /)
|
11471 |
|
|
END PROGRAM
|
11472 |
|
|
|
11473 |
|
|
_See also_:
|
11474 |
|
|
*note RESHAPE::, *note SIZE::
|
11475 |
|
|
|
11476 |
|
|
|
11477 |
|
|
File: gfortran.info, Node: SIGN, Next: SIGNAL, Prev: SHAPE, Up: Intrinsic Procedures
|
11478 |
|
|
|
11479 |
|
|
8.194 `SIGN' -- Sign copying function
|
11480 |
|
|
=====================================
|
11481 |
|
|
|
11482 |
|
|
_Description_:
|
11483 |
|
|
`SIGN(A,B)' returns the value of A with the sign of B.
|
11484 |
|
|
|
11485 |
|
|
_Standard_:
|
11486 |
|
|
Fortran 77 and later
|
11487 |
|
|
|
11488 |
|
|
_Class_:
|
11489 |
|
|
Elemental function
|
11490 |
|
|
|
11491 |
|
|
_Syntax_:
|
11492 |
|
|
`RESULT = SIGN(A, B)'
|
11493 |
|
|
|
11494 |
|
|
_Arguments_:
|
11495 |
|
|
A Shall be of type `INTEGER' or `REAL'
|
11496 |
|
|
B Shall be of the same type and kind as A
|
11497 |
|
|
|
11498 |
|
|
_Return value_:
|
11499 |
|
|
The kind of the return value is that of A and B. If B\ge 0 then
|
11500 |
|
|
the result is `ABS(A)', else it is `-ABS(A)'.
|
11501 |
|
|
|
11502 |
|
|
_Example_:
|
11503 |
|
|
program test_sign
|
11504 |
|
|
print *, sign(-12,1)
|
11505 |
|
|
print *, sign(-12,0)
|
11506 |
|
|
print *, sign(-12,-1)
|
11507 |
|
|
|
11508 |
|
|
print *, sign(-12.,1.)
|
11509 |
|
|
print *, sign(-12.,0.)
|
11510 |
|
|
print *, sign(-12.,-1.)
|
11511 |
|
|
end program test_sign
|
11512 |
|
|
|
11513 |
|
|
_Specific names_:
|
11514 |
|
|
Name Arguments Return type Standard
|
11515 |
|
|
`ISIGN(A,P)' `INTEGER(4)' `INTEGER(4)' f95, gnu
|
11516 |
|
|
`DSIGN(A,P)' `REAL(8)' `REAL(8)' f95, gnu
|
11517 |
|
|
|
11518 |
|
|
|
11519 |
|
|
File: gfortran.info, Node: SIGNAL, Next: SIN, Prev: SIGN, Up: Intrinsic Procedures
|
11520 |
|
|
|
11521 |
|
|
8.195 `SIGNAL' -- Signal handling subroutine (or function)
|
11522 |
|
|
==========================================================
|
11523 |
|
|
|
11524 |
|
|
_Description_:
|
11525 |
|
|
`SIGNAL(NUMBER, HANDLER [, STATUS])' causes external subroutine
|
11526 |
|
|
HANDLER to be executed with a single integer argument when signal
|
11527 |
|
|
NUMBER occurs. If HANDLER is an integer, it can be used to turn
|
11528 |
|
|
off handling of signal NUMBER or revert to its default action.
|
11529 |
|
|
See `signal(2)'.
|
11530 |
|
|
|
11531 |
|
|
If `SIGNAL' is called as a subroutine and the STATUS argument is
|
11532 |
|
|
supplied, it is set to the value returned by `signal(2)'.
|
11533 |
|
|
|
11534 |
|
|
_Standard_:
|
11535 |
|
|
GNU extension
|
11536 |
|
|
|
11537 |
|
|
_Class_:
|
11538 |
|
|
Subroutine, function
|
11539 |
|
|
|
11540 |
|
|
_Syntax_:
|
11541 |
|
|
`CALL SIGNAL(NUMBER, HANDLER [, STATUS])'
|
11542 |
|
|
`STATUS = SIGNAL(NUMBER, HANDLER)'
|
11543 |
|
|
|
11544 |
|
|
_Arguments_:
|
11545 |
|
|
NUMBER Shall be a scalar integer, with `INTENT(IN)'
|
11546 |
|
|
HANDLER Signal handler (`INTEGER FUNCTION' or
|
11547 |
|
|
`SUBROUTINE') or dummy/global `INTEGER' scalar.
|
11548 |
|
|
`INTEGER'. It is `INTENT(IN)'.
|
11549 |
|
|
STATUS (Optional) STATUS shall be a scalar integer.
|
11550 |
|
|
It has `INTENT(OUT)'.
|
11551 |
|
|
|
11552 |
|
|
_Return value_:
|
11553 |
|
|
The `SIGNAL' function returns the value returned by `signal(2)'.
|
11554 |
|
|
|
11555 |
|
|
_Example_:
|
11556 |
|
|
program test_signal
|
11557 |
|
|
intrinsic signal
|
11558 |
|
|
external handler_print
|
11559 |
|
|
|
11560 |
|
|
call signal (12, handler_print)
|
11561 |
|
|
call signal (10, 1)
|
11562 |
|
|
|
11563 |
|
|
call sleep (30)
|
11564 |
|
|
end program test_signal
|
11565 |
|
|
|
11566 |
|
|
|
11567 |
|
|
File: gfortran.info, Node: SIN, Next: SINH, Prev: SIGNAL, Up: Intrinsic Procedures
|
11568 |
|
|
|
11569 |
|
|
8.196 `SIN' -- Sine function
|
11570 |
|
|
============================
|
11571 |
|
|
|
11572 |
|
|
_Description_:
|
11573 |
|
|
`SIN(X)' computes the sine of X.
|
11574 |
|
|
|
11575 |
|
|
_Standard_:
|
11576 |
|
|
Fortran 77 and later
|
11577 |
|
|
|
11578 |
|
|
_Class_:
|
11579 |
|
|
Elemental function
|
11580 |
|
|
|
11581 |
|
|
_Syntax_:
|
11582 |
|
|
`RESULT = SIN(X)'
|
11583 |
|
|
|
11584 |
|
|
_Arguments_:
|
11585 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
11586 |
|
|
|
11587 |
|
|
_Return value_:
|
11588 |
|
|
The return value has same type and kind as X.
|
11589 |
|
|
|
11590 |
|
|
_Example_:
|
11591 |
|
|
program test_sin
|
11592 |
|
|
real :: x = 0.0
|
11593 |
|
|
x = sin(x)
|
11594 |
|
|
end program test_sin
|
11595 |
|
|
|
11596 |
|
|
_Specific names_:
|
11597 |
|
|
Name Argument Return type Standard
|
11598 |
|
|
`DSIN(X)' `REAL(8) X' `REAL(8)' f95, gnu
|
11599 |
|
|
`CSIN(X)' `COMPLEX(4) `COMPLEX(4)' f95, gnu
|
11600 |
|
|
X'
|
11601 |
|
|
`ZSIN(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
|
11602 |
|
|
X'
|
11603 |
|
|
`CDSIN(X)' `COMPLEX(8) `COMPLEX(8)' f95, gnu
|
11604 |
|
|
X'
|
11605 |
|
|
|
11606 |
|
|
_See also_:
|
11607 |
|
|
*note ASIN::
|
11608 |
|
|
|
11609 |
|
|
|
11610 |
|
|
File: gfortran.info, Node: SINH, Next: SIZE, Prev: SIN, Up: Intrinsic Procedures
|
11611 |
|
|
|
11612 |
|
|
8.197 `SINH' -- Hyperbolic sine function
|
11613 |
|
|
========================================
|
11614 |
|
|
|
11615 |
|
|
_Description_:
|
11616 |
|
|
`SINH(X)' computes the hyperbolic sine of X.
|
11617 |
|
|
|
11618 |
|
|
_Standard_:
|
11619 |
|
|
Fortran 95 and later, for a complex argument Fortran 2008 or later
|
11620 |
|
|
|
11621 |
|
|
_Class_:
|
11622 |
|
|
Elemental function
|
11623 |
|
|
|
11624 |
|
|
_Syntax_:
|
11625 |
|
|
`RESULT = SINH(X)'
|
11626 |
|
|
|
11627 |
|
|
_Arguments_:
|
11628 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
11629 |
|
|
|
11630 |
|
|
_Return value_:
|
11631 |
|
|
The return value has same type and kind as X.
|
11632 |
|
|
|
11633 |
|
|
_Example_:
|
11634 |
|
|
program test_sinh
|
11635 |
|
|
real(8) :: x = - 1.0_8
|
11636 |
|
|
x = sinh(x)
|
11637 |
|
|
end program test_sinh
|
11638 |
|
|
|
11639 |
|
|
_Specific names_:
|
11640 |
|
|
Name Argument Return type Standard
|
11641 |
|
|
`DSINH(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
|
11642 |
|
|
later
|
11643 |
|
|
|
11644 |
|
|
_See also_:
|
11645 |
|
|
*note ASINH::
|
11646 |
|
|
|
11647 |
|
|
|
11648 |
|
|
File: gfortran.info, Node: SIZE, Next: SIZEOF, Prev: SINH, Up: Intrinsic Procedures
|
11649 |
|
|
|
11650 |
|
|
8.198 `SIZE' -- Determine the size of an array
|
11651 |
|
|
==============================================
|
11652 |
|
|
|
11653 |
|
|
_Description_:
|
11654 |
|
|
Determine the extent of ARRAY along a specified dimension DIM, or
|
11655 |
|
|
the total number of elements in ARRAY if DIM is absent.
|
11656 |
|
|
|
11657 |
|
|
_Standard_:
|
11658 |
|
|
Fortran 95 and later, with KIND argument Fortran 2003 and later
|
11659 |
|
|
|
11660 |
|
|
_Class_:
|
11661 |
|
|
Inquiry function
|
11662 |
|
|
|
11663 |
|
|
_Syntax_:
|
11664 |
|
|
`RESULT = SIZE(ARRAY[, DIM [, KIND]])'
|
11665 |
|
|
|
11666 |
|
|
_Arguments_:
|
11667 |
|
|
ARRAY Shall be an array of any type. If ARRAY is a
|
11668 |
|
|
pointer it must be associated and allocatable
|
11669 |
|
|
arrays must be allocated.
|
11670 |
|
|
DIM (Optional) shall be a scalar of type `INTEGER'
|
11671 |
|
|
and its value shall be in the range from 1 to
|
11672 |
|
|
n, where n equals the rank of ARRAY.
|
11673 |
|
|
KIND (Optional) An `INTEGER' initialization
|
11674 |
|
|
expression indicating the kind parameter of
|
11675 |
|
|
the result.
|
11676 |
|
|
|
11677 |
|
|
_Return value_:
|
11678 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
11679 |
|
|
absent, the return value is of default integer kind.
|
11680 |
|
|
|
11681 |
|
|
_Example_:
|
11682 |
|
|
PROGRAM test_size
|
11683 |
|
|
WRITE(*,*) SIZE((/ 1, 2 /)) ! 2
|
11684 |
|
|
END PROGRAM
|
11685 |
|
|
|
11686 |
|
|
_See also_:
|
11687 |
|
|
*note SHAPE::, *note RESHAPE::
|
11688 |
|
|
|
11689 |
|
|
|
11690 |
|
|
File: gfortran.info, Node: SIZEOF, Next: SLEEP, Prev: SIZE, Up: Intrinsic Procedures
|
11691 |
|
|
|
11692 |
|
|
8.199 `SIZEOF' -- Size in bytes of an expression
|
11693 |
|
|
================================================
|
11694 |
|
|
|
11695 |
|
|
_Description_:
|
11696 |
|
|
`SIZEOF(X)' calculates the number of bytes of storage the
|
11697 |
|
|
expression `X' occupies.
|
11698 |
|
|
|
11699 |
|
|
_Standard_:
|
11700 |
|
|
GNU extension
|
11701 |
|
|
|
11702 |
|
|
_Class_:
|
11703 |
|
|
Intrinsic function
|
11704 |
|
|
|
11705 |
|
|
_Syntax_:
|
11706 |
|
|
`N = SIZEOF(X)'
|
11707 |
|
|
|
11708 |
|
|
_Arguments_:
|
11709 |
|
|
X The argument shall be of any type, rank or
|
11710 |
|
|
shape.
|
11711 |
|
|
|
11712 |
|
|
_Return value_:
|
11713 |
|
|
The return value is of type integer and of the system-dependent
|
11714 |
|
|
kind C_SIZE_T (from the ISO_C_BINDING module). Its value is the
|
11715 |
|
|
number of bytes occupied by the argument. If the argument has the
|
11716 |
|
|
`POINTER' attribute, the number of bytes of the storage area
|
11717 |
|
|
pointed to is returned. If the argument is of a derived type with
|
11718 |
|
|
`POINTER' or `ALLOCATABLE' components, the return value doesn't
|
11719 |
|
|
account for the sizes of the data pointed to by these components.
|
11720 |
|
|
|
11721 |
|
|
_Example_:
|
11722 |
|
|
integer :: i
|
11723 |
|
|
real :: r, s(5)
|
11724 |
|
|
print *, (sizeof(s)/sizeof(r) == 5)
|
11725 |
|
|
end
|
11726 |
|
|
The example will print `.TRUE.' unless you are using a platform
|
11727 |
|
|
where default `REAL' variables are unusually padded.
|
11728 |
|
|
|
11729 |
|
|
_See also_:
|
11730 |
|
|
*note C_SIZEOF::
|
11731 |
|
|
|
11732 |
|
|
|
11733 |
|
|
File: gfortran.info, Node: SLEEP, Next: SNGL, Prev: SIZEOF, Up: Intrinsic Procedures
|
11734 |
|
|
|
11735 |
|
|
8.200 `SLEEP' -- Sleep for the specified number of seconds
|
11736 |
|
|
==========================================================
|
11737 |
|
|
|
11738 |
|
|
_Description_:
|
11739 |
|
|
Calling this subroutine causes the process to pause for SECONDS
|
11740 |
|
|
seconds.
|
11741 |
|
|
|
11742 |
|
|
_Standard_:
|
11743 |
|
|
GNU extension
|
11744 |
|
|
|
11745 |
|
|
_Class_:
|
11746 |
|
|
Subroutine
|
11747 |
|
|
|
11748 |
|
|
_Syntax_:
|
11749 |
|
|
`CALL SLEEP(SECONDS)'
|
11750 |
|
|
|
11751 |
|
|
_Arguments_:
|
11752 |
|
|
SECONDS The type shall be of default `INTEGER'.
|
11753 |
|
|
|
11754 |
|
|
_Example_:
|
11755 |
|
|
program test_sleep
|
11756 |
|
|
call sleep(5)
|
11757 |
|
|
end
|
11758 |
|
|
|
11759 |
|
|
|
11760 |
|
|
File: gfortran.info, Node: SNGL, Next: SPACING, Prev: SLEEP, Up: Intrinsic Procedures
|
11761 |
|
|
|
11762 |
|
|
8.201 `SNGL' -- Convert double precision real to default real
|
11763 |
|
|
=============================================================
|
11764 |
|
|
|
11765 |
|
|
_Description_:
|
11766 |
|
|
`SNGL(A)' converts the double precision real A to a default real
|
11767 |
|
|
value. This is an archaic form of `REAL' that is specific to one
|
11768 |
|
|
type for A.
|
11769 |
|
|
|
11770 |
|
|
_Standard_:
|
11771 |
|
|
Fortran 77 and later
|
11772 |
|
|
|
11773 |
|
|
_Class_:
|
11774 |
|
|
Elemental function
|
11775 |
|
|
|
11776 |
|
|
_Syntax_:
|
11777 |
|
|
`RESULT = SNGL(A)'
|
11778 |
|
|
|
11779 |
|
|
_Arguments_:
|
11780 |
|
|
A The type shall be a double precision `REAL'.
|
11781 |
|
|
|
11782 |
|
|
_Return value_:
|
11783 |
|
|
The return value is of type default `REAL'.
|
11784 |
|
|
|
11785 |
|
|
_See also_:
|
11786 |
|
|
*note DBLE::
|
11787 |
|
|
|
11788 |
|
|
|
11789 |
|
|
File: gfortran.info, Node: SPACING, Next: SPREAD, Prev: SNGL, Up: Intrinsic Procedures
|
11790 |
|
|
|
11791 |
|
|
8.202 `SPACING' -- Smallest distance between two numbers of a given type
|
11792 |
|
|
========================================================================
|
11793 |
|
|
|
11794 |
|
|
_Description_:
|
11795 |
|
|
Determines the distance between the argument X and the nearest
|
11796 |
|
|
adjacent number of the same type.
|
11797 |
|
|
|
11798 |
|
|
_Standard_:
|
11799 |
|
|
Fortran 95 and later
|
11800 |
|
|
|
11801 |
|
|
_Class_:
|
11802 |
|
|
Elemental function
|
11803 |
|
|
|
11804 |
|
|
_Syntax_:
|
11805 |
|
|
`RESULT = SPACING(X)'
|
11806 |
|
|
|
11807 |
|
|
_Arguments_:
|
11808 |
|
|
X Shall be of type `REAL'.
|
11809 |
|
|
|
11810 |
|
|
_Return value_:
|
11811 |
|
|
The result is of the same type as the input argument X.
|
11812 |
|
|
|
11813 |
|
|
_Example_:
|
11814 |
|
|
PROGRAM test_spacing
|
11815 |
|
|
INTEGER, PARAMETER :: SGL = SELECTED_REAL_KIND(p=6, r=37)
|
11816 |
|
|
INTEGER, PARAMETER :: DBL = SELECTED_REAL_KIND(p=13, r=200)
|
11817 |
|
|
|
11818 |
|
|
WRITE(*,*) spacing(1.0_SGL) ! "1.1920929E-07" on i686
|
11819 |
|
|
WRITE(*,*) spacing(1.0_DBL) ! "2.220446049250313E-016" on i686
|
11820 |
|
|
END PROGRAM
|
11821 |
|
|
|
11822 |
|
|
_See also_:
|
11823 |
|
|
*note RRSPACING::
|
11824 |
|
|
|
11825 |
|
|
|
11826 |
|
|
File: gfortran.info, Node: SPREAD, Next: SQRT, Prev: SPACING, Up: Intrinsic Procedures
|
11827 |
|
|
|
11828 |
|
|
8.203 `SPREAD' -- Add a dimension to an array
|
11829 |
|
|
=============================================
|
11830 |
|
|
|
11831 |
|
|
_Description_:
|
11832 |
|
|
Replicates a SOURCE array NCOPIES times along a specified
|
11833 |
|
|
dimension DIM.
|
11834 |
|
|
|
11835 |
|
|
_Standard_:
|
11836 |
|
|
Fortran 95 and later
|
11837 |
|
|
|
11838 |
|
|
_Class_:
|
11839 |
|
|
Transformational function
|
11840 |
|
|
|
11841 |
|
|
_Syntax_:
|
11842 |
|
|
`RESULT = SPREAD(SOURCE, DIM, NCOPIES)'
|
11843 |
|
|
|
11844 |
|
|
_Arguments_:
|
11845 |
|
|
SOURCE Shall be a scalar or an array of any type and
|
11846 |
|
|
a rank less than seven.
|
11847 |
|
|
DIM Shall be a scalar of type `INTEGER' with a
|
11848 |
|
|
value in the range from 1 to n+1, where n
|
11849 |
|
|
equals the rank of SOURCE.
|
11850 |
|
|
NCOPIES Shall be a scalar of type `INTEGER'.
|
11851 |
|
|
|
11852 |
|
|
_Return value_:
|
11853 |
|
|
The result is an array of the same type as SOURCE and has rank n+1
|
11854 |
|
|
where n equals the rank of SOURCE.
|
11855 |
|
|
|
11856 |
|
|
_Example_:
|
11857 |
|
|
PROGRAM test_spread
|
11858 |
|
|
INTEGER :: a = 1, b(2) = (/ 1, 2 /)
|
11859 |
|
|
WRITE(*,*) SPREAD(A, 1, 2) ! "1 1"
|
11860 |
|
|
WRITE(*,*) SPREAD(B, 1, 2) ! "1 1 2 2"
|
11861 |
|
|
END PROGRAM
|
11862 |
|
|
|
11863 |
|
|
_See also_:
|
11864 |
|
|
*note UNPACK::
|
11865 |
|
|
|
11866 |
|
|
|
11867 |
|
|
File: gfortran.info, Node: SQRT, Next: SRAND, Prev: SPREAD, Up: Intrinsic Procedures
|
11868 |
|
|
|
11869 |
|
|
8.204 `SQRT' -- Square-root function
|
11870 |
|
|
====================================
|
11871 |
|
|
|
11872 |
|
|
_Description_:
|
11873 |
|
|
`SQRT(X)' computes the square root of X.
|
11874 |
|
|
|
11875 |
|
|
_Standard_:
|
11876 |
|
|
Fortran 77 and later
|
11877 |
|
|
|
11878 |
|
|
_Class_:
|
11879 |
|
|
Elemental function
|
11880 |
|
|
|
11881 |
|
|
_Syntax_:
|
11882 |
|
|
`RESULT = SQRT(X)'
|
11883 |
|
|
|
11884 |
|
|
_Arguments_:
|
11885 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
11886 |
|
|
|
11887 |
|
|
_Return value_:
|
11888 |
|
|
The return value is of type `REAL' or `COMPLEX'. The kind type
|
11889 |
|
|
parameter is the same as X.
|
11890 |
|
|
|
11891 |
|
|
_Example_:
|
11892 |
|
|
program test_sqrt
|
11893 |
|
|
real(8) :: x = 2.0_8
|
11894 |
|
|
complex :: z = (1.0, 2.0)
|
11895 |
|
|
x = sqrt(x)
|
11896 |
|
|
z = sqrt(z)
|
11897 |
|
|
end program test_sqrt
|
11898 |
|
|
|
11899 |
|
|
_Specific names_:
|
11900 |
|
|
Name Argument Return type Standard
|
11901 |
|
|
`DSQRT(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
|
11902 |
|
|
later
|
11903 |
|
|
`CSQRT(X)' `COMPLEX(4) `COMPLEX(4)' Fortran 95 and
|
11904 |
|
|
X' later
|
11905 |
|
|
`ZSQRT(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
|
11906 |
|
|
X'
|
11907 |
|
|
`CDSQRT(X)' `COMPLEX(8) `COMPLEX(8)' GNU extension
|
11908 |
|
|
X'
|
11909 |
|
|
|
11910 |
|
|
|
11911 |
|
|
File: gfortran.info, Node: SRAND, Next: STAT, Prev: SQRT, Up: Intrinsic Procedures
|
11912 |
|
|
|
11913 |
|
|
8.205 `SRAND' -- Reinitialize the random number generator
|
11914 |
|
|
=========================================================
|
11915 |
|
|
|
11916 |
|
|
_Description_:
|
11917 |
|
|
`SRAND' reinitializes the pseudo-random number generator called by
|
11918 |
|
|
`RAND' and `IRAND'. The new seed used by the generator is
|
11919 |
|
|
specified by the required argument SEED.
|
11920 |
|
|
|
11921 |
|
|
_Standard_:
|
11922 |
|
|
GNU extension
|
11923 |
|
|
|
11924 |
|
|
_Class_:
|
11925 |
|
|
Subroutine
|
11926 |
|
|
|
11927 |
|
|
_Syntax_:
|
11928 |
|
|
`CALL SRAND(SEED)'
|
11929 |
|
|
|
11930 |
|
|
_Arguments_:
|
11931 |
|
|
SEED Shall be a scalar `INTEGER(kind=4)'.
|
11932 |
|
|
|
11933 |
|
|
_Return value_:
|
11934 |
|
|
Does not return anything.
|
11935 |
|
|
|
11936 |
|
|
_Example_:
|
11937 |
|
|
See `RAND' and `IRAND' for examples.
|
11938 |
|
|
|
11939 |
|
|
_Notes_:
|
11940 |
|
|
The Fortran 2003 standard specifies the intrinsic `RANDOM_SEED' to
|
11941 |
|
|
initialize the pseudo-random numbers generator and `RANDOM_NUMBER'
|
11942 |
|
|
to generate pseudo-random numbers. Please note that in GNU
|
11943 |
|
|
Fortran, these two sets of intrinsics (`RAND', `IRAND' and `SRAND'
|
11944 |
|
|
on the one hand, `RANDOM_NUMBER' and `RANDOM_SEED' on the other
|
11945 |
|
|
hand) access two independent pseudo-random number generators.
|
11946 |
|
|
|
11947 |
|
|
_See also_:
|
11948 |
|
|
*note RAND::, *note RANDOM_SEED::, *note RANDOM_NUMBER::
|
11949 |
|
|
|
11950 |
|
|
|
11951 |
|
|
|
11952 |
|
|
File: gfortran.info, Node: STAT, Next: SUM, Prev: SRAND, Up: Intrinsic Procedures
|
11953 |
|
|
|
11954 |
|
|
8.206 `STAT' -- Get file status
|
11955 |
|
|
===============================
|
11956 |
|
|
|
11957 |
|
|
_Description_:
|
11958 |
|
|
This function returns information about a file. No permissions are
|
11959 |
|
|
required on the file itself, but execute (search) permission is
|
11960 |
|
|
required on all of the directories in path that lead to the file.
|
11961 |
|
|
|
11962 |
|
|
The elements that are obtained and stored in the array `VALUES':
|
11963 |
|
|
`VALUES(1)'Device ID
|
11964 |
|
|
`VALUES(2)'Inode number
|
11965 |
|
|
`VALUES(3)'File mode
|
11966 |
|
|
`VALUES(4)'Number of links
|
11967 |
|
|
`VALUES(5)'Owner's uid
|
11968 |
|
|
`VALUES(6)'Owner's gid
|
11969 |
|
|
`VALUES(7)'ID of device containing directory entry for
|
11970 |
|
|
file (0 if not available)
|
11971 |
|
|
`VALUES(8)'File size (bytes)
|
11972 |
|
|
`VALUES(9)'Last access time
|
11973 |
|
|
`VALUES(10)'Last modification time
|
11974 |
|
|
`VALUES(11)'Last file status change time
|
11975 |
|
|
`VALUES(12)'Preferred I/O block size (-1 if not available)
|
11976 |
|
|
`VALUES(13)'Number of blocks allocated (-1 if not
|
11977 |
|
|
available)
|
11978 |
|
|
|
11979 |
|
|
Not all these elements are relevant on all systems. If an element
|
11980 |
|
|
is not relevant, it is returned as 0.
|
11981 |
|
|
|
11982 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
11983 |
|
|
however, only one form can be used in any given program unit.
|
11984 |
|
|
|
11985 |
|
|
_Standard_:
|
11986 |
|
|
GNU extension
|
11987 |
|
|
|
11988 |
|
|
_Class_:
|
11989 |
|
|
Subroutine, function
|
11990 |
|
|
|
11991 |
|
|
_Syntax_:
|
11992 |
|
|
`CALL STAT(NAME, VALUES [, STATUS])'
|
11993 |
|
|
|
11994 |
|
|
_Arguments_:
|
11995 |
|
|
NAME The type shall be `CHARACTER', of the default
|
11996 |
|
|
kind and a valid path within the file system.
|
11997 |
|
|
VALUES The type shall be `INTEGER(4), DIMENSION(13)'.
|
11998 |
|
|
STATUS (Optional) status flag of type `INTEGER(4)'.
|
11999 |
|
|
Returns 0 on success and a system specific
|
12000 |
|
|
error code otherwise.
|
12001 |
|
|
|
12002 |
|
|
_Example_:
|
12003 |
|
|
PROGRAM test_stat
|
12004 |
|
|
INTEGER, DIMENSION(13) :: buff
|
12005 |
|
|
INTEGER :: status
|
12006 |
|
|
|
12007 |
|
|
CALL STAT("/etc/passwd", buff, status)
|
12008 |
|
|
|
12009 |
|
|
IF (status == 0) THEN
|
12010 |
|
|
WRITE (*, FMT="('Device ID:', T30, I19)") buff(1)
|
12011 |
|
|
WRITE (*, FMT="('Inode number:', T30, I19)") buff(2)
|
12012 |
|
|
WRITE (*, FMT="('File mode (octal):', T30, O19)") buff(3)
|
12013 |
|
|
WRITE (*, FMT="('Number of links:', T30, I19)") buff(4)
|
12014 |
|
|
WRITE (*, FMT="('Owner''s uid:', T30, I19)") buff(5)
|
12015 |
|
|
WRITE (*, FMT="('Owner''s gid:', T30, I19)") buff(6)
|
12016 |
|
|
WRITE (*, FMT="('Device where located:', T30, I19)") buff(7)
|
12017 |
|
|
WRITE (*, FMT="('File size:', T30, I19)") buff(8)
|
12018 |
|
|
WRITE (*, FMT="('Last access time:', T30, A19)") CTIME(buff(9))
|
12019 |
|
|
WRITE (*, FMT="('Last modification time', T30, A19)") CTIME(buff(10))
|
12020 |
|
|
WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11))
|
12021 |
|
|
WRITE (*, FMT="('Preferred block size:', T30, I19)") buff(12)
|
12022 |
|
|
WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13)
|
12023 |
|
|
END IF
|
12024 |
|
|
END PROGRAM
|
12025 |
|
|
|
12026 |
|
|
_See also_:
|
12027 |
|
|
To stat an open file: *note FSTAT::, to stat a link: *note LSTAT::
|
12028 |
|
|
|
12029 |
|
|
|
12030 |
|
|
File: gfortran.info, Node: SUM, Next: SYMLNK, Prev: STAT, Up: Intrinsic Procedures
|
12031 |
|
|
|
12032 |
|
|
8.207 `SUM' -- Sum of array elements
|
12033 |
|
|
====================================
|
12034 |
|
|
|
12035 |
|
|
_Description_:
|
12036 |
|
|
Adds the elements of ARRAY along dimension DIM if the
|
12037 |
|
|
corresponding element in MASK is `TRUE'.
|
12038 |
|
|
|
12039 |
|
|
_Standard_:
|
12040 |
|
|
Fortran 95 and later
|
12041 |
|
|
|
12042 |
|
|
_Class_:
|
12043 |
|
|
Transformational function
|
12044 |
|
|
|
12045 |
|
|
_Syntax_:
|
12046 |
|
|
`RESULT = SUM(ARRAY[, MASK])'
|
12047 |
|
|
`RESULT = SUM(ARRAY, DIM[, MASK])'
|
12048 |
|
|
|
12049 |
|
|
_Arguments_:
|
12050 |
|
|
ARRAY Shall be an array of type `INTEGER', `REAL' or
|
12051 |
|
|
`COMPLEX'.
|
12052 |
|
|
DIM (Optional) shall be a scalar of type `INTEGER'
|
12053 |
|
|
with a value in the range from 1 to n, where n
|
12054 |
|
|
equals the rank of ARRAY.
|
12055 |
|
|
MASK (Optional) shall be of type `LOGICAL' and
|
12056 |
|
|
either be a scalar or an array of the same
|
12057 |
|
|
shape as ARRAY.
|
12058 |
|
|
|
12059 |
|
|
_Return value_:
|
12060 |
|
|
The result is of the same type as ARRAY.
|
12061 |
|
|
|
12062 |
|
|
If DIM is absent, a scalar with the sum of all elements in ARRAY
|
12063 |
|
|
is returned. Otherwise, an array of rank n-1, where n equals the
|
12064 |
|
|
rank of ARRAY,and a shape similar to that of ARRAY with dimension
|
12065 |
|
|
DIM dropped is returned.
|
12066 |
|
|
|
12067 |
|
|
_Example_:
|
12068 |
|
|
PROGRAM test_sum
|
12069 |
|
|
INTEGER :: x(5) = (/ 1, 2, 3, 4 ,5 /)
|
12070 |
|
|
print *, SUM(x) ! all elements, sum = 15
|
12071 |
|
|
print *, SUM(x, MASK=MOD(x, 2)==1) ! odd elements, sum = 9
|
12072 |
|
|
END PROGRAM
|
12073 |
|
|
|
12074 |
|
|
_See also_:
|
12075 |
|
|
*note PRODUCT::
|
12076 |
|
|
|
12077 |
|
|
|
12078 |
|
|
File: gfortran.info, Node: SYMLNK, Next: SYSTEM, Prev: SUM, Up: Intrinsic Procedures
|
12079 |
|
|
|
12080 |
|
|
8.208 `SYMLNK' -- Create a symbolic link
|
12081 |
|
|
========================================
|
12082 |
|
|
|
12083 |
|
|
_Description_:
|
12084 |
|
|
Makes a symbolic link from file PATH1 to PATH2. A null character
|
12085 |
|
|
(`CHAR(0)') can be used to mark the end of the names in PATH1 and
|
12086 |
|
|
PATH2; otherwise, trailing blanks in the file names are ignored.
|
12087 |
|
|
If the STATUS argument is supplied, it contains 0 on success or a
|
12088 |
|
|
nonzero error code upon return; see `symlink(2)'. If the system
|
12089 |
|
|
does not supply `symlink(2)', `ENOSYS' is returned.
|
12090 |
|
|
|
12091 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
12092 |
|
|
however, only one form can be used in any given program unit.
|
12093 |
|
|
|
12094 |
|
|
_Standard_:
|
12095 |
|
|
GNU extension
|
12096 |
|
|
|
12097 |
|
|
_Class_:
|
12098 |
|
|
Subroutine, function
|
12099 |
|
|
|
12100 |
|
|
_Syntax_:
|
12101 |
|
|
`CALL SYMLNK(PATH1, PATH2 [, STATUS])'
|
12102 |
|
|
`STATUS = SYMLNK(PATH1, PATH2)'
|
12103 |
|
|
|
12104 |
|
|
_Arguments_:
|
12105 |
|
|
PATH1 Shall be of default `CHARACTER' type.
|
12106 |
|
|
PATH2 Shall be of default `CHARACTER' type.
|
12107 |
|
|
STATUS (Optional) Shall be of default `INTEGER' type.
|
12108 |
|
|
|
12109 |
|
|
_See also_:
|
12110 |
|
|
*note LINK::, *note UNLINK::
|
12111 |
|
|
|
12112 |
|
|
|
12113 |
|
|
|
12114 |
|
|
File: gfortran.info, Node: SYSTEM, Next: SYSTEM_CLOCK, Prev: SYMLNK, Up: Intrinsic Procedures
|
12115 |
|
|
|
12116 |
|
|
8.209 `SYSTEM' -- Execute a shell command
|
12117 |
|
|
=========================================
|
12118 |
|
|
|
12119 |
|
|
_Description_:
|
12120 |
|
|
Passes the command COMMAND to a shell (see `system(3)'). If
|
12121 |
|
|
argument STATUS is present, it contains the value returned by
|
12122 |
|
|
`system(3)', which is presumably 0 if the shell command succeeded.
|
12123 |
|
|
Note that which shell is used to invoke the command is
|
12124 |
|
|
system-dependent and environment-dependent.
|
12125 |
|
|
|
12126 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
12127 |
|
|
however, only one form can be used in any given program unit.
|
12128 |
|
|
|
12129 |
|
|
_Standard_:
|
12130 |
|
|
GNU extension
|
12131 |
|
|
|
12132 |
|
|
_Class_:
|
12133 |
|
|
Subroutine, function
|
12134 |
|
|
|
12135 |
|
|
_Syntax_:
|
12136 |
|
|
`CALL SYSTEM(COMMAND [, STATUS])'
|
12137 |
|
|
`STATUS = SYSTEM(COMMAND)'
|
12138 |
|
|
|
12139 |
|
|
_Arguments_:
|
12140 |
|
|
COMMAND Shall be of default `CHARACTER' type.
|
12141 |
|
|
STATUS (Optional) Shall be of default `INTEGER' type.
|
12142 |
|
|
|
12143 |
|
|
_See also_:
|
12144 |
|
|
|
12145 |
|
|
|
12146 |
|
|
File: gfortran.info, Node: SYSTEM_CLOCK, Next: TAN, Prev: SYSTEM, Up: Intrinsic Procedures
|
12147 |
|
|
|
12148 |
|
|
8.210 `SYSTEM_CLOCK' -- Time function
|
12149 |
|
|
=====================================
|
12150 |
|
|
|
12151 |
|
|
_Description_:
|
12152 |
|
|
Determines the COUNT of milliseconds of wall clock time since the
|
12153 |
|
|
Epoch (00:00:00 UTC, January 1, 1970) modulo COUNT_MAX, COUNT_RATE
|
12154 |
|
|
determines the number of clock ticks per second. COUNT_RATE and
|
12155 |
|
|
COUNT_MAX are constant and specific to `gfortran'.
|
12156 |
|
|
|
12157 |
|
|
If there is no clock, COUNT is set to `-HUGE(COUNT)', and
|
12158 |
|
|
COUNT_RATE and COUNT_MAX are set to zero
|
12159 |
|
|
|
12160 |
|
|
_Standard_:
|
12161 |
|
|
Fortran 95 and later
|
12162 |
|
|
|
12163 |
|
|
_Class_:
|
12164 |
|
|
Subroutine
|
12165 |
|
|
|
12166 |
|
|
_Syntax_:
|
12167 |
|
|
`CALL SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])'
|
12168 |
|
|
|
12169 |
|
|
_Arguments_:
|
12170 |
|
|
|
12171 |
|
|
_Arguments_:
|
12172 |
|
|
COUNT (Optional) shall be a scalar of type default
|
12173 |
|
|
`INTEGER' with `INTENT(OUT)'.
|
12174 |
|
|
COUNT_RATE (Optional) shall be a scalar of type default
|
12175 |
|
|
`INTEGER' with `INTENT(OUT)'.
|
12176 |
|
|
COUNT_MAX (Optional) shall be a scalar of type default
|
12177 |
|
|
`INTEGER' with `INTENT(OUT)'.
|
12178 |
|
|
|
12179 |
|
|
_Example_:
|
12180 |
|
|
PROGRAM test_system_clock
|
12181 |
|
|
INTEGER :: count, count_rate, count_max
|
12182 |
|
|
CALL SYSTEM_CLOCK(count, count_rate, count_max)
|
12183 |
|
|
WRITE(*,*) count, count_rate, count_max
|
12184 |
|
|
END PROGRAM
|
12185 |
|
|
|
12186 |
|
|
_See also_:
|
12187 |
|
|
*note DATE_AND_TIME::, *note CPU_TIME::
|
12188 |
|
|
|
12189 |
|
|
|
12190 |
|
|
File: gfortran.info, Node: TAN, Next: TANH, Prev: SYSTEM_CLOCK, Up: Intrinsic Procedures
|
12191 |
|
|
|
12192 |
|
|
8.211 `TAN' -- Tangent function
|
12193 |
|
|
===============================
|
12194 |
|
|
|
12195 |
|
|
_Description_:
|
12196 |
|
|
`TAN(X)' computes the tangent of X.
|
12197 |
|
|
|
12198 |
|
|
_Standard_:
|
12199 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
12200 |
|
|
|
12201 |
|
|
_Class_:
|
12202 |
|
|
Elemental function
|
12203 |
|
|
|
12204 |
|
|
_Syntax_:
|
12205 |
|
|
`RESULT = TAN(X)'
|
12206 |
|
|
|
12207 |
|
|
_Arguments_:
|
12208 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
12209 |
|
|
|
12210 |
|
|
_Return value_:
|
12211 |
|
|
The return value has same type and kind as X.
|
12212 |
|
|
|
12213 |
|
|
_Example_:
|
12214 |
|
|
program test_tan
|
12215 |
|
|
real(8) :: x = 0.165_8
|
12216 |
|
|
x = tan(x)
|
12217 |
|
|
end program test_tan
|
12218 |
|
|
|
12219 |
|
|
_Specific names_:
|
12220 |
|
|
Name Argument Return type Standard
|
12221 |
|
|
`DTAN(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
|
12222 |
|
|
later
|
12223 |
|
|
|
12224 |
|
|
_See also_:
|
12225 |
|
|
*note ATAN::
|
12226 |
|
|
|
12227 |
|
|
|
12228 |
|
|
File: gfortran.info, Node: TANH, Next: TIME, Prev: TAN, Up: Intrinsic Procedures
|
12229 |
|
|
|
12230 |
|
|
8.212 `TANH' -- Hyperbolic tangent function
|
12231 |
|
|
===========================================
|
12232 |
|
|
|
12233 |
|
|
_Description_:
|
12234 |
|
|
`TANH(X)' computes the hyperbolic tangent of X.
|
12235 |
|
|
|
12236 |
|
|
_Standard_:
|
12237 |
|
|
Fortran 77 and later, for a complex argument Fortran 2008 or later
|
12238 |
|
|
|
12239 |
|
|
_Class_:
|
12240 |
|
|
Elemental function
|
12241 |
|
|
|
12242 |
|
|
_Syntax_:
|
12243 |
|
|
`X = TANH(X)'
|
12244 |
|
|
|
12245 |
|
|
_Arguments_:
|
12246 |
|
|
X The type shall be `REAL' or `COMPLEX'.
|
12247 |
|
|
|
12248 |
|
|
_Return value_:
|
12249 |
|
|
The return value has same type and kind as X. If X is complex, the
|
12250 |
|
|
imaginary part of the result is in radians. If X is `REAL', the
|
12251 |
|
|
return value lies in the range - 1 \leq tanh(x) \leq 1 .
|
12252 |
|
|
|
12253 |
|
|
_Example_:
|
12254 |
|
|
program test_tanh
|
12255 |
|
|
real(8) :: x = 2.1_8
|
12256 |
|
|
x = tanh(x)
|
12257 |
|
|
end program test_tanh
|
12258 |
|
|
|
12259 |
|
|
_Specific names_:
|
12260 |
|
|
Name Argument Return type Standard
|
12261 |
|
|
`DTANH(X)' `REAL(8) X' `REAL(8)' Fortran 95 and
|
12262 |
|
|
later
|
12263 |
|
|
|
12264 |
|
|
_See also_:
|
12265 |
|
|
*note ATANH::
|
12266 |
|
|
|
12267 |
|
|
|
12268 |
|
|
File: gfortran.info, Node: TIME, Next: TIME8, Prev: TANH, Up: Intrinsic Procedures
|
12269 |
|
|
|
12270 |
|
|
8.213 `TIME' -- Time function
|
12271 |
|
|
=============================
|
12272 |
|
|
|
12273 |
|
|
_Description_:
|
12274 |
|
|
Returns the current time encoded as an integer (in the manner of
|
12275 |
|
|
the UNIX function `time(3)'). This value is suitable for passing to
|
12276 |
|
|
`CTIME()', `GMTIME()', and `LTIME()'.
|
12277 |
|
|
|
12278 |
|
|
This intrinsic is not fully portable, such as to systems with
|
12279 |
|
|
32-bit `INTEGER' types but supporting times wider than 32 bits.
|
12280 |
|
|
Therefore, the values returned by this intrinsic might be, or
|
12281 |
|
|
become, negative, or numerically less than previous values, during
|
12282 |
|
|
a single run of the compiled program.
|
12283 |
|
|
|
12284 |
|
|
See *note TIME8::, for information on a similar intrinsic that
|
12285 |
|
|
might be portable to more GNU Fortran implementations, though to
|
12286 |
|
|
fewer Fortran compilers.
|
12287 |
|
|
|
12288 |
|
|
_Standard_:
|
12289 |
|
|
GNU extension
|
12290 |
|
|
|
12291 |
|
|
_Class_:
|
12292 |
|
|
Function
|
12293 |
|
|
|
12294 |
|
|
_Syntax_:
|
12295 |
|
|
`RESULT = TIME()'
|
12296 |
|
|
|
12297 |
|
|
_Return value_:
|
12298 |
|
|
The return value is a scalar of type `INTEGER(4)'.
|
12299 |
|
|
|
12300 |
|
|
_See also_:
|
12301 |
|
|
*note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::,
|
12302 |
|
|
*note TIME8::
|
12303 |
|
|
|
12304 |
|
|
|
12305 |
|
|
|
12306 |
|
|
File: gfortran.info, Node: TIME8, Next: TINY, Prev: TIME, Up: Intrinsic Procedures
|
12307 |
|
|
|
12308 |
|
|
8.214 `TIME8' -- Time function (64-bit)
|
12309 |
|
|
=======================================
|
12310 |
|
|
|
12311 |
|
|
_Description_:
|
12312 |
|
|
Returns the current time encoded as an integer (in the manner of
|
12313 |
|
|
the UNIX function `time(3)'). This value is suitable for passing to
|
12314 |
|
|
`CTIME()', `GMTIME()', and `LTIME()'.
|
12315 |
|
|
|
12316 |
|
|
_Warning:_ this intrinsic does not increase the range of the timing
|
12317 |
|
|
values over that returned by `time(3)'. On a system with a 32-bit
|
12318 |
|
|
`time(3)', `TIME8()' will return a 32-bit value, even though it is
|
12319 |
|
|
converted to a 64-bit `INTEGER(8)' value. That means overflows of
|
12320 |
|
|
the 32-bit value can still occur. Therefore, the values returned
|
12321 |
|
|
by this intrinsic might be or become negative or numerically less
|
12322 |
|
|
than previous values during a single run of the compiled program.
|
12323 |
|
|
|
12324 |
|
|
_Standard_:
|
12325 |
|
|
GNU extension
|
12326 |
|
|
|
12327 |
|
|
_Class_:
|
12328 |
|
|
Function
|
12329 |
|
|
|
12330 |
|
|
_Syntax_:
|
12331 |
|
|
`RESULT = TIME8()'
|
12332 |
|
|
|
12333 |
|
|
_Return value_:
|
12334 |
|
|
The return value is a scalar of type `INTEGER(8)'.
|
12335 |
|
|
|
12336 |
|
|
_See also_:
|
12337 |
|
|
*note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK8::,
|
12338 |
|
|
*note TIME::
|
12339 |
|
|
|
12340 |
|
|
|
12341 |
|
|
|
12342 |
|
|
File: gfortran.info, Node: TINY, Next: TRAILZ, Prev: TIME8, Up: Intrinsic Procedures
|
12343 |
|
|
|
12344 |
|
|
8.215 `TINY' -- Smallest positive number of a real kind
|
12345 |
|
|
=======================================================
|
12346 |
|
|
|
12347 |
|
|
_Description_:
|
12348 |
|
|
`TINY(X)' returns the smallest positive (non zero) number in the
|
12349 |
|
|
model of the type of `X'.
|
12350 |
|
|
|
12351 |
|
|
_Standard_:
|
12352 |
|
|
Fortran 95 and later
|
12353 |
|
|
|
12354 |
|
|
_Class_:
|
12355 |
|
|
Inquiry function
|
12356 |
|
|
|
12357 |
|
|
_Syntax_:
|
12358 |
|
|
`RESULT = TINY(X)'
|
12359 |
|
|
|
12360 |
|
|
_Arguments_:
|
12361 |
|
|
X Shall be of type `REAL'.
|
12362 |
|
|
|
12363 |
|
|
_Return value_:
|
12364 |
|
|
The return value is of the same type and kind as X
|
12365 |
|
|
|
12366 |
|
|
_Example_:
|
12367 |
|
|
See `HUGE' for an example.
|
12368 |
|
|
|
12369 |
|
|
|
12370 |
|
|
File: gfortran.info, Node: TRAILZ, Next: TRANSFER, Prev: TINY, Up: Intrinsic Procedures
|
12371 |
|
|
|
12372 |
|
|
8.216 `TRAILZ' -- Number of trailing zero bits of an integer
|
12373 |
|
|
============================================================
|
12374 |
|
|
|
12375 |
|
|
_Description_:
|
12376 |
|
|
`TRAILZ' returns the number of trailing zero bits of an integer.
|
12377 |
|
|
|
12378 |
|
|
_Standard_:
|
12379 |
|
|
Fortran 2008 and later
|
12380 |
|
|
|
12381 |
|
|
_Class_:
|
12382 |
|
|
Elemental function
|
12383 |
|
|
|
12384 |
|
|
_Syntax_:
|
12385 |
|
|
`RESULT = TRAILZ(I)'
|
12386 |
|
|
|
12387 |
|
|
_Arguments_:
|
12388 |
|
|
I Shall be of type `INTEGER'.
|
12389 |
|
|
|
12390 |
|
|
_Return value_:
|
12391 |
|
|
The type of the return value is the default `INTEGER'. If all the
|
12392 |
|
|
bits of `I' are zero, the result value is `BIT_SIZE(I)'.
|
12393 |
|
|
|
12394 |
|
|
_Example_:
|
12395 |
|
|
PROGRAM test_trailz
|
12396 |
|
|
WRITE (*,*) TRAILZ(8) ! prints 3
|
12397 |
|
|
END PROGRAM
|
12398 |
|
|
|
12399 |
|
|
_See also_:
|
12400 |
|
|
*note BIT_SIZE::, *note LEADZ::
|
12401 |
|
|
|
12402 |
|
|
|
12403 |
|
|
File: gfortran.info, Node: TRANSFER, Next: TRANSPOSE, Prev: TRAILZ, Up: Intrinsic Procedures
|
12404 |
|
|
|
12405 |
|
|
8.217 `TRANSFER' -- Transfer bit patterns
|
12406 |
|
|
=========================================
|
12407 |
|
|
|
12408 |
|
|
_Description_:
|
12409 |
|
|
Interprets the bitwise representation of SOURCE in memory as if it
|
12410 |
|
|
is the representation of a variable or array of the same type and
|
12411 |
|
|
type parameters as MOLD.
|
12412 |
|
|
|
12413 |
|
|
This is approximately equivalent to the C concept of _casting_ one
|
12414 |
|
|
type to another.
|
12415 |
|
|
|
12416 |
|
|
_Standard_:
|
12417 |
|
|
Fortran 95 and later
|
12418 |
|
|
|
12419 |
|
|
_Class_:
|
12420 |
|
|
Transformational function
|
12421 |
|
|
|
12422 |
|
|
_Syntax_:
|
12423 |
|
|
`RESULT = TRANSFER(SOURCE, MOLD[, SIZE])'
|
12424 |
|
|
|
12425 |
|
|
_Arguments_:
|
12426 |
|
|
SOURCE Shall be a scalar or an array of any type.
|
12427 |
|
|
MOLD Shall be a scalar or an array of any type.
|
12428 |
|
|
SIZE (Optional) shall be a scalar of type `INTEGER'.
|
12429 |
|
|
|
12430 |
|
|
_Return value_:
|
12431 |
|
|
The result has the same type as MOLD, with the bit level
|
12432 |
|
|
representation of SOURCE. If SIZE is present, the result is a
|
12433 |
|
|
one-dimensional array of length SIZE. If SIZE is absent but MOLD
|
12434 |
|
|
is an array (of any size or shape), the result is a one-
|
12435 |
|
|
dimensional array of the minimum length needed to contain the
|
12436 |
|
|
entirety of the bitwise representation of SOURCE. If SIZE is
|
12437 |
|
|
absent and MOLD is a scalar, the result is a scalar.
|
12438 |
|
|
|
12439 |
|
|
If the bitwise representation of the result is longer than that of
|
12440 |
|
|
SOURCE, then the leading bits of the result correspond to those of
|
12441 |
|
|
SOURCE and any trailing bits are filled arbitrarily.
|
12442 |
|
|
|
12443 |
|
|
When the resulting bit representation does not correspond to a
|
12444 |
|
|
valid representation of a variable of the same type as MOLD, the
|
12445 |
|
|
results are undefined, and subsequent operations on the result
|
12446 |
|
|
cannot be guaranteed to produce sensible behavior. For example,
|
12447 |
|
|
it is possible to create `LOGICAL' variables for which `VAR' and
|
12448 |
|
|
`.NOT.VAR' both appear to be true.
|
12449 |
|
|
|
12450 |
|
|
_Example_:
|
12451 |
|
|
PROGRAM test_transfer
|
12452 |
|
|
integer :: x = 2143289344
|
12453 |
|
|
print *, transfer(x, 1.0) ! prints "NaN" on i686
|
12454 |
|
|
END PROGRAM
|
12455 |
|
|
|
12456 |
|
|
|
12457 |
|
|
File: gfortran.info, Node: TRANSPOSE, Next: TRIM, Prev: TRANSFER, Up: Intrinsic Procedures
|
12458 |
|
|
|
12459 |
|
|
8.218 `TRANSPOSE' -- Transpose an array of rank two
|
12460 |
|
|
===================================================
|
12461 |
|
|
|
12462 |
|
|
_Description_:
|
12463 |
|
|
Transpose an array of rank two. Element (i, j) of the result has
|
12464 |
|
|
the value `MATRIX(j, i)', for all i, j.
|
12465 |
|
|
|
12466 |
|
|
_Standard_:
|
12467 |
|
|
Fortran 95 and later
|
12468 |
|
|
|
12469 |
|
|
_Class_:
|
12470 |
|
|
Transformational function
|
12471 |
|
|
|
12472 |
|
|
_Syntax_:
|
12473 |
|
|
`RESULT = TRANSPOSE(MATRIX)'
|
12474 |
|
|
|
12475 |
|
|
_Arguments_:
|
12476 |
|
|
MATRIX Shall be an array of any type and have a rank
|
12477 |
|
|
of two.
|
12478 |
|
|
|
12479 |
|
|
_Return value_:
|
12480 |
|
|
The result has the same type as MATRIX, and has shape `(/ m, n /)'
|
12481 |
|
|
if MATRIX has shape `(/ n, m /)'.
|
12482 |
|
|
|
12483 |
|
|
|
12484 |
|
|
File: gfortran.info, Node: TRIM, Next: TTYNAM, Prev: TRANSPOSE, Up: Intrinsic Procedures
|
12485 |
|
|
|
12486 |
|
|
8.219 `TRIM' -- Remove trailing blank characters of a string
|
12487 |
|
|
============================================================
|
12488 |
|
|
|
12489 |
|
|
_Description_:
|
12490 |
|
|
Removes trailing blank characters of a string.
|
12491 |
|
|
|
12492 |
|
|
_Standard_:
|
12493 |
|
|
Fortran 95 and later
|
12494 |
|
|
|
12495 |
|
|
_Class_:
|
12496 |
|
|
Transformational function
|
12497 |
|
|
|
12498 |
|
|
_Syntax_:
|
12499 |
|
|
`RESULT = TRIM(STRING)'
|
12500 |
|
|
|
12501 |
|
|
_Arguments_:
|
12502 |
|
|
STRING Shall be a scalar of type `CHARACTER'.
|
12503 |
|
|
|
12504 |
|
|
_Return value_:
|
12505 |
|
|
A scalar of type `CHARACTER' which length is that of STRING less
|
12506 |
|
|
the number of trailing blanks.
|
12507 |
|
|
|
12508 |
|
|
_Example_:
|
12509 |
|
|
PROGRAM test_trim
|
12510 |
|
|
CHARACTER(len=10), PARAMETER :: s = "GFORTRAN "
|
12511 |
|
|
WRITE(*,*) LEN(s), LEN(TRIM(s)) ! "10 8", with/without trailing blanks
|
12512 |
|
|
END PROGRAM
|
12513 |
|
|
|
12514 |
|
|
_See also_:
|
12515 |
|
|
*note ADJUSTL::, *note ADJUSTR::
|
12516 |
|
|
|
12517 |
|
|
|
12518 |
|
|
File: gfortran.info, Node: TTYNAM, Next: UBOUND, Prev: TRIM, Up: Intrinsic Procedures
|
12519 |
|
|
|
12520 |
|
|
8.220 `TTYNAM' -- Get the name of a terminal device.
|
12521 |
|
|
====================================================
|
12522 |
|
|
|
12523 |
|
|
_Description_:
|
12524 |
|
|
Get the name of a terminal device. For more information, see
|
12525 |
|
|
`ttyname(3)'.
|
12526 |
|
|
|
12527 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
12528 |
|
|
however, only one form can be used in any given program unit.
|
12529 |
|
|
|
12530 |
|
|
_Standard_:
|
12531 |
|
|
GNU extension
|
12532 |
|
|
|
12533 |
|
|
_Class_:
|
12534 |
|
|
Subroutine, function
|
12535 |
|
|
|
12536 |
|
|
_Syntax_:
|
12537 |
|
|
`CALL TTYNAM(UNIT, NAME)'
|
12538 |
|
|
`NAME = TTYNAM(UNIT)'
|
12539 |
|
|
|
12540 |
|
|
_Arguments_:
|
12541 |
|
|
UNIT Shall be a scalar `INTEGER'.
|
12542 |
|
|
NAME Shall be of type `CHARACTER'.
|
12543 |
|
|
|
12544 |
|
|
_Example_:
|
12545 |
|
|
PROGRAM test_ttynam
|
12546 |
|
|
INTEGER :: unit
|
12547 |
|
|
DO unit = 1, 10
|
12548 |
|
|
IF (isatty(unit=unit)) write(*,*) ttynam(unit)
|
12549 |
|
|
END DO
|
12550 |
|
|
END PROGRAM
|
12551 |
|
|
|
12552 |
|
|
_See also_:
|
12553 |
|
|
*note ISATTY::
|
12554 |
|
|
|
12555 |
|
|
|
12556 |
|
|
File: gfortran.info, Node: UBOUND, Next: UMASK, Prev: TTYNAM, Up: Intrinsic Procedures
|
12557 |
|
|
|
12558 |
|
|
8.221 `UBOUND' -- Upper dimension bounds of an array
|
12559 |
|
|
====================================================
|
12560 |
|
|
|
12561 |
|
|
_Description_:
|
12562 |
|
|
Returns the upper bounds of an array, or a single upper bound
|
12563 |
|
|
along the DIM dimension.
|
12564 |
|
|
|
12565 |
|
|
_Standard_:
|
12566 |
|
|
Fortran 95 and later, with KIND argument Fortran 2003 and later
|
12567 |
|
|
|
12568 |
|
|
_Class_:
|
12569 |
|
|
Inquiry function
|
12570 |
|
|
|
12571 |
|
|
_Syntax_:
|
12572 |
|
|
`RESULT = UBOUND(ARRAY [, DIM [, KIND]])'
|
12573 |
|
|
|
12574 |
|
|
_Arguments_:
|
12575 |
|
|
ARRAY Shall be an array, of any type.
|
12576 |
|
|
DIM (Optional) Shall be a scalar `INTEGER'.
|
12577 |
|
|
KIND (Optional) An `INTEGER' initialization
|
12578 |
|
|
expression indicating the kind parameter of
|
12579 |
|
|
the result.
|
12580 |
|
|
|
12581 |
|
|
_Return value_:
|
12582 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
12583 |
|
|
absent, the return value is of default integer kind. If DIM is
|
12584 |
|
|
absent, the result is an array of the upper bounds of ARRAY. If
|
12585 |
|
|
DIM is present, the result is a scalar corresponding to the upper
|
12586 |
|
|
bound of the array along that dimension. If ARRAY is an
|
12587 |
|
|
expression rather than a whole array or array structure component,
|
12588 |
|
|
or if it has a zero extent along the relevant dimension, the upper
|
12589 |
|
|
bound is taken to be the number of elements along the relevant
|
12590 |
|
|
dimension.
|
12591 |
|
|
|
12592 |
|
|
_See also_:
|
12593 |
|
|
*note LBOUND::
|
12594 |
|
|
|
12595 |
|
|
|
12596 |
|
|
File: gfortran.info, Node: UMASK, Next: UNLINK, Prev: UBOUND, Up: Intrinsic Procedures
|
12597 |
|
|
|
12598 |
|
|
8.222 `UMASK' -- Set the file creation mask
|
12599 |
|
|
===========================================
|
12600 |
|
|
|
12601 |
|
|
_Description_:
|
12602 |
|
|
Sets the file creation mask to MASK. If called as a function, it
|
12603 |
|
|
returns the old value. If called as a subroutine and argument OLD
|
12604 |
|
|
if it is supplied, it is set to the old value. See `umask(2)'.
|
12605 |
|
|
|
12606 |
|
|
_Standard_:
|
12607 |
|
|
GNU extension
|
12608 |
|
|
|
12609 |
|
|
_Class_:
|
12610 |
|
|
Subroutine, function
|
12611 |
|
|
|
12612 |
|
|
_Syntax_:
|
12613 |
|
|
`CALL UMASK(MASK [, OLD])' `OLD = UMASK(MASK)'
|
12614 |
|
|
|
12615 |
|
|
_Arguments_:
|
12616 |
|
|
MASK Shall be a scalar of type `INTEGER'.
|
12617 |
|
|
OLD (Optional) Shall be a scalar of type `INTEGER'.
|
12618 |
|
|
|
12619 |
|
|
|
12620 |
|
|
|
12621 |
|
|
File: gfortran.info, Node: UNLINK, Next: UNPACK, Prev: UMASK, Up: Intrinsic Procedures
|
12622 |
|
|
|
12623 |
|
|
8.223 `UNLINK' -- Remove a file from the file system
|
12624 |
|
|
====================================================
|
12625 |
|
|
|
12626 |
|
|
_Description_:
|
12627 |
|
|
Unlinks the file PATH. A null character (`CHAR(0)') can be used to
|
12628 |
|
|
mark the end of the name in PATH; otherwise, trailing blanks in
|
12629 |
|
|
the file name are ignored. If the STATUS argument is supplied, it
|
12630 |
|
|
contains 0 on success or a nonzero error code upon return; see
|
12631 |
|
|
`unlink(2)'.
|
12632 |
|
|
|
12633 |
|
|
This intrinsic is provided in both subroutine and function forms;
|
12634 |
|
|
however, only one form can be used in any given program unit.
|
12635 |
|
|
|
12636 |
|
|
_Standard_:
|
12637 |
|
|
GNU extension
|
12638 |
|
|
|
12639 |
|
|
_Class_:
|
12640 |
|
|
Subroutine, function
|
12641 |
|
|
|
12642 |
|
|
_Syntax_:
|
12643 |
|
|
`CALL UNLINK(PATH [, STATUS])'
|
12644 |
|
|
`STATUS = UNLINK(PATH)'
|
12645 |
|
|
|
12646 |
|
|
_Arguments_:
|
12647 |
|
|
PATH Shall be of default `CHARACTER' type.
|
12648 |
|
|
STATUS (Optional) Shall be of default `INTEGER' type.
|
12649 |
|
|
|
12650 |
|
|
_See also_:
|
12651 |
|
|
*note LINK::, *note SYMLNK::
|
12652 |
|
|
|
12653 |
|
|
|
12654 |
|
|
File: gfortran.info, Node: UNPACK, Next: VERIFY, Prev: UNLINK, Up: Intrinsic Procedures
|
12655 |
|
|
|
12656 |
|
|
8.224 `UNPACK' -- Unpack an array of rank one into an array
|
12657 |
|
|
===========================================================
|
12658 |
|
|
|
12659 |
|
|
_Description_:
|
12660 |
|
|
Store the elements of VECTOR in an array of higher rank.
|
12661 |
|
|
|
12662 |
|
|
_Standard_:
|
12663 |
|
|
Fortran 95 and later
|
12664 |
|
|
|
12665 |
|
|
_Class_:
|
12666 |
|
|
Transformational function
|
12667 |
|
|
|
12668 |
|
|
_Syntax_:
|
12669 |
|
|
`RESULT = UNPACK(VECTOR, MASK, FIELD)'
|
12670 |
|
|
|
12671 |
|
|
_Arguments_:
|
12672 |
|
|
VECTOR Shall be an array of any type and rank one. It
|
12673 |
|
|
shall have at least as many elements as MASK
|
12674 |
|
|
has `TRUE' values.
|
12675 |
|
|
MASK Shall be an array of type `LOGICAL'.
|
12676 |
|
|
FIELD Shall be of the same type as VECTOR and have
|
12677 |
|
|
the same shape as MASK.
|
12678 |
|
|
|
12679 |
|
|
_Return value_:
|
12680 |
|
|
The resulting array corresponds to FIELD with `TRUE' elements of
|
12681 |
|
|
MASK replaced by values from VECTOR in array element order.
|
12682 |
|
|
|
12683 |
|
|
_Example_:
|
12684 |
|
|
PROGRAM test_unpack
|
12685 |
|
|
integer :: vector(2) = (/1,1/)
|
12686 |
|
|
logical :: mask(4) = (/ .TRUE., .FALSE., .FALSE., .TRUE. /)
|
12687 |
|
|
integer :: field(2,2) = 0, unity(2,2)
|
12688 |
|
|
|
12689 |
|
|
! result: unity matrix
|
12690 |
|
|
unity = unpack(vector, reshape(mask, (/2,2/)), field)
|
12691 |
|
|
END PROGRAM
|
12692 |
|
|
|
12693 |
|
|
_See also_:
|
12694 |
|
|
*note PACK::, *note SPREAD::
|
12695 |
|
|
|
12696 |
|
|
|
12697 |
|
|
File: gfortran.info, Node: VERIFY, Next: XOR, Prev: UNPACK, Up: Intrinsic Procedures
|
12698 |
|
|
|
12699 |
|
|
8.225 `VERIFY' -- Scan a string for the absence of a set of characters
|
12700 |
|
|
======================================================================
|
12701 |
|
|
|
12702 |
|
|
_Description_:
|
12703 |
|
|
Verifies that all the characters in a SET are present in a STRING.
|
12704 |
|
|
|
12705 |
|
|
If BACK is either absent or equals `FALSE', this function returns
|
12706 |
|
|
the position of the leftmost character of STRING that is not in
|
12707 |
|
|
SET. If BACK equals `TRUE', the rightmost position is returned. If
|
12708 |
|
|
all characters of SET are found in STRING, the result is zero.
|
12709 |
|
|
|
12710 |
|
|
_Standard_:
|
12711 |
|
|
Fortran 95 and later, with KIND argument Fortran 2003 and later
|
12712 |
|
|
|
12713 |
|
|
_Class_:
|
12714 |
|
|
Elemental function
|
12715 |
|
|
|
12716 |
|
|
_Syntax_:
|
12717 |
|
|
`RESULT = VERIFY(STRING, SET[, BACK [, KIND]])'
|
12718 |
|
|
|
12719 |
|
|
_Arguments_:
|
12720 |
|
|
STRING Shall be of type `CHARACTER'.
|
12721 |
|
|
SET Shall be of type `CHARACTER'.
|
12722 |
|
|
BACK (Optional) shall be of type `LOGICAL'.
|
12723 |
|
|
KIND (Optional) An `INTEGER' initialization
|
12724 |
|
|
expression indicating the kind parameter of
|
12725 |
|
|
the result.
|
12726 |
|
|
|
12727 |
|
|
_Return value_:
|
12728 |
|
|
The return value is of type `INTEGER' and of kind KIND. If KIND is
|
12729 |
|
|
absent, the return value is of default integer kind.
|
12730 |
|
|
|
12731 |
|
|
_Example_:
|
12732 |
|
|
PROGRAM test_verify
|
12733 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "AO") ! 1, found 'F'
|
12734 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "FOO") ! 3, found 'R'
|
12735 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "C++") ! 1, found 'F'
|
12736 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "C++", .TRUE.) ! 7, found 'N'
|
12737 |
|
|
WRITE(*,*) VERIFY("FORTRAN", "FORTRAN") ! 0' found none
|
12738 |
|
|
END PROGRAM
|
12739 |
|
|
|
12740 |
|
|
_See also_:
|
12741 |
|
|
*note SCAN::, *note INDEX intrinsic::
|
12742 |
|
|
|
12743 |
|
|
|
12744 |
|
|
File: gfortran.info, Node: XOR, Prev: VERIFY, Up: Intrinsic Procedures
|
12745 |
|
|
|
12746 |
|
|
8.226 `XOR' -- Bitwise logical exclusive OR
|
12747 |
|
|
===========================================
|
12748 |
|
|
|
12749 |
|
|
_Description_:
|
12750 |
|
|
Bitwise logical exclusive or.
|
12751 |
|
|
|
12752 |
|
|
This intrinsic routine is provided for backwards compatibility with
|
12753 |
|
|
GNU Fortran 77. For integer arguments, programmers should consider
|
12754 |
|
|
the use of the *note IEOR:: intrinsic and for logical arguments the
|
12755 |
|
|
`.NEQV.' operator, which are both defined by the Fortran standard.
|
12756 |
|
|
|
12757 |
|
|
_Standard_:
|
12758 |
|
|
GNU extension
|
12759 |
|
|
|
12760 |
|
|
_Class_:
|
12761 |
|
|
Function
|
12762 |
|
|
|
12763 |
|
|
_Syntax_:
|
12764 |
|
|
`RESULT = XOR(I, J)'
|
12765 |
|
|
|
12766 |
|
|
_Arguments_:
|
12767 |
|
|
I The type shall be either a scalar `INTEGER'
|
12768 |
|
|
type or a scalar `LOGICAL' type.
|
12769 |
|
|
J The type shall be the same as the type of I.
|
12770 |
|
|
|
12771 |
|
|
_Return value_:
|
12772 |
|
|
The return type is either a scalar `INTEGER' or a scalar
|
12773 |
|
|
`LOGICAL'. If the kind type parameters differ, then the smaller
|
12774 |
|
|
kind type is implicitly converted to larger kind, and the return
|
12775 |
|
|
has the larger kind.
|
12776 |
|
|
|
12777 |
|
|
_Example_:
|
12778 |
|
|
PROGRAM test_xor
|
12779 |
|
|
LOGICAL :: T = .TRUE., F = .FALSE.
|
12780 |
|
|
INTEGER :: a, b
|
12781 |
|
|
DATA a / Z'F' /, b / Z'3' /
|
12782 |
|
|
|
12783 |
|
|
WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F)
|
12784 |
|
|
WRITE (*,*) XOR(a, b)
|
12785 |
|
|
END PROGRAM
|
12786 |
|
|
|
12787 |
|
|
_See also_:
|
12788 |
|
|
Fortran 95 elemental function: *note IEOR::
|
12789 |
|
|
|
12790 |
|
|
|
12791 |
|
|
File: gfortran.info, Node: Intrinsic Modules, Next: Contributing, Prev: Intrinsic Procedures, Up: Top
|
12792 |
|
|
|
12793 |
|
|
9 Intrinsic Modules
|
12794 |
|
|
*******************
|
12795 |
|
|
|
12796 |
|
|
* Menu:
|
12797 |
|
|
|
12798 |
|
|
* ISO_FORTRAN_ENV::
|
12799 |
|
|
* ISO_C_BINDING::
|
12800 |
|
|
* OpenMP Modules OMP_LIB and OMP_LIB_KINDS::
|
12801 |
|
|
|
12802 |
|
|
|
12803 |
|
|
File: gfortran.info, Node: ISO_FORTRAN_ENV, Next: ISO_C_BINDING, Up: Intrinsic Modules
|
12804 |
|
|
|
12805 |
|
|
9.1 `ISO_FORTRAN_ENV'
|
12806 |
|
|
=====================
|
12807 |
|
|
|
12808 |
|
|
_Standard_:
|
12809 |
|
|
Fortran 2003 and later; `INT8', `INT16', `INT32', `INT64',
|
12810 |
|
|
`REAL32', `REAL64', `REAL128' are Fortran 2008 or later
|
12811 |
|
|
|
12812 |
|
|
The `ISO_FORTRAN_ENV' module provides the following scalar
|
12813 |
|
|
default-integer named constants:
|
12814 |
|
|
|
12815 |
|
|
`CHARACTER_STORAGE_SIZE':
|
12816 |
|
|
Size in bits of the character storage unit.
|
12817 |
|
|
|
12818 |
|
|
`ERROR_UNIT':
|
12819 |
|
|
Identifies the preconnected unit used for error reporting.
|
12820 |
|
|
|
12821 |
|
|
`FILE_STORAGE_SIZE':
|
12822 |
|
|
Size in bits of the file-storage unit.
|
12823 |
|
|
|
12824 |
|
|
`INPUT_UNIT':
|
12825 |
|
|
Identifies the preconnected unit identified by the asterisk (`*')
|
12826 |
|
|
in `READ' statement.
|
12827 |
|
|
|
12828 |
|
|
`INT8', `INT16', `INT32', `INT64'
|
12829 |
|
|
Kind type parameters to specify an INTEGER type with a storage
|
12830 |
|
|
size of 16, 32, and 64 bits. It is negative if a target platform
|
12831 |
|
|
does not support the particular kind.
|
12832 |
|
|
|
12833 |
|
|
`IOSTAT_END':
|
12834 |
|
|
The value assigned to the variable passed to the IOSTAT= specifier
|
12835 |
|
|
of an input/output statement if an end-of-file condition occurred.
|
12836 |
|
|
|
12837 |
|
|
`IOSTAT_EOR':
|
12838 |
|
|
The value assigned to the variable passed to the IOSTAT= specifier
|
12839 |
|
|
of an input/output statement if an end-of-record condition
|
12840 |
|
|
occurred.
|
12841 |
|
|
|
12842 |
|
|
`NUMERIC_STORAGE_SIZE':
|
12843 |
|
|
The size in bits of the numeric storage unit.
|
12844 |
|
|
|
12845 |
|
|
`OUTPUT_UNIT':
|
12846 |
|
|
Identifies the preconnected unit identified by the asterisk (`*')
|
12847 |
|
|
in `WRITE' statement.
|
12848 |
|
|
|
12849 |
|
|
`REAL32', `REAL64', `REAL128'
|
12850 |
|
|
Kind type parameters to specify a REAL type with a storage size of
|
12851 |
|
|
32, 64, and 128 bits. It is negative if a target platform does not
|
12852 |
|
|
support the particular kind.
|
12853 |
|
|
|
12854 |
|
|
|
12855 |
|
|
File: gfortran.info, Node: ISO_C_BINDING, Next: OpenMP Modules OMP_LIB and OMP_LIB_KINDS, Prev: ISO_FORTRAN_ENV, Up: Intrinsic Modules
|
12856 |
|
|
|
12857 |
|
|
9.2 `ISO_C_BINDING'
|
12858 |
|
|
===================
|
12859 |
|
|
|
12860 |
|
|
_Standard_:
|
12861 |
|
|
Fortran 2003 and later, GNU extensions
|
12862 |
|
|
|
12863 |
|
|
The following intrinsic procedures are provided by the module; their
|
12864 |
|
|
definition can be found in the section Intrinsic Procedures of this
|
12865 |
|
|
manual.
|
12866 |
|
|
|
12867 |
|
|
`C_ASSOCIATED'
|
12868 |
|
|
|
12869 |
|
|
`C_F_POINTER'
|
12870 |
|
|
|
12871 |
|
|
`C_F_PROCPOINTER'
|
12872 |
|
|
|
12873 |
|
|
`C_FUNLOC'
|
12874 |
|
|
|
12875 |
|
|
`C_LOC'
|
12876 |
|
|
|
12877 |
|
|
The `ISO_C_BINDING' module provides the following named constants of
|
12878 |
|
|
type default integer, which can be used as KIND type parameters.
|
12879 |
|
|
|
12880 |
|
|
In addition to the integer named constants required by the Fortran
|
12881 |
|
|
2003 standard, GNU Fortran provides as an extension named constants for
|
12882 |
|
|
the 128-bit integer types supported by the C compiler: `C_INT128_T,
|
12883 |
|
|
C_INT_LEAST128_T, C_INT_FAST128_T'.
|
12884 |
|
|
|
12885 |
|
|
Fortran Named constant C type Extension
|
12886 |
|
|
Type
|
12887 |
|
|
`INTEGER' `C_INT' `int'
|
12888 |
|
|
`INTEGER' `C_SHORT' `short int'
|
12889 |
|
|
`INTEGER' `C_LONG' `long int'
|
12890 |
|
|
`INTEGER' `C_LONG_LONG' `long long int'
|
12891 |
|
|
`INTEGER' `C_SIGNED_CHAR' `signed char'/`unsigned
|
12892 |
|
|
char'
|
12893 |
|
|
`INTEGER' `C_SIZE_T' `size_t'
|
12894 |
|
|
`INTEGER' `C_INT8_T' `int8_t'
|
12895 |
|
|
`INTEGER' `C_INT16_T' `int16_t'
|
12896 |
|
|
`INTEGER' `C_INT32_T' `int32_t'
|
12897 |
|
|
`INTEGER' `C_INT64_T' `int64_t'
|
12898 |
|
|
`INTEGER' `C_INT128_T' `int128_t' Ext.
|
12899 |
|
|
`INTEGER' `C_INT_LEAST8_T' `int_least8_t'
|
12900 |
|
|
`INTEGER' `C_INT_LEAST16_T' `int_least16_t'
|
12901 |
|
|
`INTEGER' `C_INT_LEAST32_T' `int_least32_t'
|
12902 |
|
|
`INTEGER' `C_INT_LEAST64_T' `int_least64_t'
|
12903 |
|
|
`INTEGER' `C_INT_LEAST128_T' `int_least128_t' Ext.
|
12904 |
|
|
`INTEGER' `C_INT_FAST8_T' `int_fast8_t'
|
12905 |
|
|
`INTEGER' `C_INT_FAST16_T' `int_fast16_t'
|
12906 |
|
|
`INTEGER' `C_INT_FAST32_T' `int_fast32_t'
|
12907 |
|
|
`INTEGER' `C_INT_FAST64_T' `int_fast64_t'
|
12908 |
|
|
`INTEGER' `C_INT_FAST128_T' `int_fast128_t' Ext.
|
12909 |
|
|
`INTEGER' `C_INTMAX_T' `intmax_t'
|
12910 |
|
|
`INTEGER' `C_INTPTR_T' `intptr_t'
|
12911 |
|
|
`REAL' `C_FLOAT' `float'
|
12912 |
|
|
`REAL' `C_DOUBLE' `double'
|
12913 |
|
|
`REAL' `C_LONG_DOUBLE' `long double'
|
12914 |
|
|
`COMPLEX' `C_FLOAT_COMPLEX' `float _Complex'
|
12915 |
|
|
`COMPLEX' `C_DOUBLE_COMPLEX' `double _Complex'
|
12916 |
|
|
`COMPLEX' `C_LONG_DOUBLE_COMPLEX' `long double _Complex'
|
12917 |
|
|
`LOGICAL' `C_BOOL' `_Bool'
|
12918 |
|
|
`CHARACTER' `C_CHAR' `char'
|
12919 |
|
|
|
12920 |
|
|
Additionally, the following parameters of type
|
12921 |
|
|
`CHARACTER(KIND=C_CHAR)' are defined.
|
12922 |
|
|
|
12923 |
|
|
Name C definition Value
|
12924 |
|
|
`C_NULL_CHAR' null character `'\0''
|
12925 |
|
|
`C_ALERT' alert `'\a''
|
12926 |
|
|
`C_BACKSPACE' backspace `'\b''
|
12927 |
|
|
`C_FORM_FEED' form feed `'\f''
|
12928 |
|
|
`C_NEW_LINE' new line `'\n''
|
12929 |
|
|
`C_CARRIAGE_RETURN'carriage return `'\r''
|
12930 |
|
|
`C_HORIZONTAL_TAB'horizontal tab `'\t''
|
12931 |
|
|
`C_VERTICAL_TAB'vertical tab `'\v''
|
12932 |
|
|
|
12933 |
|
|
|
12934 |
|
|
File: gfortran.info, Node: OpenMP Modules OMP_LIB and OMP_LIB_KINDS, Prev: ISO_C_BINDING, Up: Intrinsic Modules
|
12935 |
|
|
|
12936 |
|
|
9.3 OpenMP Modules `OMP_LIB' and `OMP_LIB_KINDS'
|
12937 |
|
|
================================================
|
12938 |
|
|
|
12939 |
|
|
_Standard_:
|
12940 |
|
|
OpenMP Application Program Interface v3.0
|
12941 |
|
|
|
12942 |
|
|
The OpenMP Fortran runtime library routines are provided both in a
|
12943 |
|
|
form of two Fortran 90 modules, named `OMP_LIB' and `OMP_LIB_KINDS',
|
12944 |
|
|
and in a form of a Fortran `include' file named `omp_lib.h'. The
|
12945 |
|
|
procedures provided by `OMP_LIB' can be found in the *note
|
12946 |
|
|
Introduction: (libgomp)Top. manual, the named constants defined in the
|
12947 |
|
|
`OMP_LIB_KINDS' module are listed below.
|
12948 |
|
|
|
12949 |
|
|
For details refer to the actual OpenMP Application Program Interface
|
12950 |
|
|
v3.0 (http://www.openmp.org/mp-documents/spec30.pdf).
|
12951 |
|
|
|
12952 |
|
|
`OMP_LIB_KINDS' provides the following scalar default-integer named
|
12953 |
|
|
constants:
|
12954 |
|
|
|
12955 |
|
|
`omp_integer_kind'
|
12956 |
|
|
|
12957 |
|
|
`omp_logical_kind'
|
12958 |
|
|
|
12959 |
|
|
`omp_lock_kind'
|
12960 |
|
|
|
12961 |
|
|
`omp_nest_lock_kind'
|
12962 |
|
|
|
12963 |
|
|
`omp_sched_kind'
|
12964 |
|
|
|
12965 |
|
|
|
12966 |
|
|
File: gfortran.info, Node: Contributing, Next: Copying, Prev: Intrinsic Modules, Up: Top
|
12967 |
|
|
|
12968 |
|
|
Contributing
|
12969 |
|
|
************
|
12970 |
|
|
|
12971 |
|
|
Free software is only possible if people contribute to efforts to
|
12972 |
|
|
create it. We're always in need of more people helping out with ideas
|
12973 |
|
|
and comments, writing documentation and contributing code.
|
12974 |
|
|
|
12975 |
|
|
If you want to contribute to GNU Fortran, have a look at the long
|
12976 |
|
|
lists of projects you can take on. Some of these projects are small,
|
12977 |
|
|
some of them are large; some are completely orthogonal to the rest of
|
12978 |
|
|
what is happening on GNU Fortran, but others are "mainstream" projects
|
12979 |
|
|
in need of enthusiastic hackers. All of these projects are important!
|
12980 |
|
|
We'll eventually get around to the things here, but they are also
|
12981 |
|
|
things doable by someone who is willing and able.
|
12982 |
|
|
|
12983 |
|
|
* Menu:
|
12984 |
|
|
|
12985 |
|
|
* Contributors::
|
12986 |
|
|
* Projects::
|
12987 |
|
|
* Proposed Extensions::
|
12988 |
|
|
|
12989 |
|
|
|
12990 |
|
|
File: gfortran.info, Node: Contributors, Next: Projects, Up: Contributing
|
12991 |
|
|
|
12992 |
|
|
Contributors to GNU Fortran
|
12993 |
|
|
===========================
|
12994 |
|
|
|
12995 |
|
|
Most of the parser was hand-crafted by _Andy Vaught_, who is also the
|
12996 |
|
|
initiator of the whole project. Thanks Andy! Most of the interface
|
12997 |
|
|
with GCC was written by _Paul Brook_.
|
12998 |
|
|
|
12999 |
|
|
The following individuals have contributed code and/or ideas and
|
13000 |
|
|
significant help to the GNU Fortran project (in alphabetical order):
|
13001 |
|
|
|
13002 |
|
|
- Janne Blomqvist
|
13003 |
|
|
|
13004 |
|
|
- Steven Bosscher
|
13005 |
|
|
|
13006 |
|
|
- Paul Brook
|
13007 |
|
|
|
13008 |
|
|
- Tobias Burnus
|
13009 |
|
|
|
13010 |
|
|
- Franc,ois-Xavier Coudert
|
13011 |
|
|
|
13012 |
|
|
- Bud Davis
|
13013 |
|
|
|
13014 |
|
|
- Jerry DeLisle
|
13015 |
|
|
|
13016 |
|
|
- Erik Edelmann
|
13017 |
|
|
|
13018 |
|
|
- Bernhard Fischer
|
13019 |
|
|
|
13020 |
|
|
- Daniel Franke
|
13021 |
|
|
|
13022 |
|
|
- Richard Guenther
|
13023 |
|
|
|
13024 |
|
|
- Richard Henderson
|
13025 |
|
|
|
13026 |
|
|
- Katherine Holcomb
|
13027 |
|
|
|
13028 |
|
|
- Jakub Jelinek
|
13029 |
|
|
|
13030 |
|
|
- Niels Kristian Bech Jensen
|
13031 |
|
|
|
13032 |
|
|
- Steven Johnson
|
13033 |
|
|
|
13034 |
|
|
- Steven G. Kargl
|
13035 |
|
|
|
13036 |
|
|
- Thomas Koenig
|
13037 |
|
|
|
13038 |
|
|
- Asher Langton
|
13039 |
|
|
|
13040 |
|
|
- H. J. Lu
|
13041 |
|
|
|
13042 |
|
|
- Toon Moene
|
13043 |
|
|
|
13044 |
|
|
- Brooks Moses
|
13045 |
|
|
|
13046 |
|
|
- Andrew Pinski
|
13047 |
|
|
|
13048 |
|
|
- Tim Prince
|
13049 |
|
|
|
13050 |
|
|
- Christopher D. Rickett
|
13051 |
|
|
|
13052 |
|
|
- Richard Sandiford
|
13053 |
|
|
|
13054 |
|
|
- Tobias Schlu"ter
|
13055 |
|
|
|
13056 |
|
|
- Roger Sayle
|
13057 |
|
|
|
13058 |
|
|
- Paul Thomas
|
13059 |
|
|
|
13060 |
|
|
- Andy Vaught
|
13061 |
|
|
|
13062 |
|
|
- Feng Wang
|
13063 |
|
|
|
13064 |
|
|
- Janus Weil
|
13065 |
|
|
|
13066 |
|
|
- Daniel Kraft
|
13067 |
|
|
|
13068 |
|
|
The following people have contributed bug reports, smaller or larger
|
13069 |
|
|
patches, and much needed feedback and encouragement for the GNU Fortran
|
13070 |
|
|
project:
|
13071 |
|
|
|
13072 |
|
|
- Bill Clodius
|
13073 |
|
|
|
13074 |
|
|
- Dominique d'Humie`res
|
13075 |
|
|
|
13076 |
|
|
- Kate Hedstrom
|
13077 |
|
|
|
13078 |
|
|
- Erik Schnetter
|
13079 |
|
|
|
13080 |
|
|
- Joost VandeVondele
|
13081 |
|
|
|
13082 |
|
|
Many other individuals have helped debug, test and improve the GNU
|
13083 |
|
|
Fortran compiler over the past few years, and we welcome you to do the
|
13084 |
|
|
same! If you already have done so, and you would like to see your name
|
13085 |
|
|
listed in the list above, please contact us.
|
13086 |
|
|
|
13087 |
|
|
|
13088 |
|
|
File: gfortran.info, Node: Projects, Next: Proposed Extensions, Prev: Contributors, Up: Contributing
|
13089 |
|
|
|
13090 |
|
|
Projects
|
13091 |
|
|
========
|
13092 |
|
|
|
13093 |
|
|
_Help build the test suite_
|
13094 |
|
|
Solicit more code for donation to the test suite: the more
|
13095 |
|
|
extensive the testsuite, the smaller the risk of breaking things
|
13096 |
|
|
in the future! We can keep code private on request.
|
13097 |
|
|
|
13098 |
|
|
_Bug hunting/squishing_
|
13099 |
|
|
Find bugs and write more test cases! Test cases are especially very
|
13100 |
|
|
welcome, because it allows us to concentrate on fixing bugs
|
13101 |
|
|
instead of isolating them. Going through the bugzilla database at
|
13102 |
|
|
`http://gcc.gnu.org/bugzilla/' to reduce testcases posted there and
|
13103 |
|
|
add more information (for example, for which version does the
|
13104 |
|
|
testcase work, for which versions does it fail?) is also very
|
13105 |
|
|
helpful.
|
13106 |
|
|
|
13107 |
|
|
|
13108 |
|
|
|
13109 |
|
|
File: gfortran.info, Node: Proposed Extensions, Prev: Projects, Up: Contributing
|
13110 |
|
|
|
13111 |
|
|
Proposed Extensions
|
13112 |
|
|
===================
|
13113 |
|
|
|
13114 |
|
|
Here's a list of proposed extensions for the GNU Fortran compiler, in
|
13115 |
|
|
no particular order. Most of these are necessary to be fully
|
13116 |
|
|
compatible with existing Fortran compilers, but they are not part of
|
13117 |
|
|
the official J3 Fortran 95 standard.
|
13118 |
|
|
|
13119 |
|
|
Compiler extensions:
|
13120 |
|
|
--------------------
|
13121 |
|
|
|
13122 |
|
|
* User-specified alignment rules for structures.
|
13123 |
|
|
|
13124 |
|
|
* Flag to generate `Makefile' info.
|
13125 |
|
|
|
13126 |
|
|
* Automatically extend single precision constants to double.
|
13127 |
|
|
|
13128 |
|
|
* Compile code that conserves memory by dynamically allocating
|
13129 |
|
|
common and module storage either on stack or heap.
|
13130 |
|
|
|
13131 |
|
|
* Compile flag to generate code for array conformance checking
|
13132 |
|
|
(suggest -CC).
|
13133 |
|
|
|
13134 |
|
|
* User control of symbol names (underscores, etc).
|
13135 |
|
|
|
13136 |
|
|
* Compile setting for maximum size of stack frame size before
|
13137 |
|
|
spilling parts to static or heap.
|
13138 |
|
|
|
13139 |
|
|
* Flag to force local variables into static space.
|
13140 |
|
|
|
13141 |
|
|
* Flag to force local variables onto stack.
|
13142 |
|
|
|
13143 |
|
|
Environment Options
|
13144 |
|
|
-------------------
|
13145 |
|
|
|
13146 |
|
|
* Pluggable library modules for random numbers, linear algebra. LA
|
13147 |
|
|
should use BLAS calling conventions.
|
13148 |
|
|
|
13149 |
|
|
* Environment variables controlling actions on arithmetic exceptions
|
13150 |
|
|
like overflow, underflow, precision loss--Generate NaN, abort,
|
13151 |
|
|
default. action.
|
13152 |
|
|
|
13153 |
|
|
* Set precision for fp units that support it (i387).
|
13154 |
|
|
|
13155 |
|
|
* Variable for setting fp rounding mode.
|
13156 |
|
|
|
13157 |
|
|
* Variable to fill uninitialized variables with a user-defined bit
|
13158 |
|
|
pattern.
|
13159 |
|
|
|
13160 |
|
|
* Environment variable controlling filename that is opened for that
|
13161 |
|
|
unit number.
|
13162 |
|
|
|
13163 |
|
|
* Environment variable to clear/trash memory being freed.
|
13164 |
|
|
|
13165 |
|
|
* Environment variable to control tracing of allocations and frees.
|
13166 |
|
|
|
13167 |
|
|
* Environment variable to display allocated memory at normal program
|
13168 |
|
|
end.
|
13169 |
|
|
|
13170 |
|
|
* Environment variable for filename for * IO-unit.
|
13171 |
|
|
|
13172 |
|
|
* Environment variable for temporary file directory.
|
13173 |
|
|
|
13174 |
|
|
* Environment variable forcing standard output to be line buffered
|
13175 |
|
|
(unix).
|
13176 |
|
|
|
13177 |
|
|
|
13178 |
|
|
|
13179 |
|
|
File: gfortran.info, Node: Copying, Next: GNU Free Documentation License, Prev: Contributing, Up: Top
|
13180 |
|
|
|
13181 |
|
|
GNU General Public License
|
13182 |
|
|
**************************
|
13183 |
|
|
|
13184 |
|
|
Version 3, 29 June 2007
|
13185 |
|
|
|
13186 |
|
|
Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/'
|
13187 |
|
|
|
13188 |
|
|
Everyone is permitted to copy and distribute verbatim copies of this
|
13189 |
|
|
license document, but changing it is not allowed.
|
13190 |
|
|
|
13191 |
|
|
Preamble
|
13192 |
|
|
========
|
13193 |
|
|
|
13194 |
|
|
The GNU General Public License is a free, copyleft license for software
|
13195 |
|
|
and other kinds of works.
|
13196 |
|
|
|
13197 |
|
|
The licenses for most software and other practical works are designed
|
13198 |
|
|
to take away your freedom to share and change the works. By contrast,
|
13199 |
|
|
the GNU General Public License is intended to guarantee your freedom to
|
13200 |
|
|
share and change all versions of a program-to make sure it remains free
|
13201 |
|
|
software for all its users. We, the Free Software Foundation, use the
|
13202 |
|
|
GNU General Public License for most of our software; it applies also to
|
13203 |
|
|
any other work released this way by its authors. You can apply it to
|
13204 |
|
|
your programs, too.
|
13205 |
|
|
|
13206 |
|
|
When we speak of free software, we are referring to freedom, not
|
13207 |
|
|
price. Our General Public Licenses are designed to make sure that you
|
13208 |
|
|
have the freedom to distribute copies of free software (and charge for
|
13209 |
|
|
them if you wish), that you receive source code or can get it if you
|
13210 |
|
|
want it, that you can change the software or use pieces of it in new
|
13211 |
|
|
free programs, and that you know you can do these things.
|
13212 |
|
|
|
13213 |
|
|
To protect your rights, we need to prevent others from denying you
|
13214 |
|
|
these rights or asking you to surrender the rights. Therefore, you
|
13215 |
|
|
have certain responsibilities if you distribute copies of the software,
|
13216 |
|
|
or if you modify it: responsibilities to respect the freedom of others.
|
13217 |
|
|
|
13218 |
|
|
For example, if you distribute copies of such a program, whether
|
13219 |
|
|
gratis or for a fee, you must pass on to the recipients the same
|
13220 |
|
|
freedoms that you received. You must make sure that they, too, receive
|
13221 |
|
|
or can get the source code. And you must show them these terms so they
|
13222 |
|
|
know their rights.
|
13223 |
|
|
|
13224 |
|
|
Developers that use the GNU GPL protect your rights with two steps:
|
13225 |
|
|
(1) assert copyright on the software, and (2) offer you this License
|
13226 |
|
|
giving you legal permission to copy, distribute and/or modify it.
|
13227 |
|
|
|
13228 |
|
|
For the developers' and authors' protection, the GPL clearly explains
|
13229 |
|
|
that there is no warranty for this free software. For both users' and
|
13230 |
|
|
authors' sake, the GPL requires that modified versions be marked as
|
13231 |
|
|
changed, so that their problems will not be attributed erroneously to
|
13232 |
|
|
authors of previous versions.
|
13233 |
|
|
|
13234 |
|
|
Some devices are designed to deny users access to install or run
|
13235 |
|
|
modified versions of the software inside them, although the
|
13236 |
|
|
manufacturer can do so. This is fundamentally incompatible with the
|
13237 |
|
|
aim of protecting users' freedom to change the software. The
|
13238 |
|
|
systematic pattern of such abuse occurs in the area of products for
|
13239 |
|
|
individuals to use, which is precisely where it is most unacceptable.
|
13240 |
|
|
Therefore, we have designed this version of the GPL to prohibit the
|
13241 |
|
|
practice for those products. If such problems arise substantially in
|
13242 |
|
|
other domains, we stand ready to extend this provision to those domains
|
13243 |
|
|
in future versions of the GPL, as needed to protect the freedom of
|
13244 |
|
|
users.
|
13245 |
|
|
|
13246 |
|
|
Finally, every program is threatened constantly by software patents.
|
13247 |
|
|
States should not allow patents to restrict development and use of
|
13248 |
|
|
software on general-purpose computers, but in those that do, we wish to
|
13249 |
|
|
avoid the special danger that patents applied to a free program could
|
13250 |
|
|
make it effectively proprietary. To prevent this, the GPL assures that
|
13251 |
|
|
patents cannot be used to render the program non-free.
|
13252 |
|
|
|
13253 |
|
|
The precise terms and conditions for copying, distribution and
|
13254 |
|
|
modification follow.
|
13255 |
|
|
|
13256 |
|
|
TERMS AND CONDITIONS
|
13257 |
|
|
====================
|
13258 |
|
|
|
13259 |
|
|
0. Definitions.
|
13260 |
|
|
|
13261 |
|
|
"This License" refers to version 3 of the GNU General Public
|
13262 |
|
|
License.
|
13263 |
|
|
|
13264 |
|
|
"Copyright" also means copyright-like laws that apply to other
|
13265 |
|
|
kinds of works, such as semiconductor masks.
|
13266 |
|
|
|
13267 |
|
|
"The Program" refers to any copyrightable work licensed under this
|
13268 |
|
|
License. Each licensee is addressed as "you". "Licensees" and
|
13269 |
|
|
"recipients" may be individuals or organizations.
|
13270 |
|
|
|
13271 |
|
|
To "modify" a work means to copy from or adapt all or part of the
|
13272 |
|
|
work in a fashion requiring copyright permission, other than the
|
13273 |
|
|
making of an exact copy. The resulting work is called a "modified
|
13274 |
|
|
version" of the earlier work or a work "based on" the earlier work.
|
13275 |
|
|
|
13276 |
|
|
A "covered work" means either the unmodified Program or a work
|
13277 |
|
|
based on the Program.
|
13278 |
|
|
|
13279 |
|
|
To "propagate" a work means to do anything with it that, without
|
13280 |
|
|
permission, would make you directly or secondarily liable for
|
13281 |
|
|
infringement under applicable copyright law, except executing it
|
13282 |
|
|
on a computer or modifying a private copy. Propagation includes
|
13283 |
|
|
copying, distribution (with or without modification), making
|
13284 |
|
|
available to the public, and in some countries other activities as
|
13285 |
|
|
well.
|
13286 |
|
|
|
13287 |
|
|
To "convey" a work means any kind of propagation that enables other
|
13288 |
|
|
parties to make or receive copies. Mere interaction with a user
|
13289 |
|
|
through a computer network, with no transfer of a copy, is not
|
13290 |
|
|
conveying.
|
13291 |
|
|
|
13292 |
|
|
An interactive user interface displays "Appropriate Legal Notices"
|
13293 |
|
|
to the extent that it includes a convenient and prominently visible
|
13294 |
|
|
feature that (1) displays an appropriate copyright notice, and (2)
|
13295 |
|
|
tells the user that there is no warranty for the work (except to
|
13296 |
|
|
the extent that warranties are provided), that licensees may
|
13297 |
|
|
convey the work under this License, and how to view a copy of this
|
13298 |
|
|
License. If the interface presents a list of user commands or
|
13299 |
|
|
options, such as a menu, a prominent item in the list meets this
|
13300 |
|
|
criterion.
|
13301 |
|
|
|
13302 |
|
|
1. Source Code.
|
13303 |
|
|
|
13304 |
|
|
The "source code" for a work means the preferred form of the work
|
13305 |
|
|
for making modifications to it. "Object code" means any
|
13306 |
|
|
non-source form of a work.
|
13307 |
|
|
|
13308 |
|
|
A "Standard Interface" means an interface that either is an
|
13309 |
|
|
official standard defined by a recognized standards body, or, in
|
13310 |
|
|
the case of interfaces specified for a particular programming
|
13311 |
|
|
language, one that is widely used among developers working in that
|
13312 |
|
|
language.
|
13313 |
|
|
|
13314 |
|
|
The "System Libraries" of an executable work include anything,
|
13315 |
|
|
other than the work as a whole, that (a) is included in the normal
|
13316 |
|
|
form of packaging a Major Component, but which is not part of that
|
13317 |
|
|
Major Component, and (b) serves only to enable use of the work
|
13318 |
|
|
with that Major Component, or to implement a Standard Interface
|
13319 |
|
|
for which an implementation is available to the public in source
|
13320 |
|
|
code form. A "Major Component", in this context, means a major
|
13321 |
|
|
essential component (kernel, window system, and so on) of the
|
13322 |
|
|
specific operating system (if any) on which the executable work
|
13323 |
|
|
runs, or a compiler used to produce the work, or an object code
|
13324 |
|
|
interpreter used to run it.
|
13325 |
|
|
|
13326 |
|
|
The "Corresponding Source" for a work in object code form means all
|
13327 |
|
|
the source code needed to generate, install, and (for an executable
|
13328 |
|
|
work) run the object code and to modify the work, including
|
13329 |
|
|
scripts to control those activities. However, it does not include
|
13330 |
|
|
the work's System Libraries, or general-purpose tools or generally
|
13331 |
|
|
available free programs which are used unmodified in performing
|
13332 |
|
|
those activities but which are not part of the work. For example,
|
13333 |
|
|
Corresponding Source includes interface definition files
|
13334 |
|
|
associated with source files for the work, and the source code for
|
13335 |
|
|
shared libraries and dynamically linked subprograms that the work
|
13336 |
|
|
is specifically designed to require, such as by intimate data
|
13337 |
|
|
communication or control flow between those subprograms and other
|
13338 |
|
|
parts of the work.
|
13339 |
|
|
|
13340 |
|
|
The Corresponding Source need not include anything that users can
|
13341 |
|
|
regenerate automatically from other parts of the Corresponding
|
13342 |
|
|
Source.
|
13343 |
|
|
|
13344 |
|
|
The Corresponding Source for a work in source code form is that
|
13345 |
|
|
same work.
|
13346 |
|
|
|
13347 |
|
|
2. Basic Permissions.
|
13348 |
|
|
|
13349 |
|
|
All rights granted under this License are granted for the term of
|
13350 |
|
|
copyright on the Program, and are irrevocable provided the stated
|
13351 |
|
|
conditions are met. This License explicitly affirms your unlimited
|
13352 |
|
|
permission to run the unmodified Program. The output from running
|
13353 |
|
|
a covered work is covered by this License only if the output,
|
13354 |
|
|
given its content, constitutes a covered work. This License
|
13355 |
|
|
acknowledges your rights of fair use or other equivalent, as
|
13356 |
|
|
provided by copyright law.
|
13357 |
|
|
|
13358 |
|
|
You may make, run and propagate covered works that you do not
|
13359 |
|
|
convey, without conditions so long as your license otherwise
|
13360 |
|
|
remains in force. You may convey covered works to others for the
|
13361 |
|
|
sole purpose of having them make modifications exclusively for
|
13362 |
|
|
you, or provide you with facilities for running those works,
|
13363 |
|
|
provided that you comply with the terms of this License in
|
13364 |
|
|
conveying all material for which you do not control copyright.
|
13365 |
|
|
Those thus making or running the covered works for you must do so
|
13366 |
|
|
exclusively on your behalf, under your direction and control, on
|
13367 |
|
|
terms that prohibit them from making any copies of your
|
13368 |
|
|
copyrighted material outside their relationship with you.
|
13369 |
|
|
|
13370 |
|
|
Conveying under any other circumstances is permitted solely under
|
13371 |
|
|
the conditions stated below. Sublicensing is not allowed; section
|
13372 |
|
|
10 makes it unnecessary.
|
13373 |
|
|
|
13374 |
|
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
13375 |
|
|
|
13376 |
|
|
No covered work shall be deemed part of an effective technological
|
13377 |
|
|
measure under any applicable law fulfilling obligations under
|
13378 |
|
|
article 11 of the WIPO copyright treaty adopted on 20 December
|
13379 |
|
|
1996, or similar laws prohibiting or restricting circumvention of
|
13380 |
|
|
such measures.
|
13381 |
|
|
|
13382 |
|
|
When you convey a covered work, you waive any legal power to forbid
|
13383 |
|
|
circumvention of technological measures to the extent such
|
13384 |
|
|
circumvention is effected by exercising rights under this License
|
13385 |
|
|
with respect to the covered work, and you disclaim any intention
|
13386 |
|
|
to limit operation or modification of the work as a means of
|
13387 |
|
|
enforcing, against the work's users, your or third parties' legal
|
13388 |
|
|
rights to forbid circumvention of technological measures.
|
13389 |
|
|
|
13390 |
|
|
4. Conveying Verbatim Copies.
|
13391 |
|
|
|
13392 |
|
|
You may convey verbatim copies of the Program's source code as you
|
13393 |
|
|
receive it, in any medium, provided that you conspicuously and
|
13394 |
|
|
appropriately publish on each copy an appropriate copyright notice;
|
13395 |
|
|
keep intact all notices stating that this License and any
|
13396 |
|
|
non-permissive terms added in accord with section 7 apply to the
|
13397 |
|
|
code; keep intact all notices of the absence of any warranty; and
|
13398 |
|
|
give all recipients a copy of this License along with the Program.
|
13399 |
|
|
|
13400 |
|
|
You may charge any price or no price for each copy that you convey,
|
13401 |
|
|
and you may offer support or warranty protection for a fee.
|
13402 |
|
|
|
13403 |
|
|
5. Conveying Modified Source Versions.
|
13404 |
|
|
|
13405 |
|
|
You may convey a work based on the Program, or the modifications to
|
13406 |
|
|
produce it from the Program, in the form of source code under the
|
13407 |
|
|
terms of section 4, provided that you also meet all of these
|
13408 |
|
|
conditions:
|
13409 |
|
|
|
13410 |
|
|
a. The work must carry prominent notices stating that you
|
13411 |
|
|
modified it, and giving a relevant date.
|
13412 |
|
|
|
13413 |
|
|
b. The work must carry prominent notices stating that it is
|
13414 |
|
|
released under this License and any conditions added under
|
13415 |
|
|
section 7. This requirement modifies the requirement in
|
13416 |
|
|
section 4 to "keep intact all notices".
|
13417 |
|
|
|
13418 |
|
|
c. You must license the entire work, as a whole, under this
|
13419 |
|
|
License to anyone who comes into possession of a copy. This
|
13420 |
|
|
License will therefore apply, along with any applicable
|
13421 |
|
|
section 7 additional terms, to the whole of the work, and all
|
13422 |
|
|
its parts, regardless of how they are packaged. This License
|
13423 |
|
|
gives no permission to license the work in any other way, but
|
13424 |
|
|
it does not invalidate such permission if you have separately
|
13425 |
|
|
received it.
|
13426 |
|
|
|
13427 |
|
|
d. If the work has interactive user interfaces, each must display
|
13428 |
|
|
Appropriate Legal Notices; however, if the Program has
|
13429 |
|
|
interactive interfaces that do not display Appropriate Legal
|
13430 |
|
|
Notices, your work need not make them do so.
|
13431 |
|
|
|
13432 |
|
|
A compilation of a covered work with other separate and independent
|
13433 |
|
|
works, which are not by their nature extensions of the covered
|
13434 |
|
|
work, and which are not combined with it such as to form a larger
|
13435 |
|
|
program, in or on a volume of a storage or distribution medium, is
|
13436 |
|
|
called an "aggregate" if the compilation and its resulting
|
13437 |
|
|
copyright are not used to limit the access or legal rights of the
|
13438 |
|
|
compilation's users beyond what the individual works permit.
|
13439 |
|
|
Inclusion of a covered work in an aggregate does not cause this
|
13440 |
|
|
License to apply to the other parts of the aggregate.
|
13441 |
|
|
|
13442 |
|
|
6. Conveying Non-Source Forms.
|
13443 |
|
|
|
13444 |
|
|
You may convey a covered work in object code form under the terms
|
13445 |
|
|
of sections 4 and 5, provided that you also convey the
|
13446 |
|
|
machine-readable Corresponding Source under the terms of this
|
13447 |
|
|
License, in one of these ways:
|
13448 |
|
|
|
13449 |
|
|
a. Convey the object code in, or embodied in, a physical product
|
13450 |
|
|
(including a physical distribution medium), accompanied by the
|
13451 |
|
|
Corresponding Source fixed on a durable physical medium
|
13452 |
|
|
customarily used for software interchange.
|
13453 |
|
|
|
13454 |
|
|
b. Convey the object code in, or embodied in, a physical product
|
13455 |
|
|
(including a physical distribution medium), accompanied by a
|
13456 |
|
|
written offer, valid for at least three years and valid for
|
13457 |
|
|
as long as you offer spare parts or customer support for that
|
13458 |
|
|
product model, to give anyone who possesses the object code
|
13459 |
|
|
either (1) a copy of the Corresponding Source for all the
|
13460 |
|
|
software in the product that is covered by this License, on a
|
13461 |
|
|
durable physical medium customarily used for software
|
13462 |
|
|
interchange, for a price no more than your reasonable cost of
|
13463 |
|
|
physically performing this conveying of source, or (2) access
|
13464 |
|
|
to copy the Corresponding Source from a network server at no
|
13465 |
|
|
charge.
|
13466 |
|
|
|
13467 |
|
|
c. Convey individual copies of the object code with a copy of
|
13468 |
|
|
the written offer to provide the Corresponding Source. This
|
13469 |
|
|
alternative is allowed only occasionally and noncommercially,
|
13470 |
|
|
and only if you received the object code with such an offer,
|
13471 |
|
|
in accord with subsection 6b.
|
13472 |
|
|
|
13473 |
|
|
d. Convey the object code by offering access from a designated
|
13474 |
|
|
place (gratis or for a charge), and offer equivalent access
|
13475 |
|
|
to the Corresponding Source in the same way through the same
|
13476 |
|
|
place at no further charge. You need not require recipients
|
13477 |
|
|
to copy the Corresponding Source along with the object code.
|
13478 |
|
|
If the place to copy the object code is a network server, the
|
13479 |
|
|
Corresponding Source may be on a different server (operated
|
13480 |
|
|
by you or a third party) that supports equivalent copying
|
13481 |
|
|
facilities, provided you maintain clear directions next to
|
13482 |
|
|
the object code saying where to find the Corresponding Source.
|
13483 |
|
|
Regardless of what server hosts the Corresponding Source, you
|
13484 |
|
|
remain obligated to ensure that it is available for as long
|
13485 |
|
|
as needed to satisfy these requirements.
|
13486 |
|
|
|
13487 |
|
|
e. Convey the object code using peer-to-peer transmission,
|
13488 |
|
|
provided you inform other peers where the object code and
|
13489 |
|
|
Corresponding Source of the work are being offered to the
|
13490 |
|
|
general public at no charge under subsection 6d.
|
13491 |
|
|
|
13492 |
|
|
|
13493 |
|
|
A separable portion of the object code, whose source code is
|
13494 |
|
|
excluded from the Corresponding Source as a System Library, need
|
13495 |
|
|
not be included in conveying the object code work.
|
13496 |
|
|
|
13497 |
|
|
A "User Product" is either (1) a "consumer product", which means
|
13498 |
|
|
any tangible personal property which is normally used for personal,
|
13499 |
|
|
family, or household purposes, or (2) anything designed or sold for
|
13500 |
|
|
incorporation into a dwelling. In determining whether a product
|
13501 |
|
|
is a consumer product, doubtful cases shall be resolved in favor of
|
13502 |
|
|
coverage. For a particular product received by a particular user,
|
13503 |
|
|
"normally used" refers to a typical or common use of that class of
|
13504 |
|
|
product, regardless of the status of the particular user or of the
|
13505 |
|
|
way in which the particular user actually uses, or expects or is
|
13506 |
|
|
expected to use, the product. A product is a consumer product
|
13507 |
|
|
regardless of whether the product has substantial commercial,
|
13508 |
|
|
industrial or non-consumer uses, unless such uses represent the
|
13509 |
|
|
only significant mode of use of the product.
|
13510 |
|
|
|
13511 |
|
|
"Installation Information" for a User Product means any methods,
|
13512 |
|
|
procedures, authorization keys, or other information required to
|
13513 |
|
|
install and execute modified versions of a covered work in that
|
13514 |
|
|
User Product from a modified version of its Corresponding Source.
|
13515 |
|
|
The information must suffice to ensure that the continued
|
13516 |
|
|
functioning of the modified object code is in no case prevented or
|
13517 |
|
|
interfered with solely because modification has been made.
|
13518 |
|
|
|
13519 |
|
|
If you convey an object code work under this section in, or with,
|
13520 |
|
|
or specifically for use in, a User Product, and the conveying
|
13521 |
|
|
occurs as part of a transaction in which the right of possession
|
13522 |
|
|
and use of the User Product is transferred to the recipient in
|
13523 |
|
|
perpetuity or for a fixed term (regardless of how the transaction
|
13524 |
|
|
is characterized), the Corresponding Source conveyed under this
|
13525 |
|
|
section must be accompanied by the Installation Information. But
|
13526 |
|
|
this requirement does not apply if neither you nor any third party
|
13527 |
|
|
retains the ability to install modified object code on the User
|
13528 |
|
|
Product (for example, the work has been installed in ROM).
|
13529 |
|
|
|
13530 |
|
|
The requirement to provide Installation Information does not
|
13531 |
|
|
include a requirement to continue to provide support service,
|
13532 |
|
|
warranty, or updates for a work that has been modified or
|
13533 |
|
|
installed by the recipient, or for the User Product in which it
|
13534 |
|
|
has been modified or installed. Access to a network may be denied
|
13535 |
|
|
when the modification itself materially and adversely affects the
|
13536 |
|
|
operation of the network or violates the rules and protocols for
|
13537 |
|
|
communication across the network.
|
13538 |
|
|
|
13539 |
|
|
Corresponding Source conveyed, and Installation Information
|
13540 |
|
|
provided, in accord with this section must be in a format that is
|
13541 |
|
|
publicly documented (and with an implementation available to the
|
13542 |
|
|
public in source code form), and must require no special password
|
13543 |
|
|
or key for unpacking, reading or copying.
|
13544 |
|
|
|
13545 |
|
|
7. Additional Terms.
|
13546 |
|
|
|
13547 |
|
|
"Additional permissions" are terms that supplement the terms of
|
13548 |
|
|
this License by making exceptions from one or more of its
|
13549 |
|
|
conditions. Additional permissions that are applicable to the
|
13550 |
|
|
entire Program shall be treated as though they were included in
|
13551 |
|
|
this License, to the extent that they are valid under applicable
|
13552 |
|
|
law. If additional permissions apply only to part of the Program,
|
13553 |
|
|
that part may be used separately under those permissions, but the
|
13554 |
|
|
entire Program remains governed by this License without regard to
|
13555 |
|
|
the additional permissions.
|
13556 |
|
|
|
13557 |
|
|
When you convey a copy of a covered work, you may at your option
|
13558 |
|
|
remove any additional permissions from that copy, or from any part
|
13559 |
|
|
of it. (Additional permissions may be written to require their own
|
13560 |
|
|
removal in certain cases when you modify the work.) You may place
|
13561 |
|
|
additional permissions on material, added by you to a covered work,
|
13562 |
|
|
for which you have or can give appropriate copyright permission.
|
13563 |
|
|
|
13564 |
|
|
Notwithstanding any other provision of this License, for material
|
13565 |
|
|
you add to a covered work, you may (if authorized by the copyright
|
13566 |
|
|
holders of that material) supplement the terms of this License
|
13567 |
|
|
with terms:
|
13568 |
|
|
|
13569 |
|
|
a. Disclaiming warranty or limiting liability differently from
|
13570 |
|
|
the terms of sections 15 and 16 of this License; or
|
13571 |
|
|
|
13572 |
|
|
b. Requiring preservation of specified reasonable legal notices
|
13573 |
|
|
or author attributions in that material or in the Appropriate
|
13574 |
|
|
Legal Notices displayed by works containing it; or
|
13575 |
|
|
|
13576 |
|
|
c. Prohibiting misrepresentation of the origin of that material,
|
13577 |
|
|
or requiring that modified versions of such material be
|
13578 |
|
|
marked in reasonable ways as different from the original
|
13579 |
|
|
version; or
|
13580 |
|
|
|
13581 |
|
|
d. Limiting the use for publicity purposes of names of licensors
|
13582 |
|
|
or authors of the material; or
|
13583 |
|
|
|
13584 |
|
|
e. Declining to grant rights under trademark law for use of some
|
13585 |
|
|
trade names, trademarks, or service marks; or
|
13586 |
|
|
|
13587 |
|
|
f. Requiring indemnification of licensors and authors of that
|
13588 |
|
|
material by anyone who conveys the material (or modified
|
13589 |
|
|
versions of it) with contractual assumptions of liability to
|
13590 |
|
|
the recipient, for any liability that these contractual
|
13591 |
|
|
assumptions directly impose on those licensors and authors.
|
13592 |
|
|
|
13593 |
|
|
All other non-permissive additional terms are considered "further
|
13594 |
|
|
restrictions" within the meaning of section 10. If the Program as
|
13595 |
|
|
you received it, or any part of it, contains a notice stating that
|
13596 |
|
|
it is governed by this License along with a term that is a further
|
13597 |
|
|
restriction, you may remove that term. If a license document
|
13598 |
|
|
contains a further restriction but permits relicensing or
|
13599 |
|
|
conveying under this License, you may add to a covered work
|
13600 |
|
|
material governed by the terms of that license document, provided
|
13601 |
|
|
that the further restriction does not survive such relicensing or
|
13602 |
|
|
conveying.
|
13603 |
|
|
|
13604 |
|
|
If you add terms to a covered work in accord with this section, you
|
13605 |
|
|
must place, in the relevant source files, a statement of the
|
13606 |
|
|
additional terms that apply to those files, or a notice indicating
|
13607 |
|
|
where to find the applicable terms.
|
13608 |
|
|
|
13609 |
|
|
Additional terms, permissive or non-permissive, may be stated in
|
13610 |
|
|
the form of a separately written license, or stated as exceptions;
|
13611 |
|
|
the above requirements apply either way.
|
13612 |
|
|
|
13613 |
|
|
8. Termination.
|
13614 |
|
|
|
13615 |
|
|
You may not propagate or modify a covered work except as expressly
|
13616 |
|
|
provided under this License. Any attempt otherwise to propagate or
|
13617 |
|
|
modify it is void, and will automatically terminate your rights
|
13618 |
|
|
under this License (including any patent licenses granted under
|
13619 |
|
|
the third paragraph of section 11).
|
13620 |
|
|
|
13621 |
|
|
However, if you cease all violation of this License, then your
|
13622 |
|
|
license from a particular copyright holder is reinstated (a)
|
13623 |
|
|
provisionally, unless and until the copyright holder explicitly
|
13624 |
|
|
and finally terminates your license, and (b) permanently, if the
|
13625 |
|
|
copyright holder fails to notify you of the violation by some
|
13626 |
|
|
reasonable means prior to 60 days after the cessation.
|
13627 |
|
|
|
13628 |
|
|
Moreover, your license from a particular copyright holder is
|
13629 |
|
|
reinstated permanently if the copyright holder notifies you of the
|
13630 |
|
|
violation by some reasonable means, this is the first time you have
|
13631 |
|
|
received notice of violation of this License (for any work) from
|
13632 |
|
|
that copyright holder, and you cure the violation prior to 30 days
|
13633 |
|
|
after your receipt of the notice.
|
13634 |
|
|
|
13635 |
|
|
Termination of your rights under this section does not terminate
|
13636 |
|
|
the licenses of parties who have received copies or rights from
|
13637 |
|
|
you under this License. If your rights have been terminated and
|
13638 |
|
|
not permanently reinstated, you do not qualify to receive new
|
13639 |
|
|
licenses for the same material under section 10.
|
13640 |
|
|
|
13641 |
|
|
9. Acceptance Not Required for Having Copies.
|
13642 |
|
|
|
13643 |
|
|
You are not required to accept this License in order to receive or
|
13644 |
|
|
run a copy of the Program. Ancillary propagation of a covered work
|
13645 |
|
|
occurring solely as a consequence of using peer-to-peer
|
13646 |
|
|
transmission to receive a copy likewise does not require
|
13647 |
|
|
acceptance. However, nothing other than this License grants you
|
13648 |
|
|
permission to propagate or modify any covered work. These actions
|
13649 |
|
|
infringe copyright if you do not accept this License. Therefore,
|
13650 |
|
|
by modifying or propagating a covered work, you indicate your
|
13651 |
|
|
acceptance of this License to do so.
|
13652 |
|
|
|
13653 |
|
|
10. Automatic Licensing of Downstream Recipients.
|
13654 |
|
|
|
13655 |
|
|
Each time you convey a covered work, the recipient automatically
|
13656 |
|
|
receives a license from the original licensors, to run, modify and
|
13657 |
|
|
propagate that work, subject to this License. You are not
|
13658 |
|
|
responsible for enforcing compliance by third parties with this
|
13659 |
|
|
License.
|
13660 |
|
|
|
13661 |
|
|
An "entity transaction" is a transaction transferring control of an
|
13662 |
|
|
organization, or substantially all assets of one, or subdividing an
|
13663 |
|
|
organization, or merging organizations. If propagation of a
|
13664 |
|
|
covered work results from an entity transaction, each party to that
|
13665 |
|
|
transaction who receives a copy of the work also receives whatever
|
13666 |
|
|
licenses to the work the party's predecessor in interest had or
|
13667 |
|
|
could give under the previous paragraph, plus a right to
|
13668 |
|
|
possession of the Corresponding Source of the work from the
|
13669 |
|
|
predecessor in interest, if the predecessor has it or can get it
|
13670 |
|
|
with reasonable efforts.
|
13671 |
|
|
|
13672 |
|
|
You may not impose any further restrictions on the exercise of the
|
13673 |
|
|
rights granted or affirmed under this License. For example, you
|
13674 |
|
|
may not impose a license fee, royalty, or other charge for
|
13675 |
|
|
exercise of rights granted under this License, and you may not
|
13676 |
|
|
initiate litigation (including a cross-claim or counterclaim in a
|
13677 |
|
|
lawsuit) alleging that any patent claim is infringed by making,
|
13678 |
|
|
using, selling, offering for sale, or importing the Program or any
|
13679 |
|
|
portion of it.
|
13680 |
|
|
|
13681 |
|
|
11. Patents.
|
13682 |
|
|
|
13683 |
|
|
A "contributor" is a copyright holder who authorizes use under this
|
13684 |
|
|
License of the Program or a work on which the Program is based.
|
13685 |
|
|
The work thus licensed is called the contributor's "contributor
|
13686 |
|
|
version".
|
13687 |
|
|
|
13688 |
|
|
A contributor's "essential patent claims" are all patent claims
|
13689 |
|
|
owned or controlled by the contributor, whether already acquired or
|
13690 |
|
|
hereafter acquired, that would be infringed by some manner,
|
13691 |
|
|
permitted by this License, of making, using, or selling its
|
13692 |
|
|
contributor version, but do not include claims that would be
|
13693 |
|
|
infringed only as a consequence of further modification of the
|
13694 |
|
|
contributor version. For purposes of this definition, "control"
|
13695 |
|
|
includes the right to grant patent sublicenses in a manner
|
13696 |
|
|
consistent with the requirements of this License.
|
13697 |
|
|
|
13698 |
|
|
Each contributor grants you a non-exclusive, worldwide,
|
13699 |
|
|
royalty-free patent license under the contributor's essential
|
13700 |
|
|
patent claims, to make, use, sell, offer for sale, import and
|
13701 |
|
|
otherwise run, modify and propagate the contents of its
|
13702 |
|
|
contributor version.
|
13703 |
|
|
|
13704 |
|
|
In the following three paragraphs, a "patent license" is any
|
13705 |
|
|
express agreement or commitment, however denominated, not to
|
13706 |
|
|
enforce a patent (such as an express permission to practice a
|
13707 |
|
|
patent or covenant not to sue for patent infringement). To
|
13708 |
|
|
"grant" such a patent license to a party means to make such an
|
13709 |
|
|
agreement or commitment not to enforce a patent against the party.
|
13710 |
|
|
|
13711 |
|
|
If you convey a covered work, knowingly relying on a patent
|
13712 |
|
|
license, and the Corresponding Source of the work is not available
|
13713 |
|
|
for anyone to copy, free of charge and under the terms of this
|
13714 |
|
|
License, through a publicly available network server or other
|
13715 |
|
|
readily accessible means, then you must either (1) cause the
|
13716 |
|
|
Corresponding Source to be so available, or (2) arrange to deprive
|
13717 |
|
|
yourself of the benefit of the patent license for this particular
|
13718 |
|
|
work, or (3) arrange, in a manner consistent with the requirements
|
13719 |
|
|
of this License, to extend the patent license to downstream
|
13720 |
|
|
recipients. "Knowingly relying" means you have actual knowledge
|
13721 |
|
|
that, but for the patent license, your conveying the covered work
|
13722 |
|
|
in a country, or your recipient's use of the covered work in a
|
13723 |
|
|
country, would infringe one or more identifiable patents in that
|
13724 |
|
|
country that you have reason to believe are valid.
|
13725 |
|
|
|
13726 |
|
|
If, pursuant to or in connection with a single transaction or
|
13727 |
|
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
13728 |
|
|
covered work, and grant a patent license to some of the parties
|
13729 |
|
|
receiving the covered work authorizing them to use, propagate,
|
13730 |
|
|
modify or convey a specific copy of the covered work, then the
|
13731 |
|
|
patent license you grant is automatically extended to all
|
13732 |
|
|
recipients of the covered work and works based on it.
|
13733 |
|
|
|
13734 |
|
|
A patent license is "discriminatory" if it does not include within
|
13735 |
|
|
the scope of its coverage, prohibits the exercise of, or is
|
13736 |
|
|
conditioned on the non-exercise of one or more of the rights that
|
13737 |
|
|
are specifically granted under this License. You may not convey a
|
13738 |
|
|
covered work if you are a party to an arrangement with a third
|
13739 |
|
|
party that is in the business of distributing software, under
|
13740 |
|
|
which you make payment to the third party based on the extent of
|
13741 |
|
|
your activity of conveying the work, and under which the third
|
13742 |
|
|
party grants, to any of the parties who would receive the covered
|
13743 |
|
|
work from you, a discriminatory patent license (a) in connection
|
13744 |
|
|
with copies of the covered work conveyed by you (or copies made
|
13745 |
|
|
from those copies), or (b) primarily for and in connection with
|
13746 |
|
|
specific products or compilations that contain the covered work,
|
13747 |
|
|
unless you entered into that arrangement, or that patent license
|
13748 |
|
|
was granted, prior to 28 March 2007.
|
13749 |
|
|
|
13750 |
|
|
Nothing in this License shall be construed as excluding or limiting
|
13751 |
|
|
any implied license or other defenses to infringement that may
|
13752 |
|
|
otherwise be available to you under applicable patent law.
|
13753 |
|
|
|
13754 |
|
|
12. No Surrender of Others' Freedom.
|
13755 |
|
|
|
13756 |
|
|
If conditions are imposed on you (whether by court order,
|
13757 |
|
|
agreement or otherwise) that contradict the conditions of this
|
13758 |
|
|
License, they do not excuse you from the conditions of this
|
13759 |
|
|
License. If you cannot convey a covered work so as to satisfy
|
13760 |
|
|
simultaneously your obligations under this License and any other
|
13761 |
|
|
pertinent obligations, then as a consequence you may not convey it
|
13762 |
|
|
at all. For example, if you agree to terms that obligate you to
|
13763 |
|
|
collect a royalty for further conveying from those to whom you
|
13764 |
|
|
convey the Program, the only way you could satisfy both those
|
13765 |
|
|
terms and this License would be to refrain entirely from conveying
|
13766 |
|
|
the Program.
|
13767 |
|
|
|
13768 |
|
|
13. Use with the GNU Affero General Public License.
|
13769 |
|
|
|
13770 |
|
|
Notwithstanding any other provision of this License, you have
|
13771 |
|
|
permission to link or combine any covered work with a work licensed
|
13772 |
|
|
under version 3 of the GNU Affero General Public License into a
|
13773 |
|
|
single combined work, and to convey the resulting work. The terms
|
13774 |
|
|
of this License will continue to apply to the part which is the
|
13775 |
|
|
covered work, but the special requirements of the GNU Affero
|
13776 |
|
|
General Public License, section 13, concerning interaction through
|
13777 |
|
|
a network will apply to the combination as such.
|
13778 |
|
|
|
13779 |
|
|
14. Revised Versions of this License.
|
13780 |
|
|
|
13781 |
|
|
The Free Software Foundation may publish revised and/or new
|
13782 |
|
|
versions of the GNU General Public License from time to time.
|
13783 |
|
|
Such new versions will be similar in spirit to the present
|
13784 |
|
|
version, but may differ in detail to address new problems or
|
13785 |
|
|
concerns.
|
13786 |
|
|
|
13787 |
|
|
Each version is given a distinguishing version number. If the
|
13788 |
|
|
Program specifies that a certain numbered version of the GNU
|
13789 |
|
|
General Public License "or any later version" applies to it, you
|
13790 |
|
|
have the option of following the terms and conditions either of
|
13791 |
|
|
that numbered version or of any later version published by the
|
13792 |
|
|
Free Software Foundation. If the Program does not specify a
|
13793 |
|
|
version number of the GNU General Public License, you may choose
|
13794 |
|
|
any version ever published by the Free Software Foundation.
|
13795 |
|
|
|
13796 |
|
|
If the Program specifies that a proxy can decide which future
|
13797 |
|
|
versions of the GNU General Public License can be used, that
|
13798 |
|
|
proxy's public statement of acceptance of a version permanently
|
13799 |
|
|
authorizes you to choose that version for the Program.
|
13800 |
|
|
|
13801 |
|
|
Later license versions may give you additional or different
|
13802 |
|
|
permissions. However, no additional obligations are imposed on any
|
13803 |
|
|
author or copyright holder as a result of your choosing to follow a
|
13804 |
|
|
later version.
|
13805 |
|
|
|
13806 |
|
|
15. Disclaimer of Warranty.
|
13807 |
|
|
|
13808 |
|
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
13809 |
|
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
|
13810 |
|
|
COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
|
13811 |
|
|
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
|
13812 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
13813 |
|
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
|
13814 |
|
|
RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
|
13815 |
|
|
SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
|
13816 |
|
|
NECESSARY SERVICING, REPAIR OR CORRECTION.
|
13817 |
|
|
|
13818 |
|
|
16. Limitation of Liability.
|
13819 |
|
|
|
13820 |
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
13821 |
|
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
|
13822 |
|
|
AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
|
13823 |
|
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
13824 |
|
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
|
13825 |
|
|
THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
|
13826 |
|
|
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
13827 |
|
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
13828 |
|
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
|
13829 |
|
|
THE POSSIBILITY OF SUCH DAMAGES.
|
13830 |
|
|
|
13831 |
|
|
17. Interpretation of Sections 15 and 16.
|
13832 |
|
|
|
13833 |
|
|
If the disclaimer of warranty and limitation of liability provided
|
13834 |
|
|
above cannot be given local legal effect according to their terms,
|
13835 |
|
|
reviewing courts shall apply local law that most closely
|
13836 |
|
|
approximates an absolute waiver of all civil liability in
|
13837 |
|
|
connection with the Program, unless a warranty or assumption of
|
13838 |
|
|
liability accompanies a copy of the Program in return for a fee.
|
13839 |
|
|
|
13840 |
|
|
|
13841 |
|
|
END OF TERMS AND CONDITIONS
|
13842 |
|
|
===========================
|
13843 |
|
|
|
13844 |
|
|
How to Apply These Terms to Your New Programs
|
13845 |
|
|
=============================================
|
13846 |
|
|
|
13847 |
|
|
If you develop a new program, and you want it to be of the greatest
|
13848 |
|
|
possible use to the public, the best way to achieve this is to make it
|
13849 |
|
|
free software which everyone can redistribute and change under these
|
13850 |
|
|
terms.
|
13851 |
|
|
|
13852 |
|
|
To do so, attach the following notices to the program. It is safest
|
13853 |
|
|
to attach them to the start of each source file to most effectively
|
13854 |
|
|
state the exclusion of warranty; and each file should have at least the
|
13855 |
|
|
"copyright" line and a pointer to where the full notice is found.
|
13856 |
|
|
|
13857 |
|
|
ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
|
13858 |
|
|
Copyright (C) YEAR NAME OF AUTHOR
|
13859 |
|
|
|
13860 |
|
|
This program is free software: you can redistribute it and/or modify
|
13861 |
|
|
it under the terms of the GNU General Public License as published by
|
13862 |
|
|
the Free Software Foundation, either version 3 of the License, or (at
|
13863 |
|
|
your option) any later version.
|
13864 |
|
|
|
13865 |
|
|
This program is distributed in the hope that it will be useful, but
|
13866 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
13867 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13868 |
|
|
General Public License for more details.
|
13869 |
|
|
|
13870 |
|
|
You should have received a copy of the GNU General Public License
|
13871 |
|
|
along with this program. If not, see `http://www.gnu.org/licenses/'.
|
13872 |
|
|
|
13873 |
|
|
Also add information on how to contact you by electronic and paper
|
13874 |
|
|
mail.
|
13875 |
|
|
|
13876 |
|
|
If the program does terminal interaction, make it output a short
|
13877 |
|
|
notice like this when it starts in an interactive mode:
|
13878 |
|
|
|
13879 |
|
|
PROGRAM Copyright (C) YEAR NAME OF AUTHOR
|
13880 |
|
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
13881 |
|
|
This is free software, and you are welcome to redistribute it
|
13882 |
|
|
under certain conditions; type `show c' for details.
|
13883 |
|
|
|
13884 |
|
|
The hypothetical commands `show w' and `show c' should show the
|
13885 |
|
|
appropriate parts of the General Public License. Of course, your
|
13886 |
|
|
program's commands might be different; for a GUI interface, you would
|
13887 |
|
|
use an "about box".
|
13888 |
|
|
|
13889 |
|
|
You should also get your employer (if you work as a programmer) or
|
13890 |
|
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
13891 |
|
|
necessary. For more information on this, and how to apply and follow
|
13892 |
|
|
the GNU GPL, see `http://www.gnu.org/licenses/'.
|
13893 |
|
|
|
13894 |
|
|
The GNU General Public License does not permit incorporating your
|
13895 |
|
|
program into proprietary programs. If your program is a subroutine
|
13896 |
|
|
library, you may consider it more useful to permit linking proprietary
|
13897 |
|
|
applications with the library. If this is what you want to do, use the
|
13898 |
|
|
GNU Lesser General Public License instead of this License. But first,
|
13899 |
|
|
please read `http://www.gnu.org/philosophy/why-not-lgpl.html'.
|
13900 |
|
|
|
13901 |
|
|
|
13902 |
|
|
File: gfortran.info, Node: GNU Free Documentation License, Next: Funding, Prev: Copying, Up: Top
|
13903 |
|
|
|
13904 |
|
|
GNU Free Documentation License
|
13905 |
|
|
******************************
|
13906 |
|
|
|
13907 |
|
|
Version 1.2, November 2002
|
13908 |
|
|
|
13909 |
|
|
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
|
13910 |
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
13911 |
|
|
|
13912 |
|
|
Everyone is permitted to copy and distribute verbatim copies
|
13913 |
|
|
of this license document, but changing it is not allowed.
|
13914 |
|
|
|
13915 |
|
|
0. PREAMBLE
|
13916 |
|
|
|
13917 |
|
|
The purpose of this License is to make a manual, textbook, or other
|
13918 |
|
|
functional and useful document "free" in the sense of freedom: to
|
13919 |
|
|
assure everyone the effective freedom to copy and redistribute it,
|
13920 |
|
|
with or without modifying it, either commercially or
|
13921 |
|
|
noncommercially. Secondarily, this License preserves for the
|
13922 |
|
|
author and publisher a way to get credit for their work, while not
|
13923 |
|
|
being considered responsible for modifications made by others.
|
13924 |
|
|
|
13925 |
|
|
This License is a kind of "copyleft", which means that derivative
|
13926 |
|
|
works of the document must themselves be free in the same sense.
|
13927 |
|
|
It complements the GNU General Public License, which is a copyleft
|
13928 |
|
|
license designed for free software.
|
13929 |
|
|
|
13930 |
|
|
We have designed this License in order to use it for manuals for
|
13931 |
|
|
free software, because free software needs free documentation: a
|
13932 |
|
|
free program should come with manuals providing the same freedoms
|
13933 |
|
|
that the software does. But this License is not limited to
|
13934 |
|
|
software manuals; it can be used for any textual work, regardless
|
13935 |
|
|
of subject matter or whether it is published as a printed book.
|
13936 |
|
|
We recommend this License principally for works whose purpose is
|
13937 |
|
|
instruction or reference.
|
13938 |
|
|
|
13939 |
|
|
1. APPLICABILITY AND DEFINITIONS
|
13940 |
|
|
|
13941 |
|
|
This License applies to any manual or other work, in any medium,
|
13942 |
|
|
that contains a notice placed by the copyright holder saying it
|
13943 |
|
|
can be distributed under the terms of this License. Such a notice
|
13944 |
|
|
grants a world-wide, royalty-free license, unlimited in duration,
|
13945 |
|
|
to use that work under the conditions stated herein. The
|
13946 |
|
|
"Document", below, refers to any such manual or work. Any member
|
13947 |
|
|
of the public is a licensee, and is addressed as "you". You
|
13948 |
|
|
accept the license if you copy, modify or distribute the work in a
|
13949 |
|
|
way requiring permission under copyright law.
|
13950 |
|
|
|
13951 |
|
|
A "Modified Version" of the Document means any work containing the
|
13952 |
|
|
Document or a portion of it, either copied verbatim, or with
|
13953 |
|
|
modifications and/or translated into another language.
|
13954 |
|
|
|
13955 |
|
|
A "Secondary Section" is a named appendix or a front-matter section
|
13956 |
|
|
of the Document that deals exclusively with the relationship of the
|
13957 |
|
|
publishers or authors of the Document to the Document's overall
|
13958 |
|
|
subject (or to related matters) and contains nothing that could
|
13959 |
|
|
fall directly within that overall subject. (Thus, if the Document
|
13960 |
|
|
is in part a textbook of mathematics, a Secondary Section may not
|
13961 |
|
|
explain any mathematics.) The relationship could be a matter of
|
13962 |
|
|
historical connection with the subject or with related matters, or
|
13963 |
|
|
of legal, commercial, philosophical, ethical or political position
|
13964 |
|
|
regarding them.
|
13965 |
|
|
|
13966 |
|
|
The "Invariant Sections" are certain Secondary Sections whose
|
13967 |
|
|
titles are designated, as being those of Invariant Sections, in
|
13968 |
|
|
the notice that says that the Document is released under this
|
13969 |
|
|
License. If a section does not fit the above definition of
|
13970 |
|
|
Secondary then it is not allowed to be designated as Invariant.
|
13971 |
|
|
The Document may contain zero Invariant Sections. If the Document
|
13972 |
|
|
does not identify any Invariant Sections then there are none.
|
13973 |
|
|
|
13974 |
|
|
The "Cover Texts" are certain short passages of text that are
|
13975 |
|
|
listed, as Front-Cover Texts or Back-Cover Texts, in the notice
|
13976 |
|
|
that says that the Document is released under this License. A
|
13977 |
|
|
Front-Cover Text may be at most 5 words, and a Back-Cover Text may
|
13978 |
|
|
be at most 25 words.
|
13979 |
|
|
|
13980 |
|
|
A "Transparent" copy of the Document means a machine-readable copy,
|
13981 |
|
|
represented in a format whose specification is available to the
|
13982 |
|
|
general public, that is suitable for revising the document
|
13983 |
|
|
straightforwardly with generic text editors or (for images
|
13984 |
|
|
composed of pixels) generic paint programs or (for drawings) some
|
13985 |
|
|
widely available drawing editor, and that is suitable for input to
|
13986 |
|
|
text formatters or for automatic translation to a variety of
|
13987 |
|
|
formats suitable for input to text formatters. A copy made in an
|
13988 |
|
|
otherwise Transparent file format whose markup, or absence of
|
13989 |
|
|
markup, has been arranged to thwart or discourage subsequent
|
13990 |
|
|
modification by readers is not Transparent. An image format is
|
13991 |
|
|
not Transparent if used for any substantial amount of text. A
|
13992 |
|
|
copy that is not "Transparent" is called "Opaque".
|
13993 |
|
|
|
13994 |
|
|
Examples of suitable formats for Transparent copies include plain
|
13995 |
|
|
ASCII without markup, Texinfo input format, LaTeX input format,
|
13996 |
|
|
SGML or XML using a publicly available DTD, and
|
13997 |
|
|
standard-conforming simple HTML, PostScript or PDF designed for
|
13998 |
|
|
human modification. Examples of transparent image formats include
|
13999 |
|
|
PNG, XCF and JPG. Opaque formats include proprietary formats that
|
14000 |
|
|
can be read and edited only by proprietary word processors, SGML or
|
14001 |
|
|
XML for which the DTD and/or processing tools are not generally
|
14002 |
|
|
available, and the machine-generated HTML, PostScript or PDF
|
14003 |
|
|
produced by some word processors for output purposes only.
|
14004 |
|
|
|
14005 |
|
|
The "Title Page" means, for a printed book, the title page itself,
|
14006 |
|
|
plus such following pages as are needed to hold, legibly, the
|
14007 |
|
|
material this License requires to appear in the title page. For
|
14008 |
|
|
works in formats which do not have any title page as such, "Title
|
14009 |
|
|
Page" means the text near the most prominent appearance of the
|
14010 |
|
|
work's title, preceding the beginning of the body of the text.
|
14011 |
|
|
|
14012 |
|
|
A section "Entitled XYZ" means a named subunit of the Document
|
14013 |
|
|
whose title either is precisely XYZ or contains XYZ in parentheses
|
14014 |
|
|
following text that translates XYZ in another language. (Here XYZ
|
14015 |
|
|
stands for a specific section name mentioned below, such as
|
14016 |
|
|
"Acknowledgements", "Dedications", "Endorsements", or "History".)
|
14017 |
|
|
To "Preserve the Title" of such a section when you modify the
|
14018 |
|
|
Document means that it remains a section "Entitled XYZ" according
|
14019 |
|
|
to this definition.
|
14020 |
|
|
|
14021 |
|
|
The Document may include Warranty Disclaimers next to the notice
|
14022 |
|
|
which states that this License applies to the Document. These
|
14023 |
|
|
Warranty Disclaimers are considered to be included by reference in
|
14024 |
|
|
this License, but only as regards disclaiming warranties: any other
|
14025 |
|
|
implication that these Warranty Disclaimers may have is void and
|
14026 |
|
|
has no effect on the meaning of this License.
|
14027 |
|
|
|
14028 |
|
|
2. VERBATIM COPYING
|
14029 |
|
|
|
14030 |
|
|
You may copy and distribute the Document in any medium, either
|
14031 |
|
|
commercially or noncommercially, provided that this License, the
|
14032 |
|
|
copyright notices, and the license notice saying this License
|
14033 |
|
|
applies to the Document are reproduced in all copies, and that you
|
14034 |
|
|
add no other conditions whatsoever to those of this License. You
|
14035 |
|
|
may not use technical measures to obstruct or control the reading
|
14036 |
|
|
or further copying of the copies you make or distribute. However,
|
14037 |
|
|
you may accept compensation in exchange for copies. If you
|
14038 |
|
|
distribute a large enough number of copies you must also follow
|
14039 |
|
|
the conditions in section 3.
|
14040 |
|
|
|
14041 |
|
|
You may also lend copies, under the same conditions stated above,
|
14042 |
|
|
and you may publicly display copies.
|
14043 |
|
|
|
14044 |
|
|
3. COPYING IN QUANTITY
|
14045 |
|
|
|
14046 |
|
|
If you publish printed copies (or copies in media that commonly
|
14047 |
|
|
have printed covers) of the Document, numbering more than 100, and
|
14048 |
|
|
the Document's license notice requires Cover Texts, you must
|
14049 |
|
|
enclose the copies in covers that carry, clearly and legibly, all
|
14050 |
|
|
these Cover Texts: Front-Cover Texts on the front cover, and
|
14051 |
|
|
Back-Cover Texts on the back cover. Both covers must also clearly
|
14052 |
|
|
and legibly identify you as the publisher of these copies. The
|
14053 |
|
|
front cover must present the full title with all words of the
|
14054 |
|
|
title equally prominent and visible. You may add other material
|
14055 |
|
|
on the covers in addition. Copying with changes limited to the
|
14056 |
|
|
covers, as long as they preserve the title of the Document and
|
14057 |
|
|
satisfy these conditions, can be treated as verbatim copying in
|
14058 |
|
|
other respects.
|
14059 |
|
|
|
14060 |
|
|
If the required texts for either cover are too voluminous to fit
|
14061 |
|
|
legibly, you should put the first ones listed (as many as fit
|
14062 |
|
|
reasonably) on the actual cover, and continue the rest onto
|
14063 |
|
|
adjacent pages.
|
14064 |
|
|
|
14065 |
|
|
If you publish or distribute Opaque copies of the Document
|
14066 |
|
|
numbering more than 100, you must either include a
|
14067 |
|
|
machine-readable Transparent copy along with each Opaque copy, or
|
14068 |
|
|
state in or with each Opaque copy a computer-network location from
|
14069 |
|
|
which the general network-using public has access to download
|
14070 |
|
|
using public-standard network protocols a complete Transparent
|
14071 |
|
|
copy of the Document, free of added material. If you use the
|
14072 |
|
|
latter option, you must take reasonably prudent steps, when you
|
14073 |
|
|
begin distribution of Opaque copies in quantity, to ensure that
|
14074 |
|
|
this Transparent copy will remain thus accessible at the stated
|
14075 |
|
|
location until at least one year after the last time you
|
14076 |
|
|
distribute an Opaque copy (directly or through your agents or
|
14077 |
|
|
retailers) of that edition to the public.
|
14078 |
|
|
|
14079 |
|
|
It is requested, but not required, that you contact the authors of
|
14080 |
|
|
the Document well before redistributing any large number of
|
14081 |
|
|
copies, to give them a chance to provide you with an updated
|
14082 |
|
|
version of the Document.
|
14083 |
|
|
|
14084 |
|
|
4. MODIFICATIONS
|
14085 |
|
|
|
14086 |
|
|
You may copy and distribute a Modified Version of the Document
|
14087 |
|
|
under the conditions of sections 2 and 3 above, provided that you
|
14088 |
|
|
release the Modified Version under precisely this License, with
|
14089 |
|
|
the Modified Version filling the role of the Document, thus
|
14090 |
|
|
licensing distribution and modification of the Modified Version to
|
14091 |
|
|
whoever possesses a copy of it. In addition, you must do these
|
14092 |
|
|
things in the Modified Version:
|
14093 |
|
|
|
14094 |
|
|
A. Use in the Title Page (and on the covers, if any) a title
|
14095 |
|
|
distinct from that of the Document, and from those of
|
14096 |
|
|
previous versions (which should, if there were any, be listed
|
14097 |
|
|
in the History section of the Document). You may use the
|
14098 |
|
|
same title as a previous version if the original publisher of
|
14099 |
|
|
that version gives permission.
|
14100 |
|
|
|
14101 |
|
|
B. List on the Title Page, as authors, one or more persons or
|
14102 |
|
|
entities responsible for authorship of the modifications in
|
14103 |
|
|
the Modified Version, together with at least five of the
|
14104 |
|
|
principal authors of the Document (all of its principal
|
14105 |
|
|
authors, if it has fewer than five), unless they release you
|
14106 |
|
|
from this requirement.
|
14107 |
|
|
|
14108 |
|
|
C. State on the Title page the name of the publisher of the
|
14109 |
|
|
Modified Version, as the publisher.
|
14110 |
|
|
|
14111 |
|
|
D. Preserve all the copyright notices of the Document.
|
14112 |
|
|
|
14113 |
|
|
E. Add an appropriate copyright notice for your modifications
|
14114 |
|
|
adjacent to the other copyright notices.
|
14115 |
|
|
|
14116 |
|
|
F. Include, immediately after the copyright notices, a license
|
14117 |
|
|
notice giving the public permission to use the Modified
|
14118 |
|
|
Version under the terms of this License, in the form shown in
|
14119 |
|
|
the Addendum below.
|
14120 |
|
|
|
14121 |
|
|
G. Preserve in that license notice the full lists of Invariant
|
14122 |
|
|
Sections and required Cover Texts given in the Document's
|
14123 |
|
|
license notice.
|
14124 |
|
|
|
14125 |
|
|
H. Include an unaltered copy of this License.
|
14126 |
|
|
|
14127 |
|
|
I. Preserve the section Entitled "History", Preserve its Title,
|
14128 |
|
|
and add to it an item stating at least the title, year, new
|
14129 |
|
|
authors, and publisher of the Modified Version as given on
|
14130 |
|
|
the Title Page. If there is no section Entitled "History" in
|
14131 |
|
|
the Document, create one stating the title, year, authors,
|
14132 |
|
|
and publisher of the Document as given on its Title Page,
|
14133 |
|
|
then add an item describing the Modified Version as stated in
|
14134 |
|
|
the previous sentence.
|
14135 |
|
|
|
14136 |
|
|
J. Preserve the network location, if any, given in the Document
|
14137 |
|
|
for public access to a Transparent copy of the Document, and
|
14138 |
|
|
likewise the network locations given in the Document for
|
14139 |
|
|
previous versions it was based on. These may be placed in
|
14140 |
|
|
the "History" section. You may omit a network location for a
|
14141 |
|
|
work that was published at least four years before the
|
14142 |
|
|
Document itself, or if the original publisher of the version
|
14143 |
|
|
it refers to gives permission.
|
14144 |
|
|
|
14145 |
|
|
K. For any section Entitled "Acknowledgements" or "Dedications",
|
14146 |
|
|
Preserve the Title of the section, and preserve in the
|
14147 |
|
|
section all the substance and tone of each of the contributor
|
14148 |
|
|
acknowledgements and/or dedications given therein.
|
14149 |
|
|
|
14150 |
|
|
L. Preserve all the Invariant Sections of the Document,
|
14151 |
|
|
unaltered in their text and in their titles. Section numbers
|
14152 |
|
|
or the equivalent are not considered part of the section
|
14153 |
|
|
titles.
|
14154 |
|
|
|
14155 |
|
|
M. Delete any section Entitled "Endorsements". Such a section
|
14156 |
|
|
may not be included in the Modified Version.
|
14157 |
|
|
|
14158 |
|
|
N. Do not retitle any existing section to be Entitled
|
14159 |
|
|
"Endorsements" or to conflict in title with any Invariant
|
14160 |
|
|
Section.
|
14161 |
|
|
|
14162 |
|
|
O. Preserve any Warranty Disclaimers.
|
14163 |
|
|
|
14164 |
|
|
If the Modified Version includes new front-matter sections or
|
14165 |
|
|
appendices that qualify as Secondary Sections and contain no
|
14166 |
|
|
material copied from the Document, you may at your option
|
14167 |
|
|
designate some or all of these sections as invariant. To do this,
|
14168 |
|
|
add their titles to the list of Invariant Sections in the Modified
|
14169 |
|
|
Version's license notice. These titles must be distinct from any
|
14170 |
|
|
other section titles.
|
14171 |
|
|
|
14172 |
|
|
You may add a section Entitled "Endorsements", provided it contains
|
14173 |
|
|
nothing but endorsements of your Modified Version by various
|
14174 |
|
|
parties--for example, statements of peer review or that the text
|
14175 |
|
|
has been approved by an organization as the authoritative
|
14176 |
|
|
definition of a standard.
|
14177 |
|
|
|
14178 |
|
|
You may add a passage of up to five words as a Front-Cover Text,
|
14179 |
|
|
and a passage of up to 25 words as a Back-Cover Text, to the end
|
14180 |
|
|
of the list of Cover Texts in the Modified Version. Only one
|
14181 |
|
|
passage of Front-Cover Text and one of Back-Cover Text may be
|
14182 |
|
|
added by (or through arrangements made by) any one entity. If the
|
14183 |
|
|
Document already includes a cover text for the same cover,
|
14184 |
|
|
previously added by you or by arrangement made by the same entity
|
14185 |
|
|
you are acting on behalf of, you may not add another; but you may
|
14186 |
|
|
replace the old one, on explicit permission from the previous
|
14187 |
|
|
publisher that added the old one.
|
14188 |
|
|
|
14189 |
|
|
The author(s) and publisher(s) of the Document do not by this
|
14190 |
|
|
License give permission to use their names for publicity for or to
|
14191 |
|
|
assert or imply endorsement of any Modified Version.
|
14192 |
|
|
|
14193 |
|
|
5. COMBINING DOCUMENTS
|
14194 |
|
|
|
14195 |
|
|
You may combine the Document with other documents released under
|
14196 |
|
|
this License, under the terms defined in section 4 above for
|
14197 |
|
|
modified versions, provided that you include in the combination
|
14198 |
|
|
all of the Invariant Sections of all of the original documents,
|
14199 |
|
|
unmodified, and list them all as Invariant Sections of your
|
14200 |
|
|
combined work in its license notice, and that you preserve all
|
14201 |
|
|
their Warranty Disclaimers.
|
14202 |
|
|
|
14203 |
|
|
The combined work need only contain one copy of this License, and
|
14204 |
|
|
multiple identical Invariant Sections may be replaced with a single
|
14205 |
|
|
copy. If there are multiple Invariant Sections with the same name
|
14206 |
|
|
but different contents, make the title of each such section unique
|
14207 |
|
|
by adding at the end of it, in parentheses, the name of the
|
14208 |
|
|
original author or publisher of that section if known, or else a
|
14209 |
|
|
unique number. Make the same adjustment to the section titles in
|
14210 |
|
|
the list of Invariant Sections in the license notice of the
|
14211 |
|
|
combined work.
|
14212 |
|
|
|
14213 |
|
|
In the combination, you must combine any sections Entitled
|
14214 |
|
|
"History" in the various original documents, forming one section
|
14215 |
|
|
Entitled "History"; likewise combine any sections Entitled
|
14216 |
|
|
"Acknowledgements", and any sections Entitled "Dedications". You
|
14217 |
|
|
must delete all sections Entitled "Endorsements."
|
14218 |
|
|
|
14219 |
|
|
6. COLLECTIONS OF DOCUMENTS
|
14220 |
|
|
|
14221 |
|
|
You may make a collection consisting of the Document and other
|
14222 |
|
|
documents released under this License, and replace the individual
|
14223 |
|
|
copies of this License in the various documents with a single copy
|
14224 |
|
|
that is included in the collection, provided that you follow the
|
14225 |
|
|
rules of this License for verbatim copying of each of the
|
14226 |
|
|
documents in all other respects.
|
14227 |
|
|
|
14228 |
|
|
You may extract a single document from such a collection, and
|
14229 |
|
|
distribute it individually under this License, provided you insert
|
14230 |
|
|
a copy of this License into the extracted document, and follow
|
14231 |
|
|
this License in all other respects regarding verbatim copying of
|
14232 |
|
|
that document.
|
14233 |
|
|
|
14234 |
|
|
7. AGGREGATION WITH INDEPENDENT WORKS
|
14235 |
|
|
|
14236 |
|
|
A compilation of the Document or its derivatives with other
|
14237 |
|
|
separate and independent documents or works, in or on a volume of
|
14238 |
|
|
a storage or distribution medium, is called an "aggregate" if the
|
14239 |
|
|
copyright resulting from the compilation is not used to limit the
|
14240 |
|
|
legal rights of the compilation's users beyond what the individual
|
14241 |
|
|
works permit. When the Document is included in an aggregate, this
|
14242 |
|
|
License does not apply to the other works in the aggregate which
|
14243 |
|
|
are not themselves derivative works of the Document.
|
14244 |
|
|
|
14245 |
|
|
If the Cover Text requirement of section 3 is applicable to these
|
14246 |
|
|
copies of the Document, then if the Document is less than one half
|
14247 |
|
|
of the entire aggregate, the Document's Cover Texts may be placed
|
14248 |
|
|
on covers that bracket the Document within the aggregate, or the
|
14249 |
|
|
electronic equivalent of covers if the Document is in electronic
|
14250 |
|
|
form. Otherwise they must appear on printed covers that bracket
|
14251 |
|
|
the whole aggregate.
|
14252 |
|
|
|
14253 |
|
|
8. TRANSLATION
|
14254 |
|
|
|
14255 |
|
|
Translation is considered a kind of modification, so you may
|
14256 |
|
|
distribute translations of the Document under the terms of section
|
14257 |
|
|
4. Replacing Invariant Sections with translations requires special
|
14258 |
|
|
permission from their copyright holders, but you may include
|
14259 |
|
|
translations of some or all Invariant Sections in addition to the
|
14260 |
|
|
original versions of these Invariant Sections. You may include a
|
14261 |
|
|
translation of this License, and all the license notices in the
|
14262 |
|
|
Document, and any Warranty Disclaimers, provided that you also
|
14263 |
|
|
include the original English version of this License and the
|
14264 |
|
|
original versions of those notices and disclaimers. In case of a
|
14265 |
|
|
disagreement between the translation and the original version of
|
14266 |
|
|
this License or a notice or disclaimer, the original version will
|
14267 |
|
|
prevail.
|
14268 |
|
|
|
14269 |
|
|
If a section in the Document is Entitled "Acknowledgements",
|
14270 |
|
|
"Dedications", or "History", the requirement (section 4) to
|
14271 |
|
|
Preserve its Title (section 1) will typically require changing the
|
14272 |
|
|
actual title.
|
14273 |
|
|
|
14274 |
|
|
9. TERMINATION
|
14275 |
|
|
|
14276 |
|
|
You may not copy, modify, sublicense, or distribute the Document
|
14277 |
|
|
except as expressly provided for under this License. Any other
|
14278 |
|
|
attempt to copy, modify, sublicense or distribute the Document is
|
14279 |
|
|
void, and will automatically terminate your rights under this
|
14280 |
|
|
License. However, parties who have received copies, or rights,
|
14281 |
|
|
from you under this License will not have their licenses
|
14282 |
|
|
terminated so long as such parties remain in full compliance.
|
14283 |
|
|
|
14284 |
|
|
10. FUTURE REVISIONS OF THIS LICENSE
|
14285 |
|
|
|
14286 |
|
|
The Free Software Foundation may publish new, revised versions of
|
14287 |
|
|
the GNU Free Documentation License from time to time. Such new
|
14288 |
|
|
versions will be similar in spirit to the present version, but may
|
14289 |
|
|
differ in detail to address new problems or concerns. See
|
14290 |
|
|
`http://www.gnu.org/copyleft/'.
|
14291 |
|
|
|
14292 |
|
|
Each version of the License is given a distinguishing version
|
14293 |
|
|
number. If the Document specifies that a particular numbered
|
14294 |
|
|
version of this License "or any later version" applies to it, you
|
14295 |
|
|
have the option of following the terms and conditions either of
|
14296 |
|
|
that specified version or of any later version that has been
|
14297 |
|
|
published (not as a draft) by the Free Software Foundation. If
|
14298 |
|
|
the Document does not specify a version number of this License,
|
14299 |
|
|
you may choose any version ever published (not as a draft) by the
|
14300 |
|
|
Free Software Foundation.
|
14301 |
|
|
|
14302 |
|
|
ADDENDUM: How to use this License for your documents
|
14303 |
|
|
====================================================
|
14304 |
|
|
|
14305 |
|
|
To use this License in a document you have written, include a copy of
|
14306 |
|
|
the License in the document and put the following copyright and license
|
14307 |
|
|
notices just after the title page:
|
14308 |
|
|
|
14309 |
|
|
Copyright (C) YEAR YOUR NAME.
|
14310 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
14311 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2
|
14312 |
|
|
or any later version published by the Free Software Foundation;
|
14313 |
|
|
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
14314 |
|
|
Texts. A copy of the license is included in the section entitled ``GNU
|
14315 |
|
|
Free Documentation License''.
|
14316 |
|
|
|
14317 |
|
|
If you have Invariant Sections, Front-Cover Texts and Back-Cover
|
14318 |
|
|
Texts, replace the "with...Texts." line with this:
|
14319 |
|
|
|
14320 |
|
|
with the Invariant Sections being LIST THEIR TITLES, with
|
14321 |
|
|
the Front-Cover Texts being LIST, and with the Back-Cover Texts
|
14322 |
|
|
being LIST.
|
14323 |
|
|
|
14324 |
|
|
If you have Invariant Sections without Cover Texts, or some other
|
14325 |
|
|
combination of the three, merge those two alternatives to suit the
|
14326 |
|
|
situation.
|
14327 |
|
|
|
14328 |
|
|
If your document contains nontrivial examples of program code, we
|
14329 |
|
|
recommend releasing these examples in parallel under your choice of
|
14330 |
|
|
free software license, such as the GNU General Public License, to
|
14331 |
|
|
permit their use in free software.
|
14332 |
|
|
|
14333 |
|
|
|
14334 |
|
|
File: gfortran.info, Node: Funding, Next: Option Index, Prev: GNU Free Documentation License, Up: Top
|
14335 |
|
|
|
14336 |
|
|
Funding Free Software
|
14337 |
|
|
*********************
|
14338 |
|
|
|
14339 |
|
|
If you want to have more free software a few years from now, it makes
|
14340 |
|
|
sense for you to help encourage people to contribute funds for its
|
14341 |
|
|
development. The most effective approach known is to encourage
|
14342 |
|
|
commercial redistributors to donate.
|
14343 |
|
|
|
14344 |
|
|
Users of free software systems can boost the pace of development by
|
14345 |
|
|
encouraging for-a-fee distributors to donate part of their selling price
|
14346 |
|
|
to free software developers--the Free Software Foundation, and others.
|
14347 |
|
|
|
14348 |
|
|
The way to convince distributors to do this is to demand it and
|
14349 |
|
|
expect it from them. So when you compare distributors, judge them
|
14350 |
|
|
partly by how much they give to free software development. Show
|
14351 |
|
|
distributors they must compete to be the one who gives the most.
|
14352 |
|
|
|
14353 |
|
|
To make this approach work, you must insist on numbers that you can
|
14354 |
|
|
compare, such as, "We will donate ten dollars to the Frobnitz project
|
14355 |
|
|
for each disk sold." Don't be satisfied with a vague promise, such as
|
14356 |
|
|
"A portion of the profits are donated," since it doesn't give a basis
|
14357 |
|
|
for comparison.
|
14358 |
|
|
|
14359 |
|
|
Even a precise fraction "of the profits from this disk" is not very
|
14360 |
|
|
meaningful, since creative accounting and unrelated business decisions
|
14361 |
|
|
can greatly alter what fraction of the sales price counts as profit.
|
14362 |
|
|
If the price you pay is $50, ten percent of the profit is probably less
|
14363 |
|
|
than a dollar; it might be a few cents, or nothing at all.
|
14364 |
|
|
|
14365 |
|
|
Some redistributors do development work themselves. This is useful
|
14366 |
|
|
too; but to keep everyone honest, you need to inquire how much they do,
|
14367 |
|
|
and what kind. Some kinds of development make much more long-term
|
14368 |
|
|
difference than others. For example, maintaining a separate version of
|
14369 |
|
|
a program contributes very little; maintaining the standard version of a
|
14370 |
|
|
program for the whole community contributes much. Easy new ports
|
14371 |
|
|
contribute little, since someone else would surely do them; difficult
|
14372 |
|
|
ports such as adding a new CPU to the GNU Compiler Collection
|
14373 |
|
|
contribute more; major new features or packages contribute the most.
|
14374 |
|
|
|
14375 |
|
|
By establishing the idea that supporting further development is "the
|
14376 |
|
|
proper thing to do" when distributing free software for a fee, we can
|
14377 |
|
|
assure a steady flow of resources into making more free software.
|
14378 |
|
|
|
14379 |
|
|
Copyright (C) 1994 Free Software Foundation, Inc.
|
14380 |
|
|
Verbatim copying and redistribution of this section is permitted
|
14381 |
|
|
without royalty; alteration is not permitted.
|
14382 |
|
|
|
14383 |
|
|
|
14384 |
|
|
File: gfortran.info, Node: Option Index, Next: Keyword Index, Prev: Funding, Up: Top
|
14385 |
|
|
|
14386 |
|
|
Option Index
|
14387 |
|
|
************
|
14388 |
|
|
|
14389 |
|
|
`gfortran''s command line options are indexed here without any initial
|
14390 |
|
|
`-' or `--'. Where an option has both positive and negative forms (such
|
14391 |
|
|
as -foption and -fno-option), relevant entries in the manual are
|
14392 |
|
|
indexed under the most appropriate form; it may sometimes be useful to
|
14393 |
|
|
look up both forms.
|
14394 |
|
|
|
14395 |
|
|
|
14396 |
|
|
* Menu:
|
14397 |
|
|
|
14398 |
|
|
* A-PREDICATE=ANSWER: Preprocessing Options.
|
14399 |
|
|
(line 120)
|
14400 |
|
|
* APREDICATE=ANSWER: Preprocessing Options.
|
14401 |
|
|
(line 114)
|
14402 |
|
|
* backslash: Fortran Dialect Options.
|
14403 |
|
|
(line 62)
|
14404 |
|
|
* C: Preprocessing Options.
|
14405 |
|
|
(line 123)
|
14406 |
|
|
* CC: Preprocessing Options.
|
14407 |
|
|
(line 138)
|
14408 |
|
|
* cpp: Preprocessing Options.
|
14409 |
|
|
(line 13)
|
14410 |
|
|
* dD: Preprocessing Options.
|
14411 |
|
|
(line 35)
|
14412 |
|
|
* dI: Preprocessing Options.
|
14413 |
|
|
(line 51)
|
14414 |
|
|
* dM: Preprocessing Options.
|
14415 |
|
|
(line 26)
|
14416 |
|
|
* dN: Preprocessing Options.
|
14417 |
|
|
(line 41)
|
14418 |
|
|
* DNAME: Preprocessing Options.
|
14419 |
|
|
(line 153)
|
14420 |
|
|
* DNAME=DEFINITION: Preprocessing Options.
|
14421 |
|
|
(line 156)
|
14422 |
|
|
* dU: Preprocessing Options.
|
14423 |
|
|
(line 44)
|
14424 |
|
|
* falign-commons: Code Gen Options. (line 304)
|
14425 |
|
|
* fall-intrinsics: Fortran Dialect Options.
|
14426 |
|
|
(line 18)
|
14427 |
|
|
* fbacktrace: Debugging Options. (line 31)
|
14428 |
|
|
* fblas-matmul-limit: Code Gen Options. (line 260)
|
14429 |
|
|
* fbounds-check: Code Gen Options. (line 192)
|
14430 |
|
|
* fcheck: Code Gen Options. (line 143)
|
14431 |
|
|
* fcheck-array-temporaries: Code Gen Options. (line 195)
|
14432 |
|
|
* fconvert=CONVERSION: Runtime Options. (line 9)
|
14433 |
|
|
* fcray-pointer: Fortran Dialect Options.
|
14434 |
|
|
(line 108)
|
14435 |
|
|
* fd-lines-as-code: Fortran Dialect Options.
|
14436 |
|
|
(line 29)
|
14437 |
|
|
* fd-lines-as-comments: Fortran Dialect Options.
|
14438 |
|
|
(line 29)
|
14439 |
|
|
* fdefault-double-8: Fortran Dialect Options.
|
14440 |
|
|
(line 36)
|
14441 |
|
|
* fdefault-integer-8: Fortran Dialect Options.
|
14442 |
|
|
(line 44)
|
14443 |
|
|
* fdefault-real-8: Fortran Dialect Options.
|
14444 |
|
|
(line 49)
|
14445 |
|
|
* fdollar-ok: Fortran Dialect Options.
|
14446 |
|
|
(line 56)
|
14447 |
|
|
* fdump-core: Debugging Options. (line 38)
|
14448 |
|
|
* fdump-parse-tree: Debugging Options. (line 10)
|
14449 |
|
|
* fexternal-blas: Code Gen Options. (line 252)
|
14450 |
|
|
* ff2c: Code Gen Options. (line 25)
|
14451 |
|
|
* ffixed-line-length-N: Fortran Dialect Options.
|
14452 |
|
|
(line 79)
|
14453 |
|
|
* ffpe-trap=LIST: Debugging Options. (line 14)
|
14454 |
|
|
* ffree-form: Fortran Dialect Options.
|
14455 |
|
|
(line 12)
|
14456 |
|
|
* ffree-line-length-N: Fortran Dialect Options.
|
14457 |
|
|
(line 92)
|
14458 |
|
|
* fimplicit-none: Fortran Dialect Options.
|
14459 |
|
|
(line 103)
|
14460 |
|
|
* finit-character: Code Gen Options. (line 284)
|
14461 |
|
|
* finit-integer: Code Gen Options. (line 284)
|
14462 |
|
|
* finit-local-zero: Code Gen Options. (line 284)
|
14463 |
|
|
* finit-logical: Code Gen Options. (line 284)
|
14464 |
|
|
* finit-real: Code Gen Options. (line 284)
|
14465 |
|
|
* fintrinsic-modules-path DIR: Directory Options. (line 40)
|
14466 |
|
|
* fmax-array-constructor: Code Gen Options. (line 198)
|
14467 |
|
|
* fmax-errors=N: Error and Warning Options.
|
14468 |
|
|
(line 27)
|
14469 |
|
|
* fmax-identifier-length=N: Fortran Dialect Options.
|
14470 |
|
|
(line 99)
|
14471 |
|
|
* fmax-stack-var-size: Code Gen Options. (line 216)
|
14472 |
|
|
* fmax-subrecord-length=LENGTH: Runtime Options. (line 36)
|
14473 |
|
|
* fmodule-private: Fortran Dialect Options.
|
14474 |
|
|
(line 74)
|
14475 |
|
|
* fno-automatic: Code Gen Options. (line 15)
|
14476 |
|
|
* fno-fixed-form: Fortran Dialect Options.
|
14477 |
|
|
(line 12)
|
14478 |
|
|
* fno-protect-parens: Code Gen Options. (line 315)
|
14479 |
|
|
* fno-range-check: Runtime Options. (line 20)
|
14480 |
|
|
* fno-underscoring: Code Gen Options. (line 54)
|
14481 |
|
|
* fopenmp: Fortran Dialect Options.
|
14482 |
|
|
(line 112)
|
14483 |
|
|
* fpack-derived: Code Gen Options. (line 230)
|
14484 |
|
|
* fpp: Preprocessing Options.
|
14485 |
|
|
(line 13)
|
14486 |
|
|
* frange-check: Fortran Dialect Options.
|
14487 |
|
|
(line 120)
|
14488 |
|
|
* frecord-marker=LENGTH: Runtime Options. (line 28)
|
14489 |
|
|
* frecursive: Code Gen Options. (line 271)
|
14490 |
|
|
* frepack-arrays: Code Gen Options. (line 236)
|
14491 |
|
|
* fsecond-underscore: Code Gen Options. (line 126)
|
14492 |
|
|
* fshort-enums <1>: Fortran 2003 status. (line 22)
|
14493 |
|
|
* fshort-enums: Code Gen Options. (line 246)
|
14494 |
|
|
* fsign-zero: Runtime Options. (line 41)
|
14495 |
|
|
* fsyntax-only: Error and Warning Options.
|
14496 |
|
|
(line 33)
|
14497 |
|
|
* fwhole-file: Code Gen Options. (line 113)
|
14498 |
|
|
* fworking-directory: Preprocessing Options.
|
14499 |
|
|
(line 55)
|
14500 |
|
|
* H: Preprocessing Options.
|
14501 |
|
|
(line 176)
|
14502 |
|
|
* IDIR: Directory Options. (line 14)
|
14503 |
|
|
* idirafter DIR: Preprocessing Options.
|
14504 |
|
|
(line 70)
|
14505 |
|
|
* imultilib DIR: Preprocessing Options.
|
14506 |
|
|
(line 77)
|
14507 |
|
|
* iprefix PREFIX: Preprocessing Options.
|
14508 |
|
|
(line 81)
|
14509 |
|
|
* iquote DIR: Preprocessing Options.
|
14510 |
|
|
(line 90)
|
14511 |
|
|
* isysroot DIR: Preprocessing Options.
|
14512 |
|
|
(line 86)
|
14513 |
|
|
* isystem DIR: Preprocessing Options.
|
14514 |
|
|
(line 97)
|
14515 |
|
|
* JDIR: Directory Options. (line 31)
|
14516 |
|
|
* MDIR: Directory Options. (line 31)
|
14517 |
|
|
* nostdinc: Preprocessing Options.
|
14518 |
|
|
(line 105)
|
14519 |
|
|
* P: Preprocessing Options.
|
14520 |
|
|
(line 181)
|
14521 |
|
|
* pedantic: Error and Warning Options.
|
14522 |
|
|
(line 38)
|
14523 |
|
|
* pedantic-errors: Error and Warning Options.
|
14524 |
|
|
(line 57)
|
14525 |
|
|
* static-libgfortran: Link Options. (line 11)
|
14526 |
|
|
* std=STD option: Fortran Dialect Options.
|
14527 |
|
|
(line 132)
|
14528 |
|
|
* UNAME: Preprocessing Options.
|
14529 |
|
|
(line 187)
|
14530 |
|
|
* undef: Preprocessing Options.
|
14531 |
|
|
(line 110)
|
14532 |
|
|
* Waliasing: Error and Warning Options.
|
14533 |
|
|
(line 68)
|
14534 |
|
|
* Walign-commons: Error and Warning Options.
|
14535 |
|
|
(line 171)
|
14536 |
|
|
* Wall: Error and Warning Options.
|
14537 |
|
|
(line 61)
|
14538 |
|
|
* Wampersand: Error and Warning Options.
|
14539 |
|
|
(line 85)
|
14540 |
|
|
* Warray-temporaries: Error and Warning Options.
|
14541 |
|
|
(line 93)
|
14542 |
|
|
* Wcharacter-truncation: Error and Warning Options.
|
14543 |
|
|
(line 98)
|
14544 |
|
|
* Wconversion: Error and Warning Options.
|
14545 |
|
|
(line 104)
|
14546 |
|
|
* Werror: Error and Warning Options.
|
14547 |
|
|
(line 177)
|
14548 |
|
|
* Wimplicit-interface: Error and Warning Options.
|
14549 |
|
|
(line 107)
|
14550 |
|
|
* Wimplicit-procedure: Error and Warning Options.
|
14551 |
|
|
(line 113)
|
14552 |
|
|
* Wintrinsic-shadow: Error and Warning Options.
|
14553 |
|
|
(line 158)
|
14554 |
|
|
* Wintrinsics-std: Error and Warning Options.
|
14555 |
|
|
(line 117)
|
14556 |
|
|
* Wline-truncation: Error and Warning Options.
|
14557 |
|
|
(line 101)
|
14558 |
|
|
* Wsurprising: Error and Warning Options.
|
14559 |
|
|
(line 124)
|
14560 |
|
|
* Wtabs: Error and Warning Options.
|
14561 |
|
|
(line 146)
|
14562 |
|
|
* Wunderflow: Error and Warning Options.
|
14563 |
|
|
|
14564 |
|
|
* Wunused-parameter: Error and Warning Options.
|
14565 |
|
|
(line 164)
|
14566 |
|
|
|
14567 |
|
|
|
14568 |
|
|
File: gfortran.info, Node: Keyword Index, Prev: Option Index, Up: Top
|
14569 |
|
|
|
14570 |
|
|
|
14571 |
|
|
*************
|
14572 |
|
|
|
14573 |
|
|
|