1This is gfortran.info, produced by makeinfo version 5.2 from 2gfortran.texi. 3 4Copyright (C) 1999-2014 Free Software Foundation, Inc. 5 6 Permission is granted to copy, distribute and/or modify this document 7under the terms of the GNU Free Documentation License, Version 1.3 or 8any later version published by the Free Software Foundation; with the 9Invariant Sections being "Funding Free Software", the Front-Cover Texts 10being (a) (see below), and with the Back-Cover Texts being (b) (see 11below). A copy of the license is included in the section entitled "GNU 12Free Documentation License". 13 14 (a) The FSF's Front-Cover Text is: 15 16 A GNU Manual 17 18 (b) The FSF's Back-Cover Text is: 19 20 You have freedom to copy and modify this GNU Manual, like GNU 21software. Copies published by the Free Software Foundation raise funds 22for GNU development. 23INFO-DIR-SECTION Software development 24START-INFO-DIR-ENTRY 25* gfortran: (gfortran). The GNU Fortran Compiler. 26END-INFO-DIR-ENTRY 27 28 This file documents the use and the internals of the GNU Fortran 29compiler, ('gfortran'). 30 31 Published by the Free Software Foundation 51 Franklin Street, Fifth 32Floor Boston, MA 02110-1301 USA 33 34 Copyright (C) 1999-2014 Free Software Foundation, Inc. 35 36 Permission is granted to copy, distribute and/or modify this document 37under the terms of the GNU Free Documentation License, Version 1.3 or 38any later version published by the Free Software Foundation; with the 39Invariant Sections being "Funding Free Software", the Front-Cover Texts 40being (a) (see below), and with the Back-Cover Texts being (b) (see 41below). A copy of the license is included in the section entitled "GNU 42Free Documentation License". 43 44 (a) The FSF's Front-Cover Text is: 45 46 A GNU Manual 47 48 (b) The FSF's Back-Cover Text is: 49 50 You have freedom to copy and modify this GNU Manual, like GNU 51software. Copies published by the Free Software Foundation raise funds 52for GNU development. 53 54 55File: gfortran.info, Node: Top, Next: Introduction, Up: (dir) 56 57Introduction 58************ 59 60This manual documents the use of 'gfortran', the GNU Fortran compiler. 61You can find in this manual how to invoke 'gfortran', as well as its 62features and incompatibilities. 63 64* Menu: 65 66* Introduction:: 67 68Part I: Invoking GNU Fortran 69* Invoking GNU Fortran:: Command options supported by 'gfortran'. 70* Runtime:: Influencing runtime behavior with environment variables. 71 72Part II: Language Reference 73* Fortran 2003 and 2008 status:: Fortran 2003 and 2008 features supported by GNU Fortran. 74* Compiler Characteristics:: User-visible implementation details. 75* Extensions:: Language extensions implemented by GNU Fortran. 76* Mixed-Language Programming:: Interoperability with C 77* Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran. 78* Intrinsic Modules:: Intrinsic modules supported by GNU Fortran. 79 80* Contributing:: How you can help. 81* Copying:: GNU General Public License says 82 how you can copy and share GNU Fortran. 83* GNU Free Documentation License:: 84 How you can copy and share this manual. 85* Funding:: How to help assure continued work for free software. 86* Option Index:: Index of command line options 87* Keyword Index:: Index of concepts 88 89 90File: gfortran.info, Node: Introduction, Next: Invoking GNU Fortran, Prev: Top, Up: Top 91 921 Introduction 93************** 94 95The GNU Fortran compiler front end was designed initially as a free 96replacement for, or alternative to, the Unix 'f95' command; 'gfortran' 97is the command you will use to invoke the compiler. 98 99* Menu: 100 101* About GNU Fortran:: What you should know about the GNU Fortran compiler. 102* GNU Fortran and GCC:: You can compile Fortran, C, or other programs. 103* Preprocessing and conditional compilation:: The Fortran preprocessor 104* GNU Fortran and G77:: Why we chose to start from scratch. 105* Project Status:: Status of GNU Fortran, roadmap, proposed extensions. 106* Standards:: Standards supported by GNU Fortran. 107 108 109File: gfortran.info, Node: About GNU Fortran, Next: GNU Fortran and GCC, Up: Introduction 110 1111.1 About GNU Fortran 112===================== 113 114The GNU Fortran compiler supports the Fortran 77, 90 and 95 standards 115completely, parts of the Fortran 2003 and Fortran 2008 standards, and 116several vendor extensions. The development goal is to provide the 117following features: 118 119 * Read a user's program, stored in a file and containing instructions 120 written in Fortran 77, Fortran 90, Fortran 95, Fortran 2003 or 121 Fortran 2008. This file contains "source code". 122 123 * Translate the user's program into instructions a computer can carry 124 out more quickly than it takes to translate the instructions in the 125 first place. The result after compilation of a program is "machine 126 code", code designed to be efficiently translated and processed by 127 a machine such as your computer. Humans usually are not as good 128 writing machine code as they are at writing Fortran (or C++, Ada, 129 or Java), because it is easy to make tiny mistakes writing machine 130 code. 131 132 * Provide the user with information about the reasons why the 133 compiler is unable to create a binary from the source code. 134 Usually this will be the case if the source code is flawed. The 135 Fortran 90 standard requires that the compiler can point out 136 mistakes to the user. An incorrect usage of the language causes an 137 "error message". 138 139 The compiler will also attempt to diagnose cases where the user's 140 program contains a correct usage of the language, but instructs the 141 computer to do something questionable. This kind of diagnostics 142 message is called a "warning message". 143 144 * Provide optional information about the translation passes from the 145 source code to machine code. This can help a user of the compiler 146 to find the cause of certain bugs which may not be obvious in the 147 source code, but may be more easily found at a lower level compiler 148 output. It also helps developers to find bugs in the compiler 149 itself. 150 151 * Provide information in the generated machine code that can make it 152 easier to find bugs in the program (using a debugging tool, called 153 a "debugger", such as the GNU Debugger 'gdb'). 154 155 * Locate and gather machine code already generated to perform actions 156 requested by statements in the user's program. This machine code 157 is organized into "modules" and is located and "linked" to the user 158 program. 159 160 The GNU Fortran compiler consists of several components: 161 162 * A version of the 'gcc' command (which also might be installed as 163 the system's 'cc' command) that also understands and accepts 164 Fortran source code. The 'gcc' command is the "driver" program for 165 all the languages in the GNU Compiler Collection (GCC); With 'gcc', 166 you can compile the source code of any language for which a front 167 end is available in GCC. 168 169 * The 'gfortran' command itself, which also might be installed as the 170 system's 'f95' command. 'gfortran' is just another driver program, 171 but specifically for the Fortran compiler only. The difference 172 with 'gcc' is that 'gfortran' will automatically link the correct 173 libraries to your program. 174 175 * A collection of run-time libraries. These libraries contain the 176 machine code needed to support capabilities of the Fortran language 177 that are not directly provided by the machine code generated by the 178 'gfortran' compilation phase, such as intrinsic functions and 179 subroutines, and routines for interaction with files and the 180 operating system. 181 182 * The Fortran compiler itself, ('f951'). This is the GNU Fortran 183 parser and code generator, linked to and interfaced with the GCC 184 backend library. 'f951' "translates" the source code to assembler 185 code. You would typically not use this program directly; instead, 186 the 'gcc' or 'gfortran' driver programs will call it for you. 187 188 189File: gfortran.info, Node: GNU Fortran and GCC, Next: Preprocessing and conditional compilation, Prev: About GNU Fortran, Up: Introduction 190 1911.2 GNU Fortran and GCC 192======================= 193 194GNU Fortran is a part of GCC, the "GNU Compiler Collection". GCC 195consists of a collection of front ends for various languages, which 196translate the source code into a language-independent form called 197"GENERIC". This is then processed by a common middle end which provides 198optimization, and then passed to one of a collection of back ends which 199generate code for different computer architectures and operating 200systems. 201 202 Functionally, this is implemented with a driver program ('gcc') which 203provides the command-line interface for the compiler. It calls the 204relevant compiler front-end program (e.g., 'f951' for Fortran) for each 205file in the source code, and then calls the assembler and linker as 206appropriate to produce the compiled output. In a copy of GCC which has 207been compiled with Fortran language support enabled, 'gcc' will 208recognize files with '.f', '.for', '.ftn', '.f90', '.f95', '.f03' and 209'.f08' extensions as Fortran source code, and compile it accordingly. A 210'gfortran' driver program is also provided, which is identical to 'gcc' 211except that it automatically links the Fortran runtime libraries into 212the compiled program. 213 214 Source files with '.f', '.for', '.fpp', '.ftn', '.F', '.FOR', '.FPP', 215and '.FTN' extensions are treated as fixed form. Source files with 216'.f90', '.f95', '.f03', '.f08', '.F90', '.F95', '.F03' and '.F08' 217extensions are treated as free form. The capitalized versions of either 218form are run through preprocessing. Source files with the lower case 219'.fpp' extension are also run through preprocessing. 220 221 This manual specifically documents the Fortran front end, which 222handles the programming language's syntax and semantics. The aspects of 223GCC which relate to the optimization passes and the back-end code 224generation are documented in the GCC manual; see *note Introduction: 225(gcc)Top. The two manuals together provide a complete reference for the 226GNU Fortran compiler. 227 228 229File: gfortran.info, Node: Preprocessing and conditional compilation, Next: GNU Fortran and G77, Prev: GNU Fortran and GCC, Up: Introduction 230 2311.3 Preprocessing and conditional compilation 232============================================= 233 234Many Fortran compilers including GNU Fortran allow passing the source 235code through a C preprocessor (CPP; sometimes also called the Fortran 236preprocessor, FPP) to allow for conditional compilation. In the case of 237GNU Fortran, this is the GNU C Preprocessor in the traditional mode. On 238systems with case-preserving file names, the preprocessor is 239automatically invoked if the filename extension is '.F', '.FOR', '.FTN', 240'.fpp', '.FPP', '.F90', '.F95', '.F03' or '.F08'. To manually invoke 241the preprocessor on any file, use '-cpp', to disable preprocessing on 242files where the preprocessor is run automatically, use '-nocpp'. 243 244 If a preprocessed file includes another file with the Fortran 245'INCLUDE' statement, the included file is not preprocessed. To 246preprocess included files, use the equivalent preprocessor statement 247'#include'. 248 249 If GNU Fortran invokes the preprocessor, '__GFORTRAN__' is defined 250and '__GNUC__', '__GNUC_MINOR__' and '__GNUC_PATCHLEVEL__' can be used 251to determine the version of the compiler. See *note Overview: (cpp)Top. 252for details. 253 254 While CPP is the de-facto standard for preprocessing Fortran code, 255Part 3 of the Fortran 95 standard (ISO/IEC 1539-3:1998) defines 256Conditional Compilation, which is not widely used and not directly 257supported by the GNU Fortran compiler. You can use the program coco to 258preprocess such files (<http://www.daniellnagle.com/coco.html>). 259 260 261File: gfortran.info, Node: GNU Fortran and G77, Next: Project Status, Prev: Preprocessing and conditional compilation, Up: Introduction 262 2631.4 GNU Fortran and G77 264======================= 265 266The GNU Fortran compiler is the successor to 'g77', the Fortran 77 front 267end included in GCC prior to version 4. It is an entirely new program 268that has been designed to provide Fortran 95 support and extensibility 269for future Fortran language standards, as well as providing backwards 270compatibility for Fortran 77 and nearly all of the GNU language 271extensions supported by 'g77'. 272 273 274File: gfortran.info, Node: Project Status, Next: Standards, Prev: GNU Fortran and G77, Up: Introduction 275 2761.5 Project Status 277================== 278 279 As soon as 'gfortran' can parse all of the statements correctly, it 280 will be in the "larva" state. When we generate code, the "puppa" 281 state. When 'gfortran' is done, we'll see if it will be a 282 beautiful butterfly, or just a big bug.... 283 284 -Andy Vaught, April 2000 285 286 The start of the GNU Fortran 95 project was announced on the GCC 287homepage in March 18, 2000 (even though Andy had already been working on 288it for a while, of course). 289 290 The GNU Fortran compiler is able to compile nearly all 291standard-compliant Fortran 95, Fortran 90, and Fortran 77 programs, 292including a number of standard and non-standard extensions, and can be 293used on real-world programs. In particular, the supported extensions 294include OpenMP, Cray-style pointers, and several Fortran 2003 and 295Fortran 2008 features, including TR 15581. However, it is still under 296development and has a few remaining rough edges. 297 298 At present, the GNU Fortran compiler passes the NIST Fortran 77 Test 299Suite (http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html), and 300produces acceptable results on the LAPACK Test Suite 301(http://www.netlib.org/lapack/faq.html#1.21). It also provides 302respectable performance on the Polyhedron Fortran compiler benchmarks 303(http://www.polyhedron.com/pb05.html) and the Livermore Fortran Kernels 304test (http://www.llnl.gov/asci_benchmarks/asci/limited/lfk/README.html). 305It has been used to compile a number of large real-world programs, 306including the HIRLAM weather-forecasting code 307(http://mysite.verizon.net/serveall/moene.pdf) and the Tonto quantum 308chemistry package (http://www.theochem.uwa.edu.au/tonto/); see 309<http://gcc.gnu.org/wiki/GfortranApps> for an extended list. 310 311 Among other things, the GNU Fortran compiler is intended as a 312replacement for G77. At this point, nearly all programs that could be 313compiled with G77 can be compiled with GNU Fortran, although there are a 314few minor known regressions. 315 316 The primary work remaining to be done on GNU Fortran falls into three 317categories: bug fixing (primarily regarding the treatment of invalid 318code and providing useful error messages), improving the compiler 319optimizations and the performance of compiled code, and extending the 320compiler to support future standards--in particular, Fortran 2003 and 321Fortran 2008. 322 323 324File: gfortran.info, Node: Standards, Prev: Project Status, Up: Introduction 325 3261.6 Standards 327============= 328 329* Menu: 330 331* Varying Length Character Strings:: 332 333The GNU Fortran compiler implements ISO/IEC 1539:1997 (Fortran 95). As 334such, it can also compile essentially all standard-compliant Fortran 90 335and Fortran 77 programs. It also supports the ISO/IEC TR-15581 336enhancements to allocatable arrays. 337 338 GNU Fortran also have a partial support for ISO/IEC 1539-1:2004 339(Fortran 2003), ISO/IEC 1539-1:2010 (Fortran 2008), the Technical 340Specification 'Further Interoperability of Fortran with C' (ISO/IEC TS 34129113:2012). Full support of those standards and future Fortran 342standards is planned. The current status of the support is can be found 343in the *note Fortran 2003 status::, *note Fortran 2008 status:: and 344*note TS 29113 status:: sections of the documentation. 345 346 Additionally, the GNU Fortran compilers supports the OpenMP 347specification (version 4.0, 348<http://openmp.org/wp/openmp-specifications/>). 349 350 351File: gfortran.info, Node: Varying Length Character Strings, Up: Standards 352 3531.6.1 Varying Length Character Strings 354-------------------------------------- 355 356The Fortran 95 standard specifies in Part 2 (ISO/IEC 1539-2:2000) 357varying length character strings. While GNU Fortran currently does not 358support such strings directly, there exist two Fortran implementations 359for them, which work with GNU Fortran. They can be found at 360<http://www.fortran.com/iso_varying_string.f95> and at 361<ftp://ftp.nag.co.uk/sc22wg5/ISO_VARYING_STRING/>. 362 363 Deferred-length character strings of Fortran 2003 supports part of 364the features of 'ISO_VARYING_STRING' and should be considered as 365replacement. (Namely, allocatable or pointers of the type 366'character(len=:)'.) 367 368 369File: gfortran.info, Node: Invoking GNU Fortran, Next: Runtime, Prev: Introduction, Up: Top 370 3712 GNU Fortran Command Options 372***************************** 373 374The 'gfortran' command supports all the options supported by the 'gcc' 375command. Only options specific to GNU Fortran are documented here. 376 377 *Note GCC Command Options: (gcc)Invoking GCC, for information on the 378non-Fortran-specific aspects of the 'gcc' command (and, therefore, the 379'gfortran' command). 380 381 All GCC and GNU Fortran options are accepted both by 'gfortran' and 382by 'gcc' (as well as any other drivers built at the same time, such as 383'g++'), since adding GNU Fortran to the GCC distribution enables 384acceptance of GNU Fortran options by all of the relevant drivers. 385 386 In some cases, options have positive and negative forms; the negative 387form of '-ffoo' would be '-fno-foo'. This manual documents only one of 388these two forms, whichever one is not the default. 389 390* Menu: 391 392* Option Summary:: Brief list of all 'gfortran' options, 393 without explanations. 394* Fortran Dialect Options:: Controlling the variant of Fortran language 395 compiled. 396* Preprocessing Options:: Enable and customize preprocessing. 397* Error and Warning Options:: How picky should the compiler be? 398* Debugging Options:: Symbol tables, measurements, and debugging dumps. 399* Directory Options:: Where to find module files 400* Link Options :: Influencing the linking step 401* Runtime Options:: Influencing runtime behavior 402* Code Gen Options:: Specifying conventions for function calls, data layout 403 and register usage. 404* Environment Variables:: Environment variables that affect 'gfortran'. 405 406 407File: gfortran.info, Node: Option Summary, Next: Fortran Dialect Options, Up: Invoking GNU Fortran 408 4092.1 Option summary 410================== 411 412Here is a summary of all the options specific to GNU Fortran, grouped by 413type. Explanations are in the following sections. 414 415_Fortran Language Options_ 416 *Note Options controlling Fortran dialect: Fortran Dialect Options. 417 -fall-intrinsics -fbackslash -fcray-pointer -fd-lines-as-code 418 -fd-lines-as-comments -fdefault-double-8 -fdefault-integer-8 419 -fdefault-real-8 -fdollar-ok -ffixed-line-length-N 420 -ffixed-line-length-none -ffree-form -ffree-line-length-N 421 -ffree-line-length-none -fimplicit-none -finteger-4-integer-8 422 -fmax-identifier-length -fmodule-private -fno-fixed-form -fno-range-check 423 -fopenmp -freal-4-real-10 -freal-4-real-16 -freal-4-real-8 424 -freal-8-real-10 -freal-8-real-16 -freal-8-real-4 -std=STD 425 426 427_Preprocessing Options_ 428 *Note Enable and customize preprocessing: Preprocessing Options. 429 -A-QUESTION[=ANSWER] 430 -AQUESTION=ANSWER -C -CC -DMACRO[=DEFN] 431 -H -P 432 -UMACRO -cpp -dD -dI -dM -dN -dU -fworking-directory 433 -imultilib DIR 434 -iprefix FILE -iquote -isysroot DIR -isystem DIR -nocpp 435 -nostdinc 436 -undef 437 438 439_Error and Warning Options_ 440 *Note Options to request or suppress errors and warnings: Error and 441 Warning Options. 442 -Waliasing -Wall -Wampersand -Warray-bounds 443 -Wc-binding-type -Wcharacter-truncation 444 -Wconversion -Wfunction-elimination -Wimplicit-interface 445 -Wimplicit-procedure -Wintrinsic-shadow -Wintrinsics-std 446 -Wline-truncation -Wno-align-commons -Wno-tabs -Wreal-q-constant 447 -Wsurprising -Wunderflow -Wunused-parameter -Wrealloc-lhs -Wrealloc-lhs-all 448 -Wtarget-lifetime -fmax-errors=N -fsyntax-only -pedantic -pedantic-errors 449 450 451_Debugging Options_ 452 *Note Options for debugging your program or GNU Fortran: Debugging 453 Options. 454 -fbacktrace -fdump-fortran-optimized -fdump-fortran-original 455 -fdump-parse-tree -ffpe-trap=LIST -ffpe-summary=LIST 456 457 458_Directory Options_ 459 *Note Options for directory search: Directory Options. 460 -IDIR -JDIR -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 -fmax-subrecord-length=LENGTH 469 -frecord-marker=LENGTH -fsign-zero 470 471 472_Code Generation Options_ 473 *Note Options for code generation conventions: Code Gen Options. 474 -faggressive-function-elimination -fblas-matmul-limit=N 475 -fbounds-check -fcheck-array-temporaries 476 -fcheck=<ALL|ARRAY-TEMPS|BOUNDS|DO|MEM|POINTER|RECURSION> 477 -fcoarray=<NONE|SINGLE|LIB> -fexternal-blas -ff2c 478 -ffrontend-optimize 479 -finit-character=N -finit-integer=N -finit-local-zero 480 -finit-logical=<TRUE|FALSE> 481 -finit-real=<ZERO|INF|-INF|NAN|SNAN> 482 -fmax-array-constructor=N -fmax-stack-var-size=N 483 -fno-align-commons 484 -fno-automatic -fno-protect-parens -fno-underscoring 485 -fsecond-underscore -fpack-derived -frealloc-lhs -frecursive 486 -frepack-arrays -fshort-enums -fstack-arrays 487 488 489 490File: gfortran.info, Node: Fortran Dialect Options, Next: Preprocessing Options, Prev: Option Summary, Up: Invoking GNU Fortran 491 4922.2 Options controlling Fortran dialect 493======================================= 494 495The following options control the details of the Fortran dialect 496accepted by the compiler: 497 498'-ffree-form' 499'-ffixed-form' 500 Specify the layout used by the source file. The free form layout 501 was introduced in Fortran 90. Fixed form was traditionally used in 502 older Fortran programs. When neither option is specified, the 503 source form is determined by the file extension. 504 505'-fall-intrinsics' 506 This option causes all intrinsic procedures (including the 507 GNU-specific extensions) to be accepted. This can be useful with 508 '-std=f95' to force standard-compliance but get access to the full 509 range of intrinsics available with 'gfortran'. As a consequence, 510 '-Wintrinsics-std' will be ignored and no user-defined procedure 511 with the same name as any intrinsic will be called except when it 512 is explicitly declared 'EXTERNAL'. 513 514'-fd-lines-as-code' 515'-fd-lines-as-comments' 516 Enable special treatment for lines beginning with 'd' or 'D' in 517 fixed form sources. If the '-fd-lines-as-code' option is given 518 they are treated as if the first column contained a blank. If the 519 '-fd-lines-as-comments' option is given, they are treated as 520 comment lines. 521 522'-fdollar-ok' 523 Allow '$' as a valid non-first character in a symbol name. Symbols 524 that start with '$' are rejected since it is unclear which rules to 525 apply to implicit typing as different vendors implement different 526 rules. Using '$' in 'IMPLICIT' statements is also rejected. 527 528'-fbackslash' 529 Change the interpretation of backslashes in string literals from a 530 single backslash character to "C-style" escape characters. The 531 following combinations are expanded '\a', '\b', '\f', '\n', '\r', 532 '\t', '\v', '\\', and '\0' to the ASCII characters alert, 533 backspace, form feed, newline, carriage return, horizontal tab, 534 vertical tab, backslash, and NUL, respectively. Additionally, 535 '\x'NN, '\u'NNNN and '\U'NNNNNNNN (where each N is a hexadecimal 536 digit) are translated into the Unicode characters corresponding to 537 the specified code points. All other combinations of a character 538 preceded by \ are unexpanded. 539 540'-fmodule-private' 541 Set the default accessibility of module entities to 'PRIVATE'. 542 Use-associated entities will not be accessible unless they are 543 explicitly declared as 'PUBLIC'. 544 545'-ffixed-line-length-N' 546 Set column after which characters are ignored in typical fixed-form 547 lines in the source file, and through which spaces are assumed (as 548 if padded to that length) after the ends of short fixed-form lines. 549 550 Popular values for N include 72 (the standard and the default), 80 551 (card image), and 132 (corresponding to "extended-source" options 552 in some popular compilers). N may also be 'none', meaning that the 553 entire line is meaningful and that continued character constants 554 never have implicit spaces appended to them to fill out the line. 555 '-ffixed-line-length-0' means the same thing as 556 '-ffixed-line-length-none'. 557 558'-ffree-line-length-N' 559 Set column after which characters are ignored in typical free-form 560 lines in the source file. The default value is 132. N may be 561 'none', meaning that the entire line is meaningful. 562 '-ffree-line-length-0' means the same thing as 563 '-ffree-line-length-none'. 564 565'-fmax-identifier-length=N' 566 Specify the maximum allowed identifier length. Typical values are 567 31 (Fortran 95) and 63 (Fortran 2003 and Fortran 2008). 568 569'-fimplicit-none' 570 Specify that no implicit typing is allowed, unless overridden by 571 explicit 'IMPLICIT' statements. This is the equivalent of adding 572 'implicit none' to the start of every procedure. 573 574'-fcray-pointer' 575 Enable the Cray pointer extension, which provides C-like pointer 576 functionality. 577 578'-fopenmp' 579 Enable the OpenMP extensions. This includes OpenMP '!$omp' 580 directives in free form and 'c$omp', '*$omp' and '!$omp' directives 581 in fixed form, '!$' conditional compilation sentinels in free form 582 and 'c$', '*$' and '!$' sentinels in fixed form, and when linking 583 arranges for the OpenMP runtime library to be linked in. The 584 option '-fopenmp' implies '-frecursive'. 585 586'-fno-range-check' 587 Disable range checking on results of simplification of constant 588 expressions during compilation. For example, GNU Fortran will give 589 an error at compile time when simplifying 'a = 1. / 0'. With this 590 option, no error will be given and 'a' will be assigned the value 591 '+Infinity'. If an expression evaluates to a value outside of the 592 relevant range of ['-HUGE()':'HUGE()'], then the expression will be 593 replaced by '-Inf' or '+Inf' as appropriate. Similarly, 'DATA 594 i/Z'FFFFFFFF'/' will result in an integer overflow on most systems, 595 but with '-fno-range-check' the value will "wrap around" and 'i' 596 will be initialized to -1 instead. 597 598'-fdefault-integer-8' 599 Set the default integer and logical types to an 8 byte wide type. 600 This option also affects the kind of integer constants like '42'. 601 Unlike '-finteger-4-integer-8', it does not promote variables with 602 explicit kind declaration. 603 604'-fdefault-real-8' 605 Set the default real type to an 8 byte wide type. This option also 606 affects the kind of non-double real constants like '1.0', and does 607 promote the default width of 'DOUBLE PRECISION' to 16 bytes if 608 possible, unless '-fdefault-double-8' is given, too. Unlike 609 '-freal-4-real-8', it does not promote variables with explicit kind 610 declaration. 611 612'-fdefault-double-8' 613 Set the 'DOUBLE PRECISION' type to an 8 byte wide type. Do nothing 614 if this is already the default. If '-fdefault-real-8' is given, 615 'DOUBLE PRECISION' would instead be promoted to 16 bytes if 616 possible, and '-fdefault-double-8' can be used to prevent this. 617 The kind of real constants like '1.d0' will not be changed by 618 '-fdefault-real-8' though, so also '-fdefault-double-8' does not 619 affect it. 620 621'-finteger-4-integer-8' 622 Promote all 'INTEGER(KIND=4)' entities to an 'INTEGER(KIND=8)' 623 entities. If 'KIND=8' is unavailable, then an error will be 624 issued. This option should be used with care and may not be 625 suitable for your codes. Areas of possible concern include calls 626 to external procedures, alignment in 'EQUIVALENCE' and/or 'COMMON', 627 generic interfaces, BOZ literal constant conversion, and I/O. 628 Inspection of the intermediate representation of the translated 629 Fortran code, produced by '-fdump-tree-original', is suggested. 630 631'-freal-4-real-8' 632'-freal-4-real-10' 633'-freal-4-real-16' 634'-freal-8-real-4' 635'-freal-8-real-10' 636'-freal-8-real-16' 637 Promote all 'REAL(KIND=M)' entities to 'REAL(KIND=N)' entities. If 638 'REAL(KIND=N)' is unavailable, then an error will be issued. All 639 other real kind types are unaffected by this option. These options 640 should be used with care and may not be suitable for your codes. 641 Areas of possible concern include calls to external procedures, 642 alignment in 'EQUIVALENCE' and/or 'COMMON', generic interfaces, BOZ 643 literal constant conversion, and I/O. Inspection of the 644 intermediate representation of the translated Fortran code, 645 produced by '-fdump-tree-original', is suggested. 646 647'-std=STD' 648 Specify the standard to which the program is expected to conform, 649 which may be one of 'f95', 'f2003', 'f2008', 'gnu', or 'legacy'. 650 The default value for STD is 'gnu', which specifies a superset of 651 the Fortran 95 standard that includes all of the extensions 652 supported by GNU Fortran, although warnings will be given for 653 obsolete extensions not recommended for use in new code. The 654 'legacy' value is equivalent but without the warnings for obsolete 655 extensions, and may be useful for old non-standard programs. The 656 'f95', 'f2003' and 'f2008' values specify strict conformance to the 657 Fortran 95, Fortran 2003 and Fortran 2008 standards, respectively; 658 errors are given for all extensions beyond the relevant language 659 standard, and warnings are given for the Fortran 77 features that 660 are permitted but obsolescent in later standards. '-std=f2008ts' 661 allows the Fortran 2008 standard including the additions of the 662 Technical Specification (TS) 29113 on Further Interoperability of 663 Fortran with C. 664 665 666File: gfortran.info, Node: Preprocessing Options, Next: Error and Warning Options, Prev: Fortran Dialect Options, Up: Invoking GNU Fortran 667 6682.3 Enable and customize preprocessing 669====================================== 670 671Preprocessor related options. See section *note Preprocessing and 672conditional compilation:: for more detailed information on preprocessing 673in 'gfortran'. 674 675'-cpp' 676'-nocpp' 677 Enable preprocessing. The preprocessor is automatically invoked if 678 the file extension is '.fpp', '.FPP', '.F', '.FOR', '.FTN', '.F90', 679 '.F95', '.F03' or '.F08'. Use this option to manually enable 680 preprocessing of any kind of Fortran file. 681 682 To disable preprocessing of files with any of the above listed 683 extensions, use the negative form: '-nocpp'. 684 685 The preprocessor is run in traditional mode. Any restrictions of 686 the file-format, especially the limits on line length, apply for 687 preprocessed output as well, so it might be advisable to use the 688 '-ffree-line-length-none' or '-ffixed-line-length-none' options. 689 690'-dM' 691 Instead of the normal output, generate a list of ''#define'' 692 directives for all the macros defined during the execution of the 693 preprocessor, including predefined macros. This gives you a way of 694 finding out what is predefined in your version of the preprocessor. 695 Assuming you have no file 'foo.f90', the command 696 touch foo.f90; gfortran -cpp -E -dM foo.f90 697 will show all the predefined macros. 698 699'-dD' 700 Like '-dM' except in two respects: it does not include the 701 predefined macros, and it outputs both the '#define' directives and 702 the result of preprocessing. Both kinds of output go to the 703 standard output file. 704 705'-dN' 706 Like '-dD', but emit only the macro names, not their expansions. 707 708'-dU' 709 Like 'dD' except that only macros that are expanded, or whose 710 definedness is tested in preprocessor directives, are output; the 711 output is delayed until the use or test of the macro; and 712 ''#undef'' directives are also output for macros tested but 713 undefined at the time. 714 715'-dI' 716 Output ''#include'' directives in addition to the result of 717 preprocessing. 718 719'-fworking-directory' 720 Enable generation of linemarkers in the preprocessor output that 721 will let the compiler know the current working directory at the 722 time of preprocessing. When this option is enabled, the 723 preprocessor will emit, after the initial linemarker, a second 724 linemarker with the current working directory followed by two 725 slashes. GCC will use this directory, when it is present in the 726 preprocessed input, as the directory emitted as the current working 727 directory in some debugging information formats. This option is 728 implicitly enabled if debugging information is enabled, but this 729 can be inhibited with the negated form '-fno-working-directory'. 730 If the '-P' flag is present in the command line, this option has no 731 effect, since no '#line' directives are emitted whatsoever. 732 733'-idirafter DIR' 734 Search DIR for include files, but do it after all directories 735 specified with '-I' and the standard system directories have been 736 exhausted. DIR is treated as a system include directory. If dir 737 begins with '=', then the '=' will be replaced by the sysroot 738 prefix; see '--sysroot' and '-isysroot'. 739 740'-imultilib DIR' 741 Use DIR as a subdirectory of the directory containing 742 target-specific C++ headers. 743 744'-iprefix PREFIX' 745 Specify PREFIX as the prefix for subsequent '-iwithprefix' options. 746 If the PREFIX represents a directory, you should include the final 747 ''/''. 748 749'-isysroot DIR' 750 This option is like the '--sysroot' option, but applies only to 751 header files. See the '--sysroot' option for more information. 752 753'-iquote DIR' 754 Search DIR only for header files requested with '#include "file"'; 755 they are not searched for '#include <file>', before all directories 756 specified by '-I' and before the standard system directories. If 757 DIR begins with '=', then the '=' will be replaced by the sysroot 758 prefix; see '--sysroot' and '-isysroot'. 759 760'-isystem DIR' 761 Search DIR for header files, after all directories specified by 762 '-I' but before the standard system directories. Mark it as a 763 system directory, so that it gets the same special treatment as is 764 applied to the standard system directories. If DIR begins with 765 '=', then the '=' will be replaced by the sysroot prefix; see 766 '--sysroot' and '-isysroot'. 767 768'-nostdinc' 769 Do not search the standard system directories for header files. 770 Only the directories you have specified with '-I' options (and the 771 directory of the current file, if appropriate) are searched. 772 773'-undef' 774 Do not predefine any system-specific or GCC-specific macros. The 775 standard predefined macros remain defined. 776 777'-APREDICATE=ANSWER' 778 Make an assertion with the predicate PREDICATE and answer ANSWER. 779 This form is preferred to the older form -A predicate(answer), 780 which is still supported, because it does not use shell special 781 characters. 782 783'-A-PREDICATE=ANSWER' 784 Cancel an assertion with the predicate PREDICATE and answer ANSWER. 785 786'-C' 787 Do not discard comments. All comments are passed through to the 788 output file, except for comments in processed directives, which are 789 deleted along with the directive. 790 791 You should be prepared for side effects when using '-C'; it causes 792 the preprocessor to treat comments as tokens in their own right. 793 For example, comments appearing at the start of what would be a 794 directive line have the effect of turning that line into an 795 ordinary source line, since the first token on the line is no 796 longer a ''#''. 797 798 Warning: this currently handles C-Style comments only. The 799 preprocessor does not yet recognize Fortran-style comments. 800 801'-CC' 802 Do not discard comments, including during macro expansion. This is 803 like '-C', except that comments contained within macros are also 804 passed through to the output file where the macro is expanded. 805 806 In addition to the side-effects of the '-C' option, the '-CC' 807 option causes all C++-style comments inside a macro to be converted 808 to C-style comments. This is to prevent later use of that macro 809 from inadvertently commenting out the remainder of the source line. 810 The '-CC' option is generally used to support lint comments. 811 812 Warning: this currently handles C- and C++-Style comments only. 813 The preprocessor does not yet recognize Fortran-style comments. 814 815'-DNAME' 816 Predefine name as a macro, with definition '1'. 817 818'-DNAME=DEFINITION' 819 The contents of DEFINITION are tokenized and processed as if they 820 appeared during translation phase three in a ''#define'' directive. 821 In particular, the definition will be truncated by embedded newline 822 characters. 823 824 If you are invoking the preprocessor from a shell or shell-like 825 program you may need to use the shell's quoting syntax to protect 826 characters such as spaces that have a meaning in the shell syntax. 827 828 If you wish to define a function-like macro on the command line, 829 write its argument list with surrounding parentheses before the 830 equals sign (if any). Parentheses are meaningful to most shells, 831 so you will need to quote the option. With sh and csh, 832 '-D'name(args...)=definition'' works. 833 834 '-D' and '-U' options are processed in the order they are given on 835 the command line. All -imacros file and -include file options are 836 processed after all -D and -U options. 837 838'-H' 839 Print the name of each header file used, in addition to other 840 normal activities. Each name is indented to show how deep in the 841 ''#include'' stack it is. 842 843'-P' 844 Inhibit generation of linemarkers in the output from the 845 preprocessor. This might be useful when running the preprocessor 846 on something that is not C code, and will be sent to a program 847 which might be confused by the linemarkers. 848 849'-UNAME' 850 Cancel any previous definition of NAME, either built in or provided 851 with a '-D' option. 852 853 854File: gfortran.info, Node: Error and Warning Options, Next: Debugging Options, Prev: Preprocessing Options, Up: Invoking GNU Fortran 855 8562.4 Options to request or suppress errors and warnings 857====================================================== 858 859Errors are diagnostic messages that report that the GNU Fortran compiler 860cannot compile the relevant piece of source code. The compiler will 861continue to process the program in an attempt to report further errors 862to aid in debugging, but will not produce any compiled output. 863 864 Warnings are diagnostic messages that report constructions which are 865not inherently erroneous but which are risky or suggest there is likely 866to be a bug in the program. Unless '-Werror' is specified, they do not 867prevent compilation of the program. 868 869 You can request many specific warnings with options beginning '-W', 870for example '-Wimplicit' to request warnings on implicit declarations. 871Each of these specific warning options also has a negative form 872beginning '-Wno-' to turn off warnings; for example, '-Wno-implicit'. 873This manual lists only one of the two forms, whichever is not the 874default. 875 876 These options control the amount and kinds of errors and warnings 877produced by GNU Fortran: 878 879'-fmax-errors=N' 880 Limits the maximum number of error messages to N, at which point 881 GNU Fortran bails out rather than attempting to continue processing 882 the source code. If N is 0, there is no limit on the number of 883 error messages produced. 884 885'-fsyntax-only' 886 Check the code for syntax errors, but do not actually compile it. 887 This will generate module files for each module present in the 888 code, but no other output file. 889 890'-pedantic' 891 Issue warnings for uses of extensions to Fortran 95. '-pedantic' 892 also applies to C-language constructs where they occur in GNU 893 Fortran source files, such as use of '\e' in a character constant 894 within a directive like '#include'. 895 896 Valid Fortran 95 programs should compile properly with or without 897 this option. However, without this option, certain GNU extensions 898 and traditional Fortran features are supported as well. With this 899 option, many of them are rejected. 900 901 Some users try to use '-pedantic' to check programs for 902 conformance. They soon find that it does not do quite what they 903 want--it finds some nonstandard practices, but not all. However, 904 improvements to GNU Fortran in this area are welcome. 905 906 This should be used in conjunction with '-std=f95', '-std=f2003' or 907 '-std=f2008'. 908 909'-pedantic-errors' 910 Like '-pedantic', except that errors are produced rather than 911 warnings. 912 913'-Wall' 914 Enables commonly used warning options pertaining to usage that we 915 recommend avoiding and that we believe are easy to avoid. This 916 currently includes '-Waliasing', '-Wampersand', '-Wconversion', 917 '-Wsurprising', '-Wc-binding-type', '-Wintrinsics-std', 918 '-Wno-tabs', '-Wintrinsic-shadow', '-Wline-truncation', 919 '-Wtarget-lifetime', '-Wreal-q-constant' and '-Wunused'. 920 921'-Waliasing' 922 Warn about possible aliasing of dummy arguments. Specifically, it 923 warns if the same actual argument is associated with a dummy 924 argument with 'INTENT(IN)' and a dummy argument with 'INTENT(OUT)' 925 in a call with an explicit interface. 926 927 The following example will trigger the warning. 928 interface 929 subroutine bar(a,b) 930 integer, intent(in) :: a 931 integer, intent(out) :: b 932 end subroutine 933 end interface 934 integer :: a 935 936 call bar(a,a) 937 938'-Wampersand' 939 Warn about missing ampersand in continued character constants. The 940 warning is given with '-Wampersand', '-pedantic', '-std=f95', 941 '-std=f2003' and '-std=f2008'. Note: With no ampersand given in a 942 continued character constant, GNU Fortran assumes continuation at 943 the first non-comment, non-whitespace character after the ampersand 944 that initiated the continuation. 945 946'-Warray-temporaries' 947 Warn about array temporaries generated by the compiler. The 948 information generated by this warning is sometimes useful in 949 optimization, in order to avoid such temporaries. 950 951'-Wc-binding-type' 952 Warn if the a variable might not be C interoperable. In 953 particular, warn if the variable has been declared using an 954 intrinsic type with default kind instead of using a kind parameter 955 defined for C interoperability in the intrinsic 'ISO_C_Binding' 956 module. This option is implied by '-Wall'. 957 958'-Wcharacter-truncation' 959 Warn when a character assignment will truncate the assigned string. 960 961'-Wline-truncation' 962 Warn when a source code line will be truncated. This option is 963 implied by '-Wall'. 964 965'-Wconversion' 966 Warn about implicit conversions that are likely to change the value 967 of the expression after conversion. Implied by '-Wall'. 968 969'-Wconversion-extra' 970 Warn about implicit conversions between different types and kinds. 971 972'-Wextra' 973 Enables some warning options for usages of language features which 974 may be problematic. This currently includes '-Wcompare-reals' and 975 '-Wunused-parameter'. 976 977'-Wimplicit-interface' 978 Warn if a procedure is called without an explicit interface. Note 979 this only checks that an explicit interface is present. It does 980 not check that the declared interfaces are consistent across 981 program units. 982 983'-Wimplicit-procedure' 984 Warn if a procedure is called that has neither an explicit 985 interface nor has been declared as 'EXTERNAL'. 986 987'-Wintrinsics-std' 988 Warn if 'gfortran' finds a procedure named like an intrinsic not 989 available in the currently selected standard (with '-std') and 990 treats it as 'EXTERNAL' procedure because of this. 991 '-fall-intrinsics' can be used to never trigger this behavior and 992 always link to the intrinsic regardless of the selected standard. 993 994'-Wreal-q-constant' 995 Produce a warning if a real-literal-constant contains a 'q' 996 exponent-letter. 997 998'-Wsurprising' 999 Produce a warning when "suspicious" code constructs are 1000 encountered. While technically legal these usually indicate that 1001 an error has been made. 1002 1003 This currently produces a warning under the following 1004 circumstances: 1005 1006 * An INTEGER SELECT construct has a CASE that can never be 1007 matched as its lower value is greater than its upper value. 1008 1009 * A LOGICAL SELECT construct has three CASE statements. 1010 1011 * A TRANSFER specifies a source that is shorter than the 1012 destination. 1013 1014 * The type of a function result is declared more than once with 1015 the same type. If '-pedantic' or standard-conforming mode is 1016 enabled, this is an error. 1017 1018 * A 'CHARACTER' variable is declared with negative length. 1019 1020'-Wtabs' 1021 By default, tabs are accepted as whitespace, but tabs are not 1022 members of the Fortran Character Set. For continuation lines, a 1023 tab followed by a digit between 1 and 9 is supported. '-Wno-tabs' 1024 will cause a warning to be issued if a tab is encountered. Note, 1025 '-Wno-tabs' is active for '-pedantic', '-std=f95', '-std=f2003', 1026 '-std=f2008' and '-Wall'. 1027 1028'-Wunderflow' 1029 Produce a warning when numerical constant expressions are 1030 encountered, which yield an UNDERFLOW during compilation. 1031 1032'-Wintrinsic-shadow' 1033 Warn if a user-defined procedure or module procedure has the same 1034 name as an intrinsic; in this case, an explicit interface or 1035 'EXTERNAL' or 'INTRINSIC' declaration might be needed to get calls 1036 later resolved to the desired intrinsic/procedure. This option is 1037 implied by '-Wall'. 1038 1039'-Wunused-dummy-argument' 1040 Warn about unused dummy arguments. This option is implied by 1041 '-Wall'. 1042 1043'-Wunused-parameter' 1044 Contrary to 'gcc''s meaning of '-Wunused-parameter', 'gfortran''s 1045 implementation of this option does not warn about unused dummy 1046 arguments (see '-Wunused-dummy-argument'), but about unused 1047 'PARAMETER' values. '-Wunused-parameter' is not included in 1048 '-Wall' but is implied by '-Wall -Wextra'. 1049 1050'-Walign-commons' 1051 By default, 'gfortran' warns about any occasion of variables being 1052 padded for proper alignment inside a 'COMMON' block. This warning 1053 can be turned off via '-Wno-align-commons'. See also 1054 '-falign-commons'. 1055 1056'-Wfunction-elimination' 1057 Warn if any calls to functions are eliminated by the optimizations 1058 enabled by the '-ffrontend-optimize' option. 1059 1060'-Wrealloc-lhs' 1061 Warn when the compiler might insert code to for allocation or 1062 reallocation of an allocatable array variable of intrinsic type in 1063 intrinsic assignments. In hot loops, the Fortran 2003 reallocation 1064 feature may reduce the performance. If the array is already 1065 allocated with the correct shape, consider using a whole-array 1066 array-spec (e.g. '(:,:,:)') for the variable on the left-hand side 1067 to prevent the reallocation check. Note that in some cases the 1068 warning is shown, even if the compiler will optimize reallocation 1069 checks away. For instance, when the right-hand side contains the 1070 same variable multiplied by a scalar. See also '-frealloc-lhs'. 1071 1072'-Wrealloc-lhs-all' 1073 Warn when the compiler inserts code to for allocation or 1074 reallocation of an allocatable variable; this includes scalars and 1075 derived types. 1076 1077'-Wcompare-reals' 1078 Warn when comparing real or complex types for equality or 1079 inequality. This option is implied by '-Wextra'. 1080 1081'-Wtarget-lifetime' 1082 Warn if the pointer in a pointer assignment might be longer than 1083 the its target. This option is implied by '-Wall'. 1084 1085'-Wzerotrip' 1086 Warn if a 'DO' loop is known to execute zero times at compile time. 1087 This option is implied by '-Wall'. 1088 1089'-Werror' 1090 Turns all warnings into errors. 1091 1092 *Note Options to Request or Suppress Errors and Warnings: 1093(gcc)Warning Options, for information on more options offered by the GBE 1094shared by 'gfortran', 'gcc' and other GNU compilers. 1095 1096 Some of these have no effect when compiling programs written in 1097Fortran. 1098 1099 1100File: gfortran.info, Node: Debugging Options, Next: Directory Options, Prev: Error and Warning Options, Up: Invoking GNU Fortran 1101 11022.5 Options for debugging your program or GNU Fortran 1103===================================================== 1104 1105GNU Fortran has various special options that are used for debugging 1106either your program or the GNU Fortran compiler. 1107 1108'-fdump-fortran-original' 1109 Output the internal parse tree after translating the source program 1110 into internal representation. Only really useful for debugging the 1111 GNU Fortran compiler itself. 1112 1113'-fdump-fortran-optimized' 1114 Output the parse tree after front-end optimization. Only really 1115 useful for debugging the GNU Fortran compiler itself. 1116 1117'-fdump-parse-tree' 1118 Output the internal parse tree after translating the source program 1119 into internal representation. Only really useful for debugging the 1120 GNU Fortran compiler itself. This option is deprecated; use 1121 '-fdump-fortran-original' instead. 1122 1123'-ffpe-trap=LIST' 1124 Specify a list of floating point exception traps to enable. On 1125 most systems, if a floating point exception occurs and the trap for 1126 that exception is enabled, a SIGFPE signal will be sent and the 1127 program being aborted, producing a core file useful for debugging. 1128 LIST is a (possibly empty) comma-separated list of the following 1129 exceptions: 'invalid' (invalid floating point operation, such as 1130 'SQRT(-1.0)'), 'zero' (division by zero), 'overflow' (overflow in a 1131 floating point operation), 'underflow' (underflow in a floating 1132 point operation), 'inexact' (loss of precision during operation), 1133 and 'denormal' (operation performed on a denormal value). The 1134 first five exceptions correspond to the five IEEE 754 exceptions, 1135 whereas the last one ('denormal') is not part of the IEEE 754 1136 standard but is available on some common architectures such as x86. 1137 1138 The first three exceptions ('invalid', 'zero', and 'overflow') 1139 often indicate serious errors, and unless the program has 1140 provisions for dealing with these exceptions, enabling traps for 1141 these three exceptions is probably a good idea. 1142 1143 Many, if not most, floating point operations incur loss of 1144 precision due to rounding, and hence the 'ffpe-trap=inexact' is 1145 likely to be uninteresting in practice. 1146 1147 By default no exception traps are enabled. 1148 1149'-ffpe-summary=LIST' 1150 Specify a list of floating-point exceptions, whose flag status is 1151 printed to 'ERROR_UNIT' when invoking 'STOP' and 'ERROR STOP'. 1152 LIST can be either 'none', 'all' or a comma-separated list of the 1153 following exceptions: 'invalid', 'zero', 'overflow', 'underflow', 1154 'inexact' and 'denormal'. (See '-ffpe-trap' for a description of 1155 the exceptions.) 1156 1157 By default, a summary for all exceptions but 'inexact' is shown. 1158 1159'-fno-backtrace' 1160 When a serious runtime error is encountered or a deadly signal is 1161 emitted (segmentation fault, illegal instruction, bus error, 1162 floating-point exception, and the other POSIX signals that have the 1163 action 'core'), the Fortran runtime library tries to output a 1164 backtrace of the error. '-fno-backtrace' disables the backtrace 1165 generation. This option only has influence for compilation of the 1166 Fortran main program. 1167 1168 *Note Options for Debugging Your Program or GCC: (gcc)Debugging 1169Options, for more information on debugging options. 1170 1171 1172File: gfortran.info, Node: Directory Options, Next: Link Options, Prev: Debugging Options, Up: Invoking GNU Fortran 1173 11742.6 Options for directory search 1175================================ 1176 1177These options affect how GNU Fortran searches for files specified by the 1178'INCLUDE' directive and where it searches for previously compiled 1179modules. 1180 1181 It also affects the search paths used by 'cpp' when used to 1182preprocess Fortran source. 1183 1184'-IDIR' 1185 These affect interpretation of the 'INCLUDE' directive (as well as 1186 of the '#include' directive of the 'cpp' preprocessor). 1187 1188 Also note that the general behavior of '-I' and 'INCLUDE' is pretty 1189 much the same as of '-I' with '#include' in the 'cpp' preprocessor, 1190 with regard to looking for 'header.gcc' files and other such 1191 things. 1192 1193 This path is also used to search for '.mod' files when previously 1194 compiled modules are required by a 'USE' statement. 1195 1196 *Note Options for Directory Search: (gcc)Directory Options, for 1197 information on the '-I' option. 1198 1199'-JDIR' 1200 This option specifies where to put '.mod' files for compiled 1201 modules. It is also added to the list of directories to searched 1202 by an 'USE' statement. 1203 1204 The default is the current directory. 1205 1206'-fintrinsic-modules-path DIR' 1207 This option specifies the location of pre-compiled intrinsic 1208 modules, if they are not in the default location expected by the 1209 compiler. 1210 1211 1212File: gfortran.info, Node: Link Options, Next: Runtime Options, Prev: Directory Options, Up: Invoking GNU Fortran 1213 12142.7 Influencing the linking step 1215================================ 1216 1217These options come into play when the compiler links object files into 1218an executable output file. They are meaningless if the compiler is not 1219doing a link step. 1220 1221'-static-libgfortran' 1222 On systems that provide 'libgfortran' as a shared and a static 1223 library, this option forces the use of the static version. If no 1224 shared version of 'libgfortran' was built when the compiler was 1225 configured, this option has no effect. 1226 1227 1228File: gfortran.info, Node: Runtime Options, Next: Code Gen Options, Prev: Link Options, Up: Invoking GNU Fortran 1229 12302.8 Influencing runtime behavior 1231================================ 1232 1233These options affect the runtime behavior of programs compiled with GNU 1234Fortran. 1235 1236'-fconvert=CONVERSION' 1237 Specify the representation of data for unformatted files. Valid 1238 values for conversion are: 'native', the default; 'swap', swap 1239 between big- and little-endian; 'big-endian', use big-endian 1240 representation for unformatted files; 'little-endian', use 1241 little-endian representation for unformatted files. 1242 1243 _This option has an effect only when used in the main program. The 1244 'CONVERT' specifier and the GFORTRAN_CONVERT_UNIT environment 1245 variable override the default specified by '-fconvert'._ 1246 1247'-frecord-marker=LENGTH' 1248 Specify the length of record markers for unformatted files. Valid 1249 values for LENGTH are 4 and 8. Default is 4. _This is different 1250 from previous versions of 'gfortran'_, which specified a default 1251 record marker length of 8 on most systems. If you want to read or 1252 write files compatible with earlier versions of 'gfortran', use 1253 '-frecord-marker=8'. 1254 1255'-fmax-subrecord-length=LENGTH' 1256 Specify the maximum length for a subrecord. The maximum permitted 1257 value for length is 2147483639, which is also the default. Only 1258 really useful for use by the gfortran testsuite. 1259 1260'-fsign-zero' 1261 When enabled, floating point numbers of value zero with the sign 1262 bit set are written as negative number in formatted output and 1263 treated as negative in the 'SIGN' intrinsic. '-fno-sign-zero' does 1264 not print the negative sign of zero values (or values rounded to 1265 zero for I/O) and regards zero as positive number in the 'SIGN' 1266 intrinsic for compatibility with Fortran 77. The default is 1267 '-fsign-zero'. 1268 1269 1270File: gfortran.info, Node: Code Gen Options, Next: Environment Variables, Prev: Runtime Options, Up: Invoking GNU Fortran 1271 12722.9 Options for code generation conventions 1273=========================================== 1274 1275These machine-independent options control the interface conventions used 1276in code generation. 1277 1278 Most of them have both positive and negative forms; the negative form 1279of '-ffoo' would be '-fno-foo'. In the table below, only one of the 1280forms is listed--the one which is not the default. You can figure out 1281the other form by either removing 'no-' or adding it. 1282 1283'-fno-automatic' 1284 Treat each program unit (except those marked as RECURSIVE) as if 1285 the 'SAVE' statement were specified for every local variable and 1286 array referenced in it. Does not affect common blocks. (Some 1287 Fortran compilers provide this option under the name '-static' or 1288 '-save'.) The default, which is '-fautomatic', uses the stack for 1289 local variables smaller than the value given by 1290 '-fmax-stack-var-size'. Use the option '-frecursive' to use no 1291 static memory. 1292 1293'-ff2c' 1294 Generate code designed to be compatible with code generated by 1295 'g77' and 'f2c'. 1296 1297 The calling conventions used by 'g77' (originally implemented in 1298 'f2c') require functions that return type default 'REAL' to 1299 actually return the C type 'double', and functions that return type 1300 'COMPLEX' to return the values via an extra argument in the calling 1301 sequence that points to where to store the return value. Under the 1302 default GNU calling conventions, such functions simply return their 1303 results as they would in GNU C--default 'REAL' functions return the 1304 C type 'float', and 'COMPLEX' functions return the GNU C type 1305 'complex'. Additionally, this option implies the 1306 '-fsecond-underscore' option, unless '-fno-second-underscore' is 1307 explicitly requested. 1308 1309 This does not affect the generation of code that interfaces with 1310 the 'libgfortran' library. 1311 1312 _Caution:_ It is not a good idea to mix Fortran code compiled with 1313 '-ff2c' with code compiled with the default '-fno-f2c' calling 1314 conventions as, calling 'COMPLEX' or default 'REAL' functions 1315 between program parts which were compiled with different calling 1316 conventions will break at execution time. 1317 1318 _Caution:_ This will break code which passes intrinsic functions of 1319 type default 'REAL' or 'COMPLEX' as actual arguments, as the 1320 library implementations use the '-fno-f2c' calling conventions. 1321 1322'-fno-underscoring' 1323 Do not transform names of entities specified in the Fortran source 1324 file by appending underscores to them. 1325 1326 With '-funderscoring' in effect, GNU Fortran appends one underscore 1327 to external names with no underscores. This is done to ensure 1328 compatibility with code produced by many UNIX Fortran compilers. 1329 1330 _Caution_: The default behavior of GNU Fortran is incompatible with 1331 'f2c' and 'g77', please use the '-ff2c' option if you want object 1332 files compiled with GNU Fortran to be compatible with object code 1333 created with these tools. 1334 1335 Use of '-fno-underscoring' is not recommended unless you are 1336 experimenting with issues such as integration of GNU Fortran into 1337 existing system environments (vis-a`-vis existing libraries, tools, 1338 and so on). 1339 1340 For example, with '-funderscoring', and assuming other defaults 1341 like '-fcase-lower' and that 'j()' and 'max_count()' are external 1342 functions while 'my_var' and 'lvar' are local variables, a 1343 statement like 1344 I = J() + MAX_COUNT (MY_VAR, LVAR) 1345 is implemented as something akin to: 1346 i = j_() + max_count__(&my_var__, &lvar); 1347 1348 With '-fno-underscoring', the same statement is implemented as: 1349 1350 i = j() + max_count(&my_var, &lvar); 1351 1352 Use of '-fno-underscoring' allows direct specification of 1353 user-defined names while debugging and when interfacing GNU Fortran 1354 code with other languages. 1355 1356 Note that just because the names match does _not_ mean that the 1357 interface implemented by GNU Fortran for an external name matches 1358 the interface implemented by some other language for that same 1359 name. That is, getting code produced by GNU Fortran to link to 1360 code produced by some other compiler using this or any other method 1361 can be only a small part of the overall solution--getting the code 1362 generated by both compilers to agree on issues other than naming 1363 can require significant effort, and, unlike naming disagreements, 1364 linkers normally cannot detect disagreements in these other areas. 1365 1366 Also, note that with '-fno-underscoring', the lack of appended 1367 underscores introduces the very real possibility that a 1368 user-defined external name will conflict with a name in a system 1369 library, which could make finding unresolved-reference bugs quite 1370 difficult in some cases--they might occur at program run time, and 1371 show up only as buggy behavior at run time. 1372 1373 In future versions of GNU Fortran we hope to improve naming and 1374 linking issues so that debugging always involves using the names as 1375 they appear in the source, even if the names as seen by the linker 1376 are mangled to prevent accidental linking between procedures with 1377 incompatible interfaces. 1378 1379'-fsecond-underscore' 1380 By default, GNU Fortran appends an underscore to external names. 1381 If this option is used GNU Fortran appends two underscores to names 1382 with underscores and one underscore to external names with no 1383 underscores. GNU Fortran also appends two underscores to internal 1384 names with underscores to avoid naming collisions with external 1385 names. 1386 1387 This option has no effect if '-fno-underscoring' is in effect. It 1388 is implied by the '-ff2c' option. 1389 1390 Otherwise, with this option, an external name such as 'MAX_COUNT' 1391 is implemented as a reference to the link-time external symbol 1392 'max_count__', instead of 'max_count_'. This is required for 1393 compatibility with 'g77' and 'f2c', and is implied by use of the 1394 '-ff2c' option. 1395 1396'-fcoarray=<KEYWORD>' 1397 1398 'none' 1399 Disable coarray support; using coarray declarations and 1400 image-control statements will produce a compile-time error. 1401 (Default) 1402 1403 'single' 1404 Single-image mode, i.e. 'num_images()' is always one. 1405 1406 'lib' 1407 Library-based coarray parallelization; a suitable GNU Fortran 1408 coarray library needs to be linked. 1409 1410'-fcheck=<KEYWORD>' 1411 1412 Enable the generation of run-time checks; the argument shall be a 1413 comma-delimited list of the following keywords. 1414 1415 'all' 1416 Enable all run-time test of '-fcheck'. 1417 1418 'array-temps' 1419 Warns at run time when for passing an actual argument a 1420 temporary array had to be generated. The information 1421 generated by this warning is sometimes useful in optimization, 1422 in order to avoid such temporaries. 1423 1424 Note: The warning is only printed once per location. 1425 1426 'bounds' 1427 Enable generation of run-time checks for array subscripts and 1428 against the declared minimum and maximum values. It also 1429 checks array indices for assumed and deferred shape arrays 1430 against the actual allocated bounds and ensures that all 1431 string lengths are equal for character array constructors 1432 without an explicit typespec. 1433 1434 Some checks require that '-fcheck=bounds' is set for the 1435 compilation of the main program. 1436 1437 Note: In the future this may also include other forms of 1438 checking, e.g., checking substring references. 1439 1440 'do' 1441 Enable generation of run-time checks for invalid modification 1442 of loop iteration variables. 1443 1444 'mem' 1445 Enable generation of run-time checks for memory allocation. 1446 Note: This option does not affect explicit allocations using 1447 the 'ALLOCATE' statement, which will be always checked. 1448 1449 'pointer' 1450 Enable generation of run-time checks for pointers and 1451 allocatables. 1452 1453 'recursion' 1454 Enable generation of run-time checks for recursively called 1455 subroutines and functions which are not marked as recursive. 1456 See also '-frecursive'. Note: This check does not work for 1457 OpenMP programs and is disabled if used together with 1458 '-frecursive' and '-fopenmp'. 1459 1460'-fbounds-check' 1461 Deprecated alias for '-fcheck=bounds'. 1462 1463'-fcheck-array-temporaries' 1464 Deprecated alias for '-fcheck=array-temps'. 1465 1466'-fmax-array-constructor=N' 1467 This option can be used to increase the upper limit permitted in 1468 array constructors. The code below requires this option to expand 1469 the array at compile time. 1470 1471 program test 1472 implicit none 1473 integer j 1474 integer, parameter :: n = 100000 1475 integer, parameter :: i(n) = (/ (2*j, j = 1, n) /) 1476 print '(10(I0,1X))', i 1477 end program test 1478 1479 _Caution: This option can lead to long compile times and 1480 excessively large object files._ 1481 1482 The default value for N is 65535. 1483 1484'-fmax-stack-var-size=N' 1485 This option specifies the size in bytes of the largest array that 1486 will be put on the stack; if the size is exceeded static memory is 1487 used (except in procedures marked as RECURSIVE). Use the option 1488 '-frecursive' to allow for recursive procedures which do not have a 1489 RECURSIVE attribute or for parallel programs. Use '-fno-automatic' 1490 to never use the stack. 1491 1492 This option currently only affects local arrays declared with 1493 constant bounds, and may not apply to all character variables. 1494 Future versions of GNU Fortran may improve this behavior. 1495 1496 The default value for N is 32768. 1497 1498'-fstack-arrays' 1499 Adding this option will make the Fortran compiler put all local 1500 arrays, even those of unknown size onto stack memory. If your 1501 program uses very large local arrays it is possible that you will 1502 have to extend your runtime limits for stack memory on some 1503 operating systems. This flag is enabled by default at optimization 1504 level '-Ofast'. 1505 1506'-fpack-derived' 1507 This option tells GNU Fortran to pack derived type members as 1508 closely as possible. Code compiled with this option is likely to 1509 be incompatible with code compiled without this option, and may 1510 execute slower. 1511 1512'-frepack-arrays' 1513 In some circumstances GNU Fortran may pass assumed shape array 1514 sections via a descriptor describing a noncontiguous area of 1515 memory. This option adds code to the function prologue to repack 1516 the data into a contiguous block at runtime. 1517 1518 This should result in faster accesses to the array. However it can 1519 introduce significant overhead to the function call, especially 1520 when the passed data is noncontiguous. 1521 1522'-fshort-enums' 1523 This option is provided for interoperability with C code that was 1524 compiled with the '-fshort-enums' option. It will make GNU Fortran 1525 choose the smallest 'INTEGER' kind a given enumerator set will fit 1526 in, and give all its enumerators this kind. 1527 1528'-fexternal-blas' 1529 This option will make 'gfortran' generate calls to BLAS functions 1530 for some matrix operations like 'MATMUL', instead of using our own 1531 algorithms, if the size of the matrices involved is larger than a 1532 given limit (see '-fblas-matmul-limit'). This may be profitable if 1533 an optimized vendor BLAS library is available. The BLAS library 1534 will have to be specified at link time. 1535 1536'-fblas-matmul-limit=N' 1537 Only significant when '-fexternal-blas' is in effect. Matrix 1538 multiplication of matrices with size larger than (or equal to) N 1539 will be performed by calls to BLAS functions, while others will be 1540 handled by 'gfortran' internal algorithms. If the matrices 1541 involved are not square, the size comparison is performed using the 1542 geometric mean of the dimensions of the argument and result 1543 matrices. 1544 1545 The default value for N is 30. 1546 1547'-frecursive' 1548 Allow indirect recursion by forcing all local arrays to be 1549 allocated on the stack. This flag cannot be used together with 1550 '-fmax-stack-var-size=' or '-fno-automatic'. 1551 1552'-finit-local-zero' 1553'-finit-integer=N' 1554'-finit-real=<ZERO|INF|-INF|NAN|SNAN>' 1555'-finit-logical=<TRUE|FALSE>' 1556'-finit-character=N' 1557 The '-finit-local-zero' option instructs the compiler to initialize 1558 local 'INTEGER', 'REAL', and 'COMPLEX' variables to zero, 'LOGICAL' 1559 variables to false, and 'CHARACTER' variables to a string of null 1560 bytes. Finer-grained initialization options are provided by the 1561 '-finit-integer=N', '-finit-real=<ZERO|INF|-INF|NAN|SNAN>' (which 1562 also initializes the real and imaginary parts of local 'COMPLEX' 1563 variables), '-finit-logical=<TRUE|FALSE>', and '-finit-character=N' 1564 (where N is an ASCII character value) options. These options do 1565 not initialize 1566 * allocatable arrays 1567 * components of derived type variables 1568 * variables that appear in an 'EQUIVALENCE' statement. 1569 (These limitations may be removed in future releases). 1570 1571 Note that the '-finit-real=nan' option initializes 'REAL' and 1572 'COMPLEX' variables with a quiet NaN. For a signalling NaN use 1573 '-finit-real=snan'; note, however, that compile-time optimizations 1574 may convert them into quiet NaN and that trapping needs to be 1575 enabled (e.g. via '-ffpe-trap'). 1576 1577 Finally, note that enabling any of the '-finit-*' options will 1578 silence warnings that would have been emitted by '-Wuninitialized' 1579 for the affected local variables. 1580 1581'-falign-commons' 1582 By default, 'gfortran' enforces proper alignment of all variables 1583 in a 'COMMON' block by padding them as needed. On certain 1584 platforms this is mandatory, on others it increases performance. 1585 If a 'COMMON' block is not declared with consistent data types 1586 everywhere, this padding can cause trouble, and 1587 '-fno-align-commons' can be used to disable automatic alignment. 1588 The same form of this option should be used for all files that 1589 share a 'COMMON' block. To avoid potential alignment issues in 1590 'COMMON' blocks, it is recommended to order objects from largest to 1591 smallest. 1592 1593'-fno-protect-parens' 1594 By default the parentheses in expression are honored for all 1595 optimization levels such that the compiler does not do any 1596 re-association. Using '-fno-protect-parens' allows the compiler to 1597 reorder 'REAL' and 'COMPLEX' expressions to produce faster code. 1598 Note that for the re-association optimization '-fno-signed-zeros' 1599 and '-fno-trapping-math' need to be in effect. The parentheses 1600 protection is enabled by default, unless '-Ofast' is given. 1601 1602'-frealloc-lhs' 1603 An allocatable left-hand side of an intrinsic assignment is 1604 automatically (re)allocated if it is either unallocated or has a 1605 different shape. The option is enabled by default except when 1606 '-std=f95' is given. See also '-Wrealloc-lhs'. 1607 1608'-faggressive-function-elimination' 1609 Functions with identical argument lists are eliminated within 1610 statements, regardless of whether these functions are marked 'PURE' 1611 or not. For example, in 1612 a = f(b,c) + f(b,c) 1613 there will only be a single call to 'f'. This option only works if 1614 '-ffrontend-optimize' is in effect. 1615 1616'-ffrontend-optimize' 1617 This option performs front-end optimization, based on manipulating 1618 parts the Fortran parse tree. Enabled by default by any '-O' 1619 option. Optimizations enabled by this option include elimination 1620 of identical function calls within expressions, removing 1621 unnecessary calls to 'TRIM' in comparisons and assignments and 1622 replacing 'TRIM(a)' with 'a(1:LEN_TRIM(a))'. It can be deselected 1623 by specifying '-fno-frontend-optimize'. 1624 1625 *Note Options for Code Generation Conventions: (gcc)Code Gen Options, 1626for information on more options offered by the GBE shared by 'gfortran', 1627'gcc', and other GNU compilers. 1628 1629 1630File: gfortran.info, Node: Environment Variables, Prev: Code Gen Options, Up: Invoking GNU Fortran 1631 16322.10 Environment variables affecting 'gfortran' 1633=============================================== 1634 1635The 'gfortran' compiler currently does not make use of any environment 1636variables to control its operation above and beyond those that affect 1637the operation of 'gcc'. 1638 1639 *Note Environment Variables Affecting GCC: (gcc)Environment 1640Variables, for information on environment variables. 1641 1642 *Note Runtime::, for environment variables that affect the run-time 1643behavior of programs compiled with GNU Fortran. 1644 1645 1646File: gfortran.info, Node: Runtime, Next: Fortran 2003 and 2008 status, Prev: Invoking GNU Fortran, Up: Top 1647 16483 Runtime: Influencing runtime behavior with environment variables 1649****************************************************************** 1650 1651The behavior of the 'gfortran' can be influenced by environment 1652variables. 1653 1654 Malformed environment variables are silently ignored. 1655 1656* Menu: 1657 1658* TMPDIR:: Directory for scratch files 1659* GFORTRAN_STDIN_UNIT:: Unit number for standard input 1660* GFORTRAN_STDOUT_UNIT:: Unit number for standard output 1661* GFORTRAN_STDERR_UNIT:: Unit number for standard error 1662* GFORTRAN_UNBUFFERED_ALL:: Do not buffer I/O for all units. 1663* GFORTRAN_UNBUFFERED_PRECONNECTED:: Do not buffer I/O for preconnected units. 1664* GFORTRAN_SHOW_LOCUS:: Show location for runtime errors 1665* GFORTRAN_OPTIONAL_PLUS:: Print leading + where permitted 1666* GFORTRAN_DEFAULT_RECL:: Default record length for new files 1667* GFORTRAN_LIST_SEPARATOR:: Separator for list output 1668* GFORTRAN_CONVERT_UNIT:: Set endianness for unformatted I/O 1669* GFORTRAN_ERROR_BACKTRACE:: Show backtrace on run-time errors 1670 1671 1672File: gfortran.info, Node: TMPDIR, Next: GFORTRAN_STDIN_UNIT, Up: Runtime 1673 16743.1 'TMPDIR'--Directory for scratch files 1675========================================= 1676 1677When opening a file with 'STATUS='SCRATCH'', GNU Fortran tries to create 1678the file in one of the potential directories by testing each directory 1679in the order below. 1680 1681 1. The environment variable 'TMPDIR', if it exists. 1682 1683 2. On the MinGW target, the directory returned by the 'GetTempPath' 1684 function. Alternatively, on the Cygwin target, the 'TMP' and 1685 'TEMP' environment variables, if they exist, in that order. 1686 1687 3. The 'P_tmpdir' macro if it is defined, otherwise the directory 1688 '/tmp'. 1689 1690 1691File: gfortran.info, Node: GFORTRAN_STDIN_UNIT, Next: GFORTRAN_STDOUT_UNIT, Prev: TMPDIR, Up: Runtime 1692 16933.2 'GFORTRAN_STDIN_UNIT'--Unit number for standard input 1694========================================================= 1695 1696This environment variable can be used to select the unit number 1697preconnected to standard input. This must be a positive integer. The 1698default value is 5. 1699 1700 1701File: gfortran.info, Node: GFORTRAN_STDOUT_UNIT, Next: GFORTRAN_STDERR_UNIT, Prev: GFORTRAN_STDIN_UNIT, Up: Runtime 1702 17033.3 'GFORTRAN_STDOUT_UNIT'--Unit number for standard output 1704=========================================================== 1705 1706This environment variable can be used to select the unit number 1707preconnected to standard output. This must be a positive integer. The 1708default value is 6. 1709 1710 1711File: gfortran.info, Node: GFORTRAN_STDERR_UNIT, Next: GFORTRAN_UNBUFFERED_ALL, Prev: GFORTRAN_STDOUT_UNIT, Up: Runtime 1712 17133.4 'GFORTRAN_STDERR_UNIT'--Unit number for standard error 1714========================================================== 1715 1716This environment variable can be used to select the unit number 1717preconnected to standard error. This must be a positive integer. The 1718default value is 0. 1719 1720 1721File: gfortran.info, Node: GFORTRAN_UNBUFFERED_ALL, Next: GFORTRAN_UNBUFFERED_PRECONNECTED, Prev: GFORTRAN_STDERR_UNIT, Up: Runtime 1722 17233.5 'GFORTRAN_UNBUFFERED_ALL'--Do not buffer I/O on all units 1724============================================================= 1725 1726This environment variable controls whether all I/O is unbuffered. If 1727the first letter is 'y', 'Y' or '1', all I/O is unbuffered. This will 1728slow down small sequential reads and writes. If the first letter is 1729'n', 'N' or '0', I/O is buffered. This is the default. 1730 1731 1732File: gfortran.info, Node: GFORTRAN_UNBUFFERED_PRECONNECTED, Next: GFORTRAN_SHOW_LOCUS, Prev: GFORTRAN_UNBUFFERED_ALL, Up: Runtime 1733 17343.6 'GFORTRAN_UNBUFFERED_PRECONNECTED'--Do not buffer I/O on preconnected units 1735=============================================================================== 1736 1737The environment variable named 'GFORTRAN_UNBUFFERED_PRECONNECTED' 1738controls whether I/O on a preconnected unit (i.e. STDOUT or STDERR) is 1739unbuffered. If the first letter is 'y', 'Y' or '1', I/O is unbuffered. 1740This will slow down small sequential reads and writes. If the first 1741letter is 'n', 'N' or '0', I/O is buffered. This is the default. 1742 1743 1744File: gfortran.info, Node: GFORTRAN_SHOW_LOCUS, Next: GFORTRAN_OPTIONAL_PLUS, Prev: GFORTRAN_UNBUFFERED_PRECONNECTED, Up: Runtime 1745 17463.7 'GFORTRAN_SHOW_LOCUS'--Show location for runtime errors 1747=========================================================== 1748 1749If the first letter is 'y', 'Y' or '1', filename and line numbers for 1750runtime errors are printed. If the first letter is 'n', 'N' or '0', do 1751not print filename and line numbers for runtime errors. The default is 1752to print the location. 1753 1754 1755File: gfortran.info, Node: GFORTRAN_OPTIONAL_PLUS, Next: GFORTRAN_DEFAULT_RECL, Prev: GFORTRAN_SHOW_LOCUS, Up: Runtime 1756 17573.8 'GFORTRAN_OPTIONAL_PLUS'--Print leading + where permitted 1758============================================================= 1759 1760If the first letter is 'y', 'Y' or '1', a plus sign is printed where 1761permitted by the Fortran standard. If the first letter is 'n', 'N' or 1762'0', a plus sign is not printed in most cases. Default is not to print 1763plus signs. 1764 1765 1766File: gfortran.info, Node: GFORTRAN_DEFAULT_RECL, Next: GFORTRAN_LIST_SEPARATOR, Prev: GFORTRAN_OPTIONAL_PLUS, Up: Runtime 1767 17683.9 'GFORTRAN_DEFAULT_RECL'--Default record length for new files 1769================================================================ 1770 1771This environment variable specifies the default record length, in bytes, 1772for files which are opened without a 'RECL' tag in the 'OPEN' statement. 1773This must be a positive integer. The default value is 1073741824 bytes 1774(1 GB). 1775 1776 1777File: gfortran.info, Node: GFORTRAN_LIST_SEPARATOR, Next: GFORTRAN_CONVERT_UNIT, Prev: GFORTRAN_DEFAULT_RECL, Up: Runtime 1778 17793.10 'GFORTRAN_LIST_SEPARATOR'--Separator for list output 1780========================================================= 1781 1782This environment variable specifies the separator when writing 1783list-directed output. It may contain any number of spaces and at most 1784one comma. If you specify this on the command line, be sure to quote 1785spaces, as in 1786 $ GFORTRAN_LIST_SEPARATOR=' , ' ./a.out 1787 when 'a.out' is the compiled Fortran program that you want to run. 1788Default is a single space. 1789 1790 1791File: gfortran.info, Node: GFORTRAN_CONVERT_UNIT, Next: GFORTRAN_ERROR_BACKTRACE, Prev: GFORTRAN_LIST_SEPARATOR, Up: Runtime 1792 17933.11 'GFORTRAN_CONVERT_UNIT'--Set endianness for unformatted I/O 1794================================================================ 1795 1796By setting the 'GFORTRAN_CONVERT_UNIT' variable, it is possible to 1797change the representation of data for unformatted files. The syntax for 1798the 'GFORTRAN_CONVERT_UNIT' variable is: 1799 GFORTRAN_CONVERT_UNIT: mode | mode ';' exception | exception ; 1800 mode: 'native' | 'swap' | 'big_endian' | 'little_endian' ; 1801 exception: mode ':' unit_list | unit_list ; 1802 unit_list: unit_spec | unit_list unit_spec ; 1803 unit_spec: INTEGER | INTEGER '-' INTEGER ; 1804 The variable consists of an optional default mode, followed by a list 1805of optional exceptions, which are separated by semicolons from the 1806preceding default and each other. Each exception consists of a format 1807and a comma-separated list of units. Valid values for the modes are the 1808same as for the 'CONVERT' specifier: 1809 1810 'NATIVE' Use the native format. This is the default. 1811 'SWAP' Swap between little- and big-endian. 1812 'LITTLE_ENDIAN' Use the little-endian format for unformatted files. 1813 'BIG_ENDIAN' Use the big-endian format for unformatted files. 1814 A missing mode for an exception is taken to mean 'BIG_ENDIAN'. 1815Examples of values for 'GFORTRAN_CONVERT_UNIT' are: 1816 ''big_endian'' Do all unformatted I/O in big_endian mode. 1817 ''little_endian;native:10-20,25'' Do all unformatted I/O in 1818 little_endian mode, except for units 10 to 20 and 25, which are in 1819 native format. 1820 ''10-20'' Units 10 to 20 are big-endian, the rest is native. 1821 1822 Setting the environment variables should be done on the command line 1823or via the 'export' command for 'sh'-compatible shells and via 'setenv' 1824for 'csh'-compatible shells. 1825 1826 Example for 'sh': 1827 $ gfortran foo.f90 1828 $ GFORTRAN_CONVERT_UNIT='big_endian;native:10-20' ./a.out 1829 1830 Example code for 'csh': 1831 % gfortran foo.f90 1832 % setenv GFORTRAN_CONVERT_UNIT 'big_endian;native:10-20' 1833 % ./a.out 1834 1835 Using anything but the native representation for unformatted data 1836carries a significant speed overhead. If speed in this area matters to 1837you, it is best if you use this only for data that needs to be portable. 1838 1839 *Note CONVERT specifier::, for an alternative way to specify the data 1840representation for unformatted files. *Note Runtime Options::, for 1841setting a default data representation for the whole program. The 1842'CONVERT' specifier overrides the '-fconvert' compile options. 1843 1844 _Note that the values specified via the GFORTRAN_CONVERT_UNIT 1845environment variable will override the CONVERT specifier in the open 1846statement_. This is to give control over data formats to users who do 1847not have the source code of their program available. 1848 1849 1850File: gfortran.info, Node: GFORTRAN_ERROR_BACKTRACE, Prev: GFORTRAN_CONVERT_UNIT, Up: Runtime 1851 18523.12 'GFORTRAN_ERROR_BACKTRACE'--Show backtrace on run-time errors 1853================================================================== 1854 1855If the 'GFORTRAN_ERROR_BACKTRACE' variable is set to 'y', 'Y' or '1' 1856(only the first letter is relevant) then a backtrace is printed when a 1857serious run-time error occurs. To disable the backtracing, set the 1858variable to 'n', 'N', '0'. Default is to print a backtrace unless the 1859'-fno-backtrace' compile option was used. 1860 1861 1862File: gfortran.info, Node: Fortran 2003 and 2008 status, Next: Compiler Characteristics, Prev: Runtime, Up: Top 1863 18644 Fortran 2003 and 2008 Status 1865****************************** 1866 1867* Menu: 1868 1869* Fortran 2003 status:: 1870* Fortran 2008 status:: 1871* TS 29113 status:: 1872 1873 1874File: gfortran.info, Node: Fortran 2003 status, Next: Fortran 2008 status, Up: Fortran 2003 and 2008 status 1875 18764.1 Fortran 2003 status 1877======================= 1878 1879GNU Fortran supports several Fortran 2003 features; an incomplete list 1880can be found below. See also the wiki page 1881(http://gcc.gnu.org/wiki/Fortran2003) about Fortran 2003. 1882 1883 * Procedure pointers including procedure-pointer components with 1884 'PASS' attribute. 1885 1886 * Procedures which are bound to a derived type (type-bound 1887 procedures) including 'PASS', 'PROCEDURE' and 'GENERIC', and 1888 operators bound to a type. 1889 1890 * Abstract interfaces and type extension with the possibility to 1891 override type-bound procedures or to have deferred binding. 1892 1893 * Polymorphic entities ("'CLASS'") for derived types and unlimited 1894 polymorphism ("'CLASS(*)'") - including 'SAME_TYPE_AS', 1895 'EXTENDS_TYPE_OF' and 'SELECT TYPE' for scalars and arrays and 1896 finalization. 1897 1898 * Generic interface names, which have the same name as derived types, 1899 are now supported. This allows one to write constructor functions. 1900 Note that Fortran does not support static constructor functions. 1901 For static variables, only default initialization or 1902 structure-constructor initialization are available. 1903 1904 * The 'ASSOCIATE' construct. 1905 1906 * Interoperability with C including enumerations, 1907 1908 * In structure constructors the components with default values may be 1909 omitted. 1910 1911 * Extensions to the 'ALLOCATE' statement, allowing for a 1912 type-specification with type parameter and for allocation and 1913 initialization from a 'SOURCE=' expression; 'ALLOCATE' and 1914 'DEALLOCATE' optionally return an error message string via 1915 'ERRMSG='. 1916 1917 * Reallocation on assignment: If an intrinsic assignment is used, an 1918 allocatable variable on the left-hand side is automatically 1919 allocated (if unallocated) or reallocated (if the shape is 1920 different). Currently, scalar deferred character length left-hand 1921 sides are correctly handled but arrays are not yet fully 1922 implemented. 1923 1924 * Deferred-length character variables and scalar deferred-length 1925 character components of derived types are supported. (Note that 1926 array-valued compoents are not yet implemented.) 1927 1928 * Transferring of allocations via 'MOVE_ALLOC'. 1929 1930 * The 'PRIVATE' and 'PUBLIC' attributes may be given individually to 1931 derived-type components. 1932 1933 * In pointer assignments, the lower bound may be specified and the 1934 remapping of elements is supported. 1935 1936 * For pointers an 'INTENT' may be specified which affect the 1937 association status not the value of the pointer target. 1938 1939 * Intrinsics 'command_argument_count', 'get_command', 1940 'get_command_argument', and 'get_environment_variable'. 1941 1942 * Support for Unicode characters (ISO 10646) and UTF-8, including the 1943 'SELECTED_CHAR_KIND' and 'NEW_LINE' intrinsic functions. 1944 1945 * Support for binary, octal and hexadecimal (BOZ) constants in the 1946 intrinsic functions 'INT', 'REAL', 'CMPLX' and 'DBLE'. 1947 1948 * Support for namelist variables with allocatable and pointer 1949 attribute and nonconstant length type parameter. 1950 1951 * Array constructors using square brackets. That is, '[...]' rather 1952 than '(/.../)'. Type-specification for array constructors like '(/ 1953 some-type :: ... /)'. 1954 1955 * Extensions to the specification and initialization expressions, 1956 including the support for intrinsics with real and complex 1957 arguments. 1958 1959 * Support for the asynchronous input/output syntax; however, the data 1960 transfer is currently always synchronously performed. 1961 1962 * 'FLUSH' statement. 1963 1964 * 'IOMSG=' specifier for I/O statements. 1965 1966 * Support for the declaration of enumeration constants via the 'ENUM' 1967 and 'ENUMERATOR' statements. Interoperability with 'gcc' is 1968 guaranteed also for the case where the '-fshort-enums' command line 1969 option is given. 1970 1971 * TR 15581: 1972 * 'ALLOCATABLE' dummy arguments. 1973 * 'ALLOCATABLE' function results 1974 * 'ALLOCATABLE' components of derived types 1975 1976 * The 'OPEN' statement supports the 'ACCESS='STREAM'' specifier, 1977 allowing I/O without any record structure. 1978 1979 * Namelist input/output for internal files. 1980 1981 * Minor I/O features: Rounding during formatted output, using of a 1982 decimal comma instead of a decimal point, setting whether a plus 1983 sign should appear for positive numbers. On system where 'strtod' 1984 honours the rounding mode, the rounding mode is also supported for 1985 input. 1986 1987 * The 'PROTECTED' statement and attribute. 1988 1989 * The 'VALUE' statement and attribute. 1990 1991 * The 'VOLATILE' statement and attribute. 1992 1993 * The 'IMPORT' statement, allowing to import host-associated derived 1994 types. 1995 1996 * The intrinsic modules 'ISO_FORTRAN_ENVIRONMENT' is supported, which 1997 contains parameters of the I/O units, storage sizes. Additionally, 1998 procedures for C interoperability are available in the 1999 'ISO_C_BINDING' module. 2000 2001 * 'USE' statement with 'INTRINSIC' and 'NON_INTRINSIC' attribute; 2002 supported intrinsic modules: 'ISO_FORTRAN_ENV', 'ISO_C_BINDING', 2003 'OMP_LIB' and 'OMP_LIB_KINDS'. 2004 2005 * Renaming of operators in the 'USE' statement. 2006 2007 2008File: gfortran.info, Node: Fortran 2008 status, Next: TS 29113 status, Prev: Fortran 2003 status, Up: Fortran 2003 and 2008 status 2009 20104.2 Fortran 2008 status 2011======================= 2012 2013The latest version of the Fortran standard is ISO/IEC 1539-1:2010, 2014informally known as Fortran 2008. The official version is available 2015from International Organization for Standardization (ISO) or its 2016national member organizations. The the final draft (FDIS) can be 2017downloaded free of charge from 2018<http://www.nag.co.uk/sc22wg5/links.html>. Fortran is developed by the 2019Working Group 5 of Sub-Committee 22 of the Joint Technical Committee 1 2020of the International Organization for Standardization and the 2021International Electrotechnical Commission (IEC). This group is known as 2022WG5 (http://www.nag.co.uk/sc22wg5/). 2023 2024 The GNU Fortran compiler supports several of the new features of 2025Fortran 2008; the wiki (http://gcc.gnu.org/wiki/Fortran2008Status) has 2026some information about the current Fortran 2008 implementation status. 2027In particular, the following is implemented. 2028 2029 * The '-std=f2008' option and support for the file extensions '.f08' 2030 and '.F08'. 2031 2032 * The 'OPEN' statement now supports the 'NEWUNIT=' option, which 2033 returns a unique file unit, thus preventing inadvertent use of the 2034 same unit in different parts of the program. 2035 2036 * The 'g0' format descriptor and unlimited format items. 2037 2038 * The mathematical intrinsics 'ASINH', 'ACOSH', 'ATANH', 'ERF', 2039 'ERFC', 'GAMMA', 'LOG_GAMMA', 'BESSEL_J0', 'BESSEL_J1', 2040 'BESSEL_JN', 'BESSEL_Y0', 'BESSEL_Y1', 'BESSEL_YN', 'HYPOT', 2041 'NORM2', and 'ERFC_SCALED'. 2042 2043 * Using complex arguments with 'TAN', 'SINH', 'COSH', 'TANH', 'ASIN', 2044 'ACOS', and 'ATAN' is now possible; 'ATAN'(Y,X) is now an alias for 2045 'ATAN2'(Y,X). 2046 2047 * Support of the 'PARITY' intrinsic functions. 2048 2049 * The following bit intrinsics: 'LEADZ' and 'TRAILZ' for counting the 2050 number of leading and trailing zero bits, 'POPCNT' and 'POPPAR' for 2051 counting the number of one bits and returning the parity; 'BGE', 2052 'BGT', 'BLE', and 'BLT' for bitwise comparisons; 'DSHIFTL' and 2053 'DSHIFTR' for combined left and right shifts, 'MASKL' and 'MASKR' 2054 for simple left and right justified masks, 'MERGE_BITS' for a 2055 bitwise merge using a mask, 'SHIFTA', 'SHIFTL' and 'SHIFTR' for 2056 shift operations, and the transformational bit intrinsics 'IALL', 2057 'IANY' and 'IPARITY'. 2058 2059 * Support of the 'EXECUTE_COMMAND_LINE' intrinsic subroutine. 2060 2061 * Support for the 'STORAGE_SIZE' intrinsic inquiry function. 2062 2063 * The 'INT{8,16,32}' and 'REAL{32,64,128}' kind type parameters and 2064 the array-valued named constants 'INTEGER_KINDS', 'LOGICAL_KINDS', 2065 'REAL_KINDS' and 'CHARACTER_KINDS' of the intrinsic module 2066 'ISO_FORTRAN_ENV'. 2067 2068 * The module procedures 'C_SIZEOF' of the intrinsic module 2069 'ISO_C_BINDINGS' and 'COMPILER_VERSION' and 'COMPILER_OPTIONS' of 2070 'ISO_FORTRAN_ENV'. 2071 2072 * Coarray support for serial programs with '-fcoarray=single' flag 2073 and experimental support for multiple images with the 2074 '-fcoarray=lib' flag. 2075 2076 * The 'DO CONCURRENT' construct is supported. 2077 2078 * The 'BLOCK' construct is supported. 2079 2080 * The 'STOP' and the new 'ERROR STOP' statements now support all 2081 constant expressions. Both show the signals which were signaling 2082 at termination. 2083 2084 * Support for the 'CONTIGUOUS' attribute. 2085 2086 * Support for 'ALLOCATE' with 'MOLD'. 2087 2088 * Support for the 'IMPURE' attribute for procedures, which allows for 2089 'ELEMENTAL' procedures without the restrictions of 'PURE'. 2090 2091 * Null pointers (including 'NULL()') and not-allocated variables can 2092 be used as actual argument to optional non-pointer, non-allocatable 2093 dummy arguments, denoting an absent argument. 2094 2095 * Non-pointer variables with 'TARGET' attribute can be used as actual 2096 argument to 'POINTER' dummies with 'INTENT(IN)'. 2097 2098 * Pointers including procedure pointers and those in a derived type 2099 (pointer components) can now be initialized by a target instead of 2100 only by 'NULL'. 2101 2102 * The 'EXIT' statement (with construct-name) can be now be used to 2103 leave not only the 'DO' but also the 'ASSOCIATE', 'BLOCK', 'IF', 2104 'SELECT CASE' and 'SELECT TYPE' constructs. 2105 2106 * Internal procedures can now be used as actual argument. 2107 2108 * Minor features: obsolesce diagnostics for 'ENTRY' with 2109 '-std=f2008'; a line may start with a semicolon; for internal and 2110 module procedures 'END' can be used instead of 'END SUBROUTINE' and 2111 'END FUNCTION'; 'SELECTED_REAL_KIND' now also takes a 'RADIX' 2112 argument; intrinsic types are supported for 2113 'TYPE'(INTRINSIC-TYPE-SPEC); multiple type-bound procedures can be 2114 declared in a single 'PROCEDURE' statement; implied-shape arrays 2115 are supported for named constants ('PARAMETER'). 2116 2117 2118File: gfortran.info, Node: TS 29113 status, Prev: Fortran 2008 status, Up: Fortran 2003 and 2008 status 2119 21204.3 Technical Specification 29113 Status 2121======================================== 2122 2123GNU Fortran supports some of the new features of the Technical 2124Specification (TS) 29113 on Further Interoperability of Fortran with C. 2125The wiki (http://gcc.gnu.org/wiki/TS29113Status) has some information 2126about the current TS 29113 implementation status. In particular, the 2127following is implemented. 2128 2129 See also *note Further Interoperability of Fortran with C::. 2130 2131 * The '-std=f2008ts' option. 2132 2133 * The 'OPTIONAL' attribute is allowed for dummy arguments of 'BIND(C) 2134 procedures.' 2135 2136 * The 'RANK' intrinsic is supported. 2137 2138 * GNU Fortran's implementation for variables with 'ASYNCHRONOUS' 2139 attribute is compatible with TS 29113. 2140 2141 * Assumed types ('TYPE(*)'. 2142 2143 * Assumed-rank ('DIMENSION(..)'). However, the array descriptor of 2144 the TS is not yet supported. 2145 2146 2147File: gfortran.info, Node: Compiler Characteristics, Next: Extensions, Prev: Fortran 2003 and 2008 status, Up: Top 2148 21495 Compiler Characteristics 2150************************** 2151 2152This chapter describes certain characteristics of the GNU Fortran 2153compiler, that are not specified by the Fortran standard, but which 2154might in some way or another become visible to the programmer. 2155 2156* Menu: 2157 2158* KIND Type Parameters:: 2159* Internal representation of LOGICAL variables:: 2160* Thread-safety of the runtime library:: 2161* Data consistency and durability:: 2162 2163 2164File: gfortran.info, Node: KIND Type Parameters, Next: Internal representation of LOGICAL variables, Up: Compiler Characteristics 2165 21665.1 KIND Type Parameters 2167======================== 2168 2169The 'KIND' type parameters supported by GNU Fortran for the primitive 2170data types are: 2171 2172'INTEGER' 2173 1, 2, 4, 8*, 16*, default: 4** 2174 2175'LOGICAL' 2176 1, 2, 4, 8*, 16*, default: 4** 2177 2178'REAL' 2179 4, 8, 10*, 16*, default: 4*** 2180 2181'COMPLEX' 2182 4, 8, 10*, 16*, default: 4*** 2183 2184'DOUBLE PRECISION' 2185 4, 8, 10*, 16*, default: 8*** 2186 2187'CHARACTER' 2188 1, 4, default: 1 2189 2190* not available on all systems 2191** unless '-fdefault-integer-8' is used 2192*** unless '-fdefault-real-8' is used (see *note Fortran Dialect 2193Options::) 2194 2195The 'KIND' value matches the storage size in bytes, except for 'COMPLEX' 2196where the storage size is twice as much (or both real and imaginary part 2197are a real value of the given size). It is recommended to use the *note 2198SELECTED_CHAR_KIND::, *note SELECTED_INT_KIND:: and *note 2199SELECTED_REAL_KIND:: intrinsics or the 'INT8', 'INT16', 'INT32', 2200'INT64', 'REAL32', 'REAL64', and 'REAL128' parameters of the 2201'ISO_FORTRAN_ENV' module instead of the concrete values. The available 2202kind parameters can be found in the constant arrays 'CHARACTER_KINDS', 2203'INTEGER_KINDS', 'LOGICAL_KINDS' and 'REAL_KINDS' in the *note 2204ISO_FORTRAN_ENV:: module. For C interoperability, the kind parameters 2205of the *note ISO_C_BINDING:: module should be used. 2206 2207 2208File: gfortran.info, Node: Internal representation of LOGICAL variables, Next: Thread-safety of the runtime library, Prev: KIND Type Parameters, Up: Compiler Characteristics 2209 22105.2 Internal representation of LOGICAL variables 2211================================================ 2212 2213The Fortran standard does not specify how variables of 'LOGICAL' type 2214are represented, beyond requiring that 'LOGICAL' variables of default 2215kind have the same storage size as default 'INTEGER' and 'REAL' 2216variables. The GNU Fortran internal representation is as follows. 2217 2218 A 'LOGICAL(KIND=N)' variable is represented as an 'INTEGER(KIND=N)' 2219variable, however, with only two permissible values: '1' for '.TRUE.' 2220and '0' for '.FALSE.'. Any other integer value results in undefined 2221behavior. 2222 2223 See also *note Argument passing conventions:: and *note 2224Interoperability with C::. 2225 2226 2227File: gfortran.info, Node: Thread-safety of the runtime library, Next: Data consistency and durability, Prev: Internal representation of LOGICAL variables, Up: Compiler Characteristics 2228 22295.3 Thread-safety of the runtime library 2230======================================== 2231 2232GNU Fortran can be used in programs with multiple threads, e.g. by using 2233OpenMP, by calling OS thread handling functions via the 'ISO_C_BINDING' 2234facility, or by GNU Fortran compiled library code being called from a 2235multi-threaded program. 2236 2237 The GNU Fortran runtime library, ('libgfortran'), supports being 2238called concurrently from multiple threads with the following exceptions. 2239 2240 During library initialization, the C 'getenv' function is used, which 2241need not be thread-safe. Similarly, the 'getenv' function is used to 2242implement the 'GET_ENVIRONMENT_VARIABLE' and 'GETENV' intrinsics. It is 2243the responsibility of the user to ensure that the environment is not 2244being updated concurrently when any of these actions are taking place. 2245 2246 The 'EXECUTE_COMMAND_LINE' and 'SYSTEM' intrinsics are implemented 2247with the 'system' function, which need not be thread-safe. It is the 2248responsibility of the user to ensure that 'system' is not called 2249concurrently. 2250 2251 Finally, for platforms not supporting thread-safe POSIX functions, 2252further functionality might not be thread-safe. For details, please 2253consult the documentation for your operating system. 2254 2255 2256File: gfortran.info, Node: Data consistency and durability, Prev: Thread-safety of the runtime library, Up: Compiler Characteristics 2257 22585.4 Data consistency and durability 2259=================================== 2260 2261This section contains a brief overview of data and metadata consistency 2262and durability issues when doing I/O. 2263 2264 With respect to durability, GNU Fortran makes no effort to ensure 2265that data is committed to stable storage. If this is required, the GNU 2266Fortran programmer can use the intrinsic 'FNUM' to retrieve the low 2267level file descriptor corresponding to an open Fortran unit. Then, 2268using e.g. the 'ISO_C_BINDING' feature, one can call the underlying 2269system call to flush dirty data to stable storage, such as 'fsync' on 2270POSIX, '_commit' on MingW, or 'fcntl(fd, F_FULLSYNC, 0)' on Mac OS X. 2271The following example shows how to call fsync: 2272 2273 ! Declare the interface for POSIX fsync function 2274 interface 2275 function fsync (fd) bind(c,name="fsync") 2276 use iso_c_binding, only: c_int 2277 integer(c_int), value :: fd 2278 integer(c_int) :: fsync 2279 end function fsync 2280 end interface 2281 2282 ! Variable declaration 2283 integer :: ret 2284 2285 ! Opening unit 10 2286 open (10,file="foo") 2287 2288 ! ... 2289 ! Perform I/O on unit 10 2290 ! ... 2291 2292 ! Flush and sync 2293 flush(10) 2294 ret = fsync(fnum(10)) 2295 2296 ! Handle possible error 2297 if (ret /= 0) stop "Error calling FSYNC" 2298 2299 With respect to consistency, for regular files GNU Fortran uses 2300buffered I/O in order to improve performance. This buffer is flushed 2301automatically when full and in some other situations, e.g. when closing 2302a unit. It can also be explicitly flushed with the 'FLUSH' statement. 2303Also, the buffering can be turned off with the 'GFORTRAN_UNBUFFERED_ALL' 2304and 'GFORTRAN_UNBUFFERED_PRECONNECTED' environment variables. Special 2305files, such as terminals and pipes, are always unbuffered. Sometimes, 2306however, further things may need to be done in order to allow other 2307processes to see data that GNU Fortran has written, as follows. 2308 2309 The Windows platform supports a relaxed metadata consistency model, 2310where file metadata is written to the directory lazily. This means 2311that, for instance, the 'dir' command can show a stale size for a file. 2312One can force a directory metadata update by closing the unit, or by 2313calling '_commit' on the file descriptor. Note, though, that '_commit' 2314will force all dirty data to stable storage, which is often a very slow 2315operation. 2316 2317 The Network File System (NFS) implements a relaxed consistency model 2318called open-to-close consistency. Closing a file forces dirty data and 2319metadata to be flushed to the server, and opening a file forces the 2320client to contact the server in order to revalidate cached data. 2321'fsync' will also force a flush of dirty data and metadata to the 2322server. Similar to 'open' and 'close', acquiring and releasing 'fcntl' 2323file locks, if the server supports them, will also force cache 2324validation and flushing dirty data and metadata. 2325 2326 2327File: gfortran.info, Node: Extensions, Next: Mixed-Language Programming, Prev: Compiler Characteristics, Up: Top 2328 23296 Extensions 2330************ 2331 2332The two sections below detail the extensions to standard Fortran that 2333are implemented in GNU Fortran, as well as some of the popular or 2334historically important extensions that are not (or not yet) implemented. 2335For the latter case, we explain the alternatives available to GNU 2336Fortran users, including replacement by standard-conforming code or GNU 2337extensions. 2338 2339* Menu: 2340 2341* Extensions implemented in GNU Fortran:: 2342* Extensions not implemented in GNU Fortran:: 2343 2344 2345File: gfortran.info, Node: Extensions implemented in GNU Fortran, Next: Extensions not implemented in GNU Fortran, Up: Extensions 2346 23476.1 Extensions implemented in GNU Fortran 2348========================================= 2349 2350GNU Fortran implements a number of extensions over standard Fortran. 2351This chapter contains information on their syntax and meaning. There 2352are currently two categories of GNU Fortran extensions, those that 2353provide functionality beyond that provided by any standard, and those 2354that are supported by GNU Fortran purely for backward compatibility with 2355legacy compilers. By default, '-std=gnu' allows the compiler to accept 2356both types of extensions, but to warn about the use of the latter. 2357Specifying either '-std=f95', '-std=f2003' or '-std=f2008' disables both 2358types of extensions, and '-std=legacy' allows both without warning. 2359 2360* Menu: 2361 2362* Old-style kind specifications:: 2363* Old-style variable initialization:: 2364* Extensions to namelist:: 2365* X format descriptor without count field:: 2366* Commas in FORMAT specifications:: 2367* Missing period in FORMAT specifications:: 2368* I/O item lists:: 2369* 'Q' exponent-letter:: 2370* BOZ literal constants:: 2371* Real array indices:: 2372* Unary operators:: 2373* Implicitly convert LOGICAL and INTEGER values:: 2374* Hollerith constants support:: 2375* Cray pointers:: 2376* CONVERT specifier:: 2377* OpenMP:: 2378* Argument list functions:: 2379 2380 2381File: gfortran.info, Node: Old-style kind specifications, Next: Old-style variable initialization, Up: Extensions implemented in GNU Fortran 2382 23836.1.1 Old-style kind specifications 2384----------------------------------- 2385 2386GNU Fortran allows old-style kind specifications in declarations. These 2387look like: 2388 TYPESPEC*size x,y,z 2389where 'TYPESPEC' is a basic type ('INTEGER', 'REAL', etc.), and where 2390'size' is a byte count corresponding to the storage size of a valid kind 2391for that type. (For 'COMPLEX' variables, 'size' is the total size of 2392the real and imaginary parts.) The statement then declares 'x', 'y' and 2393'z' to be of type 'TYPESPEC' with the appropriate kind. This is 2394equivalent to the standard-conforming declaration 2395 TYPESPEC(k) x,y,z 2396where 'k' is the kind parameter suitable for the intended precision. As 2397kind parameters are implementation-dependent, use the 'KIND', 2398'SELECTED_INT_KIND' and 'SELECTED_REAL_KIND' intrinsics to retrieve the 2399correct value, for instance 'REAL*8 x' can be replaced by: 2400 INTEGER, PARAMETER :: dbl = KIND(1.0d0) 2401 REAL(KIND=dbl) :: x 2402 2403 2404File: gfortran.info, Node: Old-style variable initialization, Next: Extensions to namelist, Prev: Old-style kind specifications, Up: Extensions implemented in GNU Fortran 2405 24066.1.2 Old-style variable initialization 2407--------------------------------------- 2408 2409GNU Fortran allows old-style initialization of variables of the form: 2410 INTEGER i/1/,j/2/ 2411 REAL x(2,2) /3*0.,1./ 2412 The syntax for the initializers is as for the 'DATA' statement, but 2413unlike in a 'DATA' statement, an initializer only applies to the 2414variable immediately preceding the initialization. In other words, 2415something like 'INTEGER I,J/2,3/' is not valid. This style of 2416initialization is only allowed in declarations without double colons 2417('::'); the double colons were introduced in Fortran 90, which also 2418introduced a standard syntax for initializing variables in type 2419declarations. 2420 2421 Examples of standard-conforming code equivalent to the above example 2422are: 2423 ! Fortran 90 2424 INTEGER :: i = 1, j = 2 2425 REAL :: x(2,2) = RESHAPE((/0.,0.,0.,1./),SHAPE(x)) 2426 ! Fortran 77 2427 INTEGER i, j 2428 REAL x(2,2) 2429 DATA i/1/, j/2/, x/3*0.,1./ 2430 2431 Note that variables which are explicitly initialized in declarations 2432or in 'DATA' statements automatically acquire the 'SAVE' attribute. 2433 2434 2435File: gfortran.info, Node: Extensions to namelist, Next: X format descriptor without count field, Prev: Old-style variable initialization, Up: Extensions implemented in GNU Fortran 2436 24376.1.3 Extensions to namelist 2438---------------------------- 2439 2440GNU Fortran fully supports the Fortran 95 standard for namelist I/O 2441including array qualifiers, substrings and fully qualified derived 2442types. The output from a namelist write is compatible with namelist 2443read. The output has all names in upper case and indentation to column 24441 after the namelist name. Two extensions are permitted: 2445 2446 Old-style use of '$' instead of '&' 2447 $MYNML 2448 X(:)%Y(2) = 1.0 2.0 3.0 2449 CH(1:4) = "abcd" 2450 $END 2451 2452 It should be noted that the default terminator is '/' rather than 2453'&END'. 2454 2455 Querying of the namelist when inputting from stdin. After at least 2456one space, entering '?' sends to stdout the namelist name and the names 2457of the variables in the namelist: 2458 ? 2459 2460 &mynml 2461 x 2462 x%y 2463 ch 2464 &end 2465 2466 Entering '=?' outputs the namelist to stdout, as if 'WRITE(*,NML = 2467mynml)' had been called: 2468 =? 2469 2470 &MYNML 2471 X(1)%Y= 0.000000 , 1.000000 , 0.000000 , 2472 X(2)%Y= 0.000000 , 2.000000 , 0.000000 , 2473 X(3)%Y= 0.000000 , 3.000000 , 0.000000 , 2474 CH=abcd, / 2475 2476 To aid this dialog, when input is from stdin, errors send their 2477messages to stderr and execution continues, even if 'IOSTAT' is set. 2478 2479 'PRINT' namelist is permitted. This causes an error if '-std=f95' is 2480used. 2481 PROGRAM test_print 2482 REAL, dimension (4) :: x = (/1.0, 2.0, 3.0, 4.0/) 2483 NAMELIST /mynml/ x 2484 PRINT mynml 2485 END PROGRAM test_print 2486 2487 Expanded namelist reads are permitted. This causes an error if 2488'-std=f95' is used. In the following example, the first element of the 2489array will be given the value 0.00 and the two succeeding elements will 2490be given the values 1.00 and 2.00. 2491 &MYNML 2492 X(1,1) = 0.00 , 1.00 , 2.00 2493 / 2494 2495 When writing a namelist, if no 'DELIM=' is specified, by default a 2496double quote is used to delimit character strings. If -std=F95, F2003, 2497or F2008, etc, the delim status is set to 'none'. Defaulting to quotes 2498ensures that namelists with character strings can be subsequently read 2499back in accurately. 2500 2501 2502File: gfortran.info, Node: X format descriptor without count field, Next: Commas in FORMAT specifications, Prev: Extensions to namelist, Up: Extensions implemented in GNU Fortran 2503 25046.1.4 'X' format descriptor without count field 2505----------------------------------------------- 2506 2507To support legacy codes, GNU Fortran permits the count field of the 'X' 2508edit descriptor in 'FORMAT' statements to be omitted. When omitted, the 2509count is implicitly assumed to be one. 2510 2511 PRINT 10, 2, 3 2512 10 FORMAT (I1, X, I1) 2513 2514 2515File: 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 2516 25176.1.5 Commas in 'FORMAT' specifications 2518--------------------------------------- 2519 2520To support legacy codes, GNU Fortran allows the comma separator to be 2521omitted immediately before and after character string edit descriptors 2522in 'FORMAT' statements. 2523 2524 PRINT 10, 2, 3 2525 10 FORMAT ('FOO='I1' BAR='I2) 2526 2527 2528File: gfortran.info, Node: Missing period in FORMAT specifications, Next: I/O item lists, Prev: Commas in FORMAT specifications, Up: Extensions implemented in GNU Fortran 2529 25306.1.6 Missing period in 'FORMAT' specifications 2531----------------------------------------------- 2532 2533To support legacy codes, GNU Fortran allows missing periods in format 2534specifications if and only if '-std=legacy' is given on the command 2535line. This is considered non-conforming code and is discouraged. 2536 2537 REAL :: value 2538 READ(*,10) value 2539 10 FORMAT ('F4') 2540 2541 2542File: gfortran.info, Node: I/O item lists, Next: 'Q' exponent-letter, Prev: Missing period in FORMAT specifications, Up: Extensions implemented in GNU Fortran 2543 25446.1.7 I/O item lists 2545-------------------- 2546 2547To support legacy codes, GNU Fortran allows the input item list of the 2548'READ' statement, and the output item lists of the 'WRITE' and 'PRINT' 2549statements, to start with a comma. 2550 2551 2552File: gfortran.info, Node: 'Q' exponent-letter, Next: BOZ literal constants, Prev: I/O item lists, Up: Extensions implemented in GNU Fortran 2553 25546.1.8 'Q' exponent-letter 2555------------------------- 2556 2557GNU Fortran accepts real literal constants with an exponent-letter of 2558'Q', for example, '1.23Q45'. The constant is interpreted as a 2559'REAL(16)' entity on targets that support this type. If the target does 2560not support 'REAL(16)' but has a 'REAL(10)' type, then the 2561real-literal-constant will be interpreted as a 'REAL(10)' entity. In 2562the absence of 'REAL(16)' and 'REAL(10)', an error will occur. 2563 2564 2565File: gfortran.info, Node: BOZ literal constants, Next: Real array indices, Prev: 'Q' exponent-letter, Up: Extensions implemented in GNU Fortran 2566 25676.1.9 BOZ literal constants 2568--------------------------- 2569 2570Besides decimal constants, Fortran also supports binary ('b'), octal 2571('o') and hexadecimal ('z') integer constants. The syntax is: 'prefix 2572quote digits quote', were the prefix is either 'b', 'o' or 'z', quote is 2573either ''' or '"' and the digits are for binary '0' or '1', for octal 2574between '0' and '7', and for hexadecimal between '0' and 'F'. (Example: 2575'b'01011101''.) 2576 2577 Up to Fortran 95, BOZ literals were only allowed to initialize 2578integer variables in DATA statements. Since Fortran 2003 BOZ literals 2579are also allowed as argument of 'REAL', 'DBLE', 'INT' and 'CMPLX'; the 2580result is the same as if the integer BOZ literal had been converted by 2581'TRANSFER' to, respectively, 'real', 'double precision', 'integer' or 2582'complex'. As GNU Fortran extension the intrinsic procedures 'FLOAT', 2583'DFLOAT', 'COMPLEX' and 'DCMPLX' are treated alike. 2584 2585 As an extension, GNU Fortran allows hexadecimal BOZ literal constants 2586to be specified using the 'X' prefix, in addition to the standard 'Z' 2587prefix. The BOZ literal can also be specified by adding a suffix to the 2588string, for example, 'Z'ABC'' and ''ABC'Z' are equivalent. 2589 2590 Furthermore, GNU Fortran allows using BOZ literal constants outside 2591DATA statements and the four intrinsic functions allowed by Fortran 25922003. In DATA statements, in direct assignments, where the right-hand 2593side only contains a BOZ literal constant, and for old-style 2594initializers of the form 'integer i /o'0173'/', the constant is 2595transferred as if 'TRANSFER' had been used; for 'COMPLEX' numbers, only 2596the real part is initialized unless 'CMPLX' is used. In all other 2597cases, the BOZ literal constant is converted to an 'INTEGER' value with 2598the largest decimal representation. This value is then converted 2599numerically to the type and kind of the variable in question. (For 2600instance, 'real :: r = b'0000001' + 1' initializes 'r' with '2.0'.) As 2601different compilers implement the extension differently, one should be 2602careful when doing bitwise initialization of non-integer variables. 2603 2604 Note that initializing an 'INTEGER' variable with a statement such as 2605'DATA i/Z'FFFFFFFF'/' will give an integer overflow error rather than 2606the desired result of -1 when 'i' is a 32-bit integer on a system that 2607supports 64-bit integers. The '-fno-range-check' option can be used as 2608a workaround for legacy code that initializes integers in this manner. 2609 2610 2611File: gfortran.info, Node: Real array indices, Next: Unary operators, Prev: BOZ literal constants, Up: Extensions implemented in GNU Fortran 2612 26136.1.10 Real array indices 2614------------------------- 2615 2616As an extension, GNU Fortran allows the use of 'REAL' expressions or 2617variables as array indices. 2618 2619 2620File: gfortran.info, Node: Unary operators, Next: Implicitly convert LOGICAL and INTEGER values, Prev: Real array indices, Up: Extensions implemented in GNU Fortran 2621 26226.1.11 Unary operators 2623---------------------- 2624 2625As an extension, GNU Fortran allows unary plus and unary minus operators 2626to appear as the second operand of binary arithmetic operators without 2627the need for parenthesis. 2628 2629 X = Y * -Z 2630 2631 2632File: gfortran.info, Node: Implicitly convert LOGICAL and INTEGER values, Next: Hollerith constants support, Prev: Unary operators, Up: Extensions implemented in GNU Fortran 2633 26346.1.12 Implicitly convert 'LOGICAL' and 'INTEGER' values 2635-------------------------------------------------------- 2636 2637As an extension for backwards compatibility with other compilers, GNU 2638Fortran allows the implicit conversion of 'LOGICAL' values to 'INTEGER' 2639values and vice versa. When converting from a 'LOGICAL' to an 2640'INTEGER', '.FALSE.' is interpreted as zero, and '.TRUE.' is interpreted 2641as one. When converting from 'INTEGER' to 'LOGICAL', the value zero is 2642interpreted as '.FALSE.' and any nonzero value is interpreted as 2643'.TRUE.'. 2644 2645 LOGICAL :: l 2646 l = 1 2647 INTEGER :: i 2648 i = .TRUE. 2649 2650 However, there is no implicit conversion of 'INTEGER' values in 2651'if'-statements, nor of 'LOGICAL' or 'INTEGER' values in I/O operations. 2652 2653 2654File: gfortran.info, Node: Hollerith constants support, Next: Cray pointers, Prev: Implicitly convert LOGICAL and INTEGER values, Up: Extensions implemented in GNU Fortran 2655 26566.1.13 Hollerith constants support 2657---------------------------------- 2658 2659GNU Fortran supports Hollerith constants in assignments, function 2660arguments, and 'DATA' and 'ASSIGN' statements. A Hollerith constant is 2661written as a string of characters preceded by an integer constant 2662indicating the character count, and the letter 'H' or 'h', and stored in 2663bytewise fashion in a numeric ('INTEGER', 'REAL', or 'complex') or 2664'LOGICAL' variable. The constant will be padded or truncated to fit the 2665size of the variable in which it is stored. 2666 2667 Examples of valid uses of Hollerith constants: 2668 complex*16 x(2) 2669 data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/ 2670 x(1) = 16HABCDEFGHIJKLMNOP 2671 call foo (4h abc) 2672 2673 Invalid Hollerith constants examples: 2674 integer*4 a 2675 a = 8H12345678 ! Valid, but the Hollerith constant will be truncated. 2676 a = 0H ! At least one character is needed. 2677 2678 In general, Hollerith constants were used to provide a rudimentary 2679facility for handling character strings in early Fortran compilers, 2680prior to the introduction of 'CHARACTER' variables in Fortran 77; in 2681those cases, the standard-compliant equivalent is to convert the program 2682to use proper character strings. On occasion, there may be a case where 2683the intent is specifically to initialize a numeric variable with a given 2684byte sequence. In these cases, the same result can be obtained by using 2685the 'TRANSFER' statement, as in this example. 2686 INTEGER(KIND=4) :: a 2687 a = TRANSFER ("abcd", a) ! equivalent to: a = 4Habcd 2688 2689 2690File: gfortran.info, Node: Cray pointers, Next: CONVERT specifier, Prev: Hollerith constants support, Up: Extensions implemented in GNU Fortran 2691 26926.1.14 Cray pointers 2693-------------------- 2694 2695Cray pointers are part of a non-standard extension that provides a 2696C-like pointer in Fortran. This is accomplished through a pair of 2697variables: an integer "pointer" that holds a memory address, and a 2698"pointee" that is used to dereference the pointer. 2699 2700 Pointer/pointee pairs are declared in statements of the form: 2701 pointer ( <pointer> , <pointee> ) 2702 or, 2703 pointer ( <pointer1> , <pointee1> ), ( <pointer2> , <pointee2> ), ... 2704 The pointer is an integer that is intended to hold a memory address. 2705The pointee may be an array or scalar. A pointee can be an assumed size 2706array--that is, the last dimension may be left unspecified by using a 2707'*' in place of a value--but a pointee cannot be an assumed shape array. 2708No space is allocated for the pointee. 2709 2710 The pointee may have its type declared before or after the pointer 2711statement, and its array specification (if any) may be declared before, 2712during, or after the pointer statement. The pointer may be declared as 2713an integer prior to the pointer statement. However, some machines have 2714default integer sizes that are different than the size of a pointer, and 2715so the following code is not portable: 2716 integer ipt 2717 pointer (ipt, iarr) 2718 If a pointer is declared with a kind that is too small, the compiler 2719will issue a warning; the resulting binary will probably not work 2720correctly, because the memory addresses stored in the pointers may be 2721truncated. It is safer to omit the first line of the above example; if 2722explicit declaration of ipt's type is omitted, then the compiler will 2723ensure that ipt is an integer variable large enough to hold a pointer. 2724 2725 Pointer arithmetic is valid with Cray pointers, but it is not the 2726same as C pointer arithmetic. Cray pointers are just ordinary integers, 2727so the user is responsible for determining how many bytes to add to a 2728pointer in order to increment it. Consider the following example: 2729 real target(10) 2730 real pointee(10) 2731 pointer (ipt, pointee) 2732 ipt = loc (target) 2733 ipt = ipt + 1 2734 The last statement does not set 'ipt' to the address of 'target(1)', 2735as it would in C pointer arithmetic. Adding '1' to 'ipt' just adds one 2736byte to the address stored in 'ipt'. 2737 2738 Any expression involving the pointee will be translated to use the 2739value stored in the pointer as the base address. 2740 2741 To get the address of elements, this extension provides an intrinsic 2742function 'LOC()'. The 'LOC()' function is equivalent to the '&' 2743operator in C, except the address is cast to an integer type: 2744 real ar(10) 2745 pointer(ipt, arpte(10)) 2746 real arpte 2747 ipt = loc(ar) ! Makes arpte is an alias for ar 2748 arpte(1) = 1.0 ! Sets ar(1) to 1.0 2749 The pointer can also be set by a call to the 'MALLOC' intrinsic (see 2750*note MALLOC::). 2751 2752 Cray pointees often are used to alias an existing variable. For 2753example: 2754 integer target(10) 2755 integer iarr(10) 2756 pointer (ipt, iarr) 2757 ipt = loc(target) 2758 As long as 'ipt' remains unchanged, 'iarr' is now an alias for 2759'target'. The optimizer, however, will not detect this aliasing, so it 2760is unsafe to use 'iarr' and 'target' simultaneously. Using a pointee in 2761any way that violates the Fortran aliasing rules or assumptions is 2762illegal. It is the user's responsibility to avoid doing this; the 2763compiler works under the assumption that no such aliasing occurs. 2764 2765 Cray pointers will work correctly when there is no aliasing (i.e., 2766when they are used to access a dynamically allocated block of memory), 2767and also in any routine where a pointee is used, but any variable with 2768which it shares storage is not used. Code that violates these rules may 2769not run as the user intends. This is not a bug in the optimizer; any 2770code that violates the aliasing rules is illegal. (Note that this is 2771not unique to GNU Fortran; any Fortran compiler that supports Cray 2772pointers will "incorrectly" optimize code with illegal aliasing.) 2773 2774 There are a number of restrictions on the attributes that can be 2775applied to Cray pointers and pointees. Pointees may not have the 2776'ALLOCATABLE', 'INTENT', 'OPTIONAL', 'DUMMY', 'TARGET', 'INTRINSIC', or 2777'POINTER' attributes. Pointers may not have the 'DIMENSION', 'POINTER', 2778'TARGET', 'ALLOCATABLE', 'EXTERNAL', or 'INTRINSIC' attributes, nor may 2779they be function results. Pointees may not occur in more than one 2780pointer statement. A pointee cannot be a pointer. Pointees cannot 2781occur in equivalence, common, or data statements. 2782 2783 A Cray pointer may also point to a function or a subroutine. For 2784example, the following excerpt is valid: 2785 implicit none 2786 external sub 2787 pointer (subptr,subpte) 2788 external subpte 2789 subptr = loc(sub) 2790 call subpte() 2791 [...] 2792 subroutine sub 2793 [...] 2794 end subroutine sub 2795 2796 A pointer may be modified during the course of a program, and this 2797will change the location to which the pointee refers. However, when 2798pointees are passed as arguments, they are treated as ordinary variables 2799in the invoked function. Subsequent changes to the pointer will not 2800change the base address of the array that was passed. 2801 2802 2803File: gfortran.info, Node: CONVERT specifier, Next: OpenMP, Prev: Cray pointers, Up: Extensions implemented in GNU Fortran 2804 28056.1.15 'CONVERT' specifier 2806-------------------------- 2807 2808GNU Fortran allows the conversion of unformatted data between little- 2809and big-endian representation to facilitate moving of data between 2810different systems. The conversion can be indicated with the 'CONVERT' 2811specifier on the 'OPEN' statement. *Note GFORTRAN_CONVERT_UNIT::, for 2812an alternative way of specifying the data format via an environment 2813variable. 2814 2815 Valid values for 'CONVERT' are: 2816 'CONVERT='NATIVE'' Use the native format. This is the default. 2817 'CONVERT='SWAP'' Swap between little- and big-endian. 2818 'CONVERT='LITTLE_ENDIAN'' Use the little-endian representation for 2819 unformatted files. 2820 'CONVERT='BIG_ENDIAN'' Use the big-endian representation for 2821 unformatted files. 2822 2823 Using the option could look like this: 2824 open(file='big.dat',form='unformatted',access='sequential', & 2825 convert='big_endian') 2826 2827 The value of the conversion can be queried by using 2828'INQUIRE(CONVERT=ch)'. The values returned are ''BIG_ENDIAN'' and 2829''LITTLE_ENDIAN''. 2830 2831 'CONVERT' works between big- and little-endian for 'INTEGER' values 2832of all supported kinds and for 'REAL' on IEEE systems of kinds 4 and 8. 2833Conversion between different "extended double" types on different 2834architectures such as m68k and x86_64, which GNU Fortran supports as 2835'REAL(KIND=10)' and 'REAL(KIND=16)', will probably not work. 2836 2837 _Note that the values specified via the GFORTRAN_CONVERT_UNIT 2838environment variable will override the CONVERT specifier in the open 2839statement_. This is to give control over data formats to users who do 2840not have the source code of their program available. 2841 2842 Using anything but the native representation for unformatted data 2843carries a significant speed overhead. If speed in this area matters to 2844you, it is best if you use this only for data that needs to be portable. 2845 2846 2847File: gfortran.info, Node: OpenMP, Next: Argument list functions, Prev: CONVERT specifier, Up: Extensions implemented in GNU Fortran 2848 28496.1.16 OpenMP 2850------------- 2851 2852OpenMP (Open Multi-Processing) is an application programming interface 2853(API) that supports multi-platform shared memory multiprocessing 2854programming in C/C++ and Fortran on many architectures, including Unix 2855and Microsoft Windows platforms. It consists of a set of compiler 2856directives, library routines, and environment variables that influence 2857run-time behavior. 2858 2859 GNU Fortran strives to be compatible to the OpenMP Application 2860Program Interface v4.0 (http://openmp.org/wp/openmp-specifications/). 2861 2862 To enable the processing of the OpenMP directive '!$omp' in free-form 2863source code; the 'c$omp', '*$omp' and '!$omp' directives in fixed form; 2864the '!$' conditional compilation sentinels in free form; and the 'c$', 2865'*$' and '!$' sentinels in fixed form, 'gfortran' needs to be invoked 2866with the '-fopenmp'. This also arranges for automatic linking of the 2867GNU OpenMP runtime library *note libgomp: (libgomp)Top. 2868 2869 The OpenMP Fortran runtime library routines are provided both in a 2870form of a Fortran 90 module named 'omp_lib' and in a form of a Fortran 2871'include' file named 'omp_lib.h'. 2872 2873 An example of a parallelized loop taken from Appendix A.1 of the 2874OpenMP Application Program Interface v2.5: 2875 SUBROUTINE A1(N, A, B) 2876 INTEGER I, N 2877 REAL B(N), A(N) 2878 !$OMP PARALLEL DO !I is private by default 2879 DO I=2,N 2880 B(I) = (A(I) + A(I-1)) / 2.0 2881 ENDDO 2882 !$OMP END PARALLEL DO 2883 END SUBROUTINE A1 2884 2885 Please note: 2886 * '-fopenmp' implies '-frecursive', i.e., all local arrays will be 2887 allocated on the stack. When porting existing code to OpenMP, this 2888 may lead to surprising results, especially to segmentation faults 2889 if the stacksize is limited. 2890 2891 * On glibc-based systems, OpenMP enabled applications cannot be 2892 statically linked due to limitations of the underlying 2893 pthreads-implementation. It might be possible to get a working 2894 solution if '-Wl,--whole-archive -lpthread -Wl,--no-whole-archive' 2895 is added to the command line. However, this is not supported by 2896 'gcc' and thus not recommended. 2897 2898 2899File: gfortran.info, Node: Argument list functions, Prev: OpenMP, Up: Extensions implemented in GNU Fortran 2900 29016.1.17 Argument list functions '%VAL', '%REF' and '%LOC' 2902-------------------------------------------------------- 2903 2904GNU Fortran supports argument list functions '%VAL', '%REF' and '%LOC' 2905statements, for backward compatibility with g77. It is recommended that 2906these should be used only for code that is accessing facilities outside 2907of GNU Fortran, such as operating system or windowing facilities. It is 2908best to constrain such uses to isolated portions of a program-portions 2909that deal specifically and exclusively with low-level, system-dependent 2910facilities. Such portions might well provide a portable interface for 2911use by the program as a whole, but are themselves not portable, and 2912should be thoroughly tested each time they are rebuilt using a new 2913compiler or version of a compiler. 2914 2915 '%VAL' passes a scalar argument by value, '%REF' passes it by 2916reference and '%LOC' passes its memory location. Since gfortran already 2917passes scalar arguments by reference, '%REF' is in effect a do-nothing. 2918'%LOC' has the same effect as a Fortran pointer. 2919 2920 An example of passing an argument by value to a C subroutine foo.: 2921 C 2922 C prototype void foo_ (float x); 2923 C 2924 external foo 2925 real*4 x 2926 x = 3.14159 2927 call foo (%VAL (x)) 2928 end 2929 2930 For details refer to the g77 manual 2931<http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/index.html#Top>. 2932 2933 Also, 'c_by_val.f' and its partner 'c_by_val.c' of the GNU Fortran 2934testsuite are worth a look. 2935 2936 2937File: gfortran.info, Node: Extensions not implemented in GNU Fortran, Prev: Extensions implemented in GNU Fortran, Up: Extensions 2938 29396.2 Extensions not implemented in GNU Fortran 2940============================================= 2941 2942The long history of the Fortran language, its wide use and broad 2943userbase, the large number of different compiler vendors and the lack of 2944some features crucial to users in the first standards have lead to the 2945existence of a number of important extensions to the language. While 2946some of the most useful or popular extensions are supported by the GNU 2947Fortran compiler, not all existing extensions are supported. This 2948section aims at listing these extensions and offering advice on how best 2949make code that uses them running with the GNU Fortran compiler. 2950 2951* Menu: 2952 2953* STRUCTURE and RECORD:: 2954* ENCODE and DECODE statements:: 2955* Variable FORMAT expressions:: 2956* Alternate complex function syntax:: 2957* Volatile COMMON blocks:: 2958 2959 2960File: gfortran.info, Node: STRUCTURE and RECORD, Next: ENCODE and DECODE statements, Up: Extensions not implemented in GNU Fortran 2961 29626.2.1 'STRUCTURE' and 'RECORD' 2963------------------------------ 2964 2965Record structures are a pre-Fortran-90 vendor extension to create 2966user-defined aggregate data types. GNU Fortran does not support record 2967structures, only Fortran 90's "derived types", which have a different 2968syntax. 2969 2970 In many cases, record structures can easily be converted to derived 2971types. To convert, replace 'STRUCTURE /'STRUCTURE-NAME'/' by 'TYPE' 2972TYPE-NAME. Additionally, replace 'RECORD /'STRUCTURE-NAME'/' by 2973'TYPE('TYPE-NAME')'. Finally, in the component access, replace the 2974period ('.') by the percent sign ('%'). 2975 2976 Here is an example of code using the non portable record structure 2977syntax: 2978 2979 ! Declaring a structure named ``item'' and containing three fields: 2980 ! an integer ID, an description string and a floating-point price. 2981 STRUCTURE /item/ 2982 INTEGER id 2983 CHARACTER(LEN=200) description 2984 REAL price 2985 END STRUCTURE 2986 2987 ! Define two variables, an single record of type ``item'' 2988 ! named ``pear'', and an array of items named ``store_catalog'' 2989 RECORD /item/ pear, store_catalog(100) 2990 2991 ! We can directly access the fields of both variables 2992 pear.id = 92316 2993 pear.description = "juicy D'Anjou pear" 2994 pear.price = 0.15 2995 store_catalog(7).id = 7831 2996 store_catalog(7).description = "milk bottle" 2997 store_catalog(7).price = 1.2 2998 2999 ! We can also manipulate the whole structure 3000 store_catalog(12) = pear 3001 print *, store_catalog(12) 3002 3003This code can easily be rewritten in the Fortran 90 syntax as following: 3004 3005 ! ``STRUCTURE /name/ ... END STRUCTURE'' becomes 3006 ! ``TYPE name ... END TYPE'' 3007 TYPE item 3008 INTEGER id 3009 CHARACTER(LEN=200) description 3010 REAL price 3011 END TYPE 3012 3013 ! ``RECORD /name/ variable'' becomes ``TYPE(name) variable'' 3014 TYPE(item) pear, store_catalog(100) 3015 3016 ! Instead of using a dot (.) to access fields of a record, the 3017 ! standard syntax uses a percent sign (%) 3018 pear%id = 92316 3019 pear%description = "juicy D'Anjou pear" 3020 pear%price = 0.15 3021 store_catalog(7)%id = 7831 3022 store_catalog(7)%description = "milk bottle" 3023 store_catalog(7)%price = 1.2 3024 3025 ! Assignments of a whole variable do not change 3026 store_catalog(12) = pear 3027 print *, store_catalog(12) 3028 3029 3030File: gfortran.info, Node: ENCODE and DECODE statements, Next: Variable FORMAT expressions, Prev: STRUCTURE and RECORD, Up: Extensions not implemented in GNU Fortran 3031 30326.2.2 'ENCODE' and 'DECODE' statements 3033-------------------------------------- 3034 3035GNU Fortran does not support the 'ENCODE' and 'DECODE' statements. 3036These statements are best replaced by 'READ' and 'WRITE' statements 3037involving internal files ('CHARACTER' variables and arrays), which have 3038been part of the Fortran standard since Fortran 77. For example, 3039replace a code fragment like 3040 3041 INTEGER*1 LINE(80) 3042 REAL A, B, C 3043 c ... Code that sets LINE 3044 DECODE (80, 9000, LINE) A, B, C 3045 9000 FORMAT (1X, 3(F10.5)) 3046 3047with the following: 3048 3049 CHARACTER(LEN=80) LINE 3050 REAL A, B, C 3051 c ... Code that sets LINE 3052 READ (UNIT=LINE, FMT=9000) A, B, C 3053 9000 FORMAT (1X, 3(F10.5)) 3054 3055 Similarly, replace a code fragment like 3056 3057 INTEGER*1 LINE(80) 3058 REAL A, B, C 3059 c ... Code that sets A, B and C 3060 ENCODE (80, 9000, LINE) A, B, C 3061 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5)) 3062 3063with the following: 3064 3065 CHARACTER(LEN=80) LINE 3066 REAL A, B, C 3067 c ... Code that sets A, B and C 3068 WRITE (UNIT=LINE, FMT=9000) A, B, C 3069 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5)) 3070 3071 3072File: gfortran.info, Node: Variable FORMAT expressions, Next: Alternate complex function syntax, Prev: ENCODE and DECODE statements, Up: Extensions not implemented in GNU Fortran 3073 30746.2.3 Variable 'FORMAT' expressions 3075----------------------------------- 3076 3077A variable 'FORMAT' expression is format statement which includes angle 3078brackets enclosing a Fortran expression: 'FORMAT(I<N>)'. GNU Fortran 3079does not support this legacy extension. The effect of variable format 3080expressions can be reproduced by using the more powerful (and standard) 3081combination of internal output and string formats. For example, replace 3082a code fragment like this: 3083 3084 WRITE(6,20) INT1 3085 20 FORMAT(I<N+1>) 3086 3087with the following: 3088 3089 c Variable declaration 3090 CHARACTER(LEN=20) FMT 3091 c 3092 c Other code here... 3093 c 3094 WRITE(FMT,'("(I", I0, ")")') N+1 3095 WRITE(6,FMT) INT1 3096 3097or with: 3098 3099 c Variable declaration 3100 CHARACTER(LEN=20) FMT 3101 c 3102 c Other code here... 3103 c 3104 WRITE(FMT,*) N+1 3105 WRITE(6,"(I" // ADJUSTL(FMT) // ")") INT1 3106 3107 3108File: gfortran.info, Node: Alternate complex function syntax, Next: Volatile COMMON blocks, Prev: Variable FORMAT expressions, Up: Extensions not implemented in GNU Fortran 3109 31106.2.4 Alternate complex function syntax 3111--------------------------------------- 3112 3113Some Fortran compilers, including 'g77', let the user declare complex 3114functions with the syntax 'COMPLEX FUNCTION name*16()', as well as 3115'COMPLEX*16 FUNCTION name()'. Both are non-standard, legacy extensions. 3116'gfortran' accepts the latter form, which is more common, but not the 3117former. 3118 3119 3120File: gfortran.info, Node: Volatile COMMON blocks, Prev: Alternate complex function syntax, Up: Extensions not implemented in GNU Fortran 3121 31226.2.5 Volatile 'COMMON' blocks 3123------------------------------ 3124 3125Some Fortran compilers, including 'g77', let the user declare 'COMMON' 3126with the 'VOLATILE' attribute. This is invalid standard Fortran syntax 3127and is not supported by 'gfortran'. Note that 'gfortran' accepts 3128'VOLATILE' variables in 'COMMON' blocks since revision 4.3. 3129 3130 3131File: gfortran.info, Node: Mixed-Language Programming, Next: Intrinsic Procedures, Prev: Extensions, Up: Top 3132 31337 Mixed-Language Programming 3134**************************** 3135 3136* Menu: 3137 3138* Interoperability with C:: 3139* GNU Fortran Compiler Directives:: 3140* Non-Fortran Main Program:: 3141* Naming and argument-passing conventions:: 3142 3143This chapter is about mixed-language interoperability, but also applies 3144if one links Fortran code compiled by different compilers. In most 3145cases, use of the C Binding features of the Fortran 2003 standard is 3146sufficient, and their use is highly recommended. 3147 3148 3149File: gfortran.info, Node: Interoperability with C, Next: GNU Fortran Compiler Directives, Up: Mixed-Language Programming 3150 31517.1 Interoperability with C 3152=========================== 3153 3154* Menu: 3155 3156* Intrinsic Types:: 3157* Derived Types and struct:: 3158* Interoperable Global Variables:: 3159* Interoperable Subroutines and Functions:: 3160* Working with Pointers:: 3161* Further Interoperability of Fortran with C:: 3162 3163Since Fortran 2003 (ISO/IEC 1539-1:2004(E)) there is a standardized way 3164to generate procedure and derived-type declarations and global variables 3165which are interoperable with C (ISO/IEC 9899:1999). The 'bind(C)' 3166attribute has been added to inform the compiler that a symbol shall be 3167interoperable with C; also, some constraints are added. Note, however, 3168that not all C features have a Fortran equivalent or vice versa. For 3169instance, neither C's unsigned integers nor C's functions with variable 3170number of arguments have an equivalent in Fortran. 3171 3172 Note that array dimensions are reversely ordered in C and that arrays 3173in C always start with index 0 while in Fortran they start by default 3174with 1. Thus, an array declaration 'A(n,m)' in Fortran matches 3175'A[m][n]' in C and accessing the element 'A(i,j)' matches 'A[j-1][i-1]'. 3176The element following 'A(i,j)' (C: 'A[j-1][i-1]'; assuming i < n) in 3177memory is 'A(i+1,j)' (C: 'A[j-1][i]'). 3178 3179 3180File: gfortran.info, Node: Intrinsic Types, Next: Derived Types and struct, Up: Interoperability with C 3181 31827.1.1 Intrinsic Types 3183--------------------- 3184 3185In order to ensure that exactly the same variable type and kind is used 3186in C and Fortran, the named constants shall be used which are defined in 3187the 'ISO_C_BINDING' intrinsic module. That module contains named 3188constants for kind parameters and character named constants for the 3189escape sequences in C. For a list of the constants, see *note 3190ISO_C_BINDING::. 3191 3192 For logical types, please note that the Fortran standard only 3193guarantees interoperability between C99's '_Bool' and Fortran's 3194'C_Bool'-kind logicals and C99 defines that 'true' has the value 1 and 3195'false' the value 0. Using any other integer value with GNU Fortran's 3196'LOGICAL' (with any kind parameter) gives an undefined result. (Passing 3197other integer values than 0 and 1 to GCC's '_Bool' is also undefined, 3198unless the integer is explicitly or implicitly casted to '_Bool'.) 3199 3200 3201File: gfortran.info, Node: Derived Types and struct, Next: Interoperable Global Variables, Prev: Intrinsic Types, Up: Interoperability with C 3202 32037.1.2 Derived Types and struct 3204------------------------------ 3205 3206For compatibility of derived types with 'struct', one needs to use the 3207'BIND(C)' attribute in the type declaration. For instance, the 3208following type declaration 3209 3210 USE ISO_C_BINDING 3211 TYPE, BIND(C) :: myType 3212 INTEGER(C_INT) :: i1, i2 3213 INTEGER(C_SIGNED_CHAR) :: i3 3214 REAL(C_DOUBLE) :: d1 3215 COMPLEX(C_FLOAT_COMPLEX) :: c1 3216 CHARACTER(KIND=C_CHAR) :: str(5) 3217 END TYPE 3218 3219 matches the following 'struct' declaration in C 3220 3221 struct { 3222 int i1, i2; 3223 /* Note: "char" might be signed or unsigned. */ 3224 signed char i3; 3225 double d1; 3226 float _Complex c1; 3227 char str[5]; 3228 } myType; 3229 3230 Derived types with the C binding attribute shall not have the 3231'sequence' attribute, type parameters, the 'extends' attribute, nor 3232type-bound procedures. Every component must be of interoperable type 3233and kind and may not have the 'pointer' or 'allocatable' attribute. The 3234names of the components are irrelevant for interoperability. 3235 3236 As there exist no direct Fortran equivalents, neither unions nor 3237structs with bit field or variable-length array members are 3238interoperable. 3239 3240 3241File: gfortran.info, Node: Interoperable Global Variables, Next: Interoperable Subroutines and Functions, Prev: Derived Types and struct, Up: Interoperability with C 3242 32437.1.3 Interoperable Global Variables 3244------------------------------------ 3245 3246Variables can be made accessible from C using the C binding attribute, 3247optionally together with specifying a binding name. Those variables 3248have to be declared in the declaration part of a 'MODULE', be of 3249interoperable type, and have neither the 'pointer' nor the 'allocatable' 3250attribute. 3251 3252 MODULE m 3253 USE myType_module 3254 USE ISO_C_BINDING 3255 integer(C_INT), bind(C, name="_MyProject_flags") :: global_flag 3256 type(myType), bind(C) :: tp 3257 END MODULE 3258 3259 Here, '_MyProject_flags' is the case-sensitive name of the variable 3260as seen from C programs while 'global_flag' is the case-insensitive name 3261as seen from Fortran. If no binding name is specified, as for TP, the C 3262binding name is the (lowercase) Fortran binding name. If a binding name 3263is specified, only a single variable may be after the double colon. 3264Note of warning: You cannot use a global variable to access ERRNO of the 3265C library as the C standard allows it to be a macro. Use the 'IERRNO' 3266intrinsic (GNU extension) instead. 3267 3268 3269File: gfortran.info, Node: Interoperable Subroutines and Functions, Next: Working with Pointers, Prev: Interoperable Global Variables, Up: Interoperability with C 3270 32717.1.4 Interoperable Subroutines and Functions 3272--------------------------------------------- 3273 3274Subroutines and functions have to have the 'BIND(C)' attribute to be 3275compatible with C. The dummy argument declaration is relatively 3276straightforward. However, one needs to be careful because C uses 3277call-by-value by default while Fortran behaves usually similar to 3278call-by-reference. Furthermore, strings and pointers are handled 3279differently. Note that in Fortran 2003 and 2008 only explicit size and 3280assumed-size arrays are supported but not assumed-shape or 3281deferred-shape (i.e. allocatable or pointer) arrays. However, those 3282are allowed since the Technical Specification 29113, see *note Further 3283Interoperability of Fortran with C:: 3284 3285 To pass a variable by value, use the 'VALUE' attribute. Thus, the 3286following C prototype 3287 3288 int func(int i, int *j) 3289 3290 matches the Fortran declaration 3291 3292 integer(c_int) function func(i,j) 3293 use iso_c_binding, only: c_int 3294 integer(c_int), VALUE :: i 3295 integer(c_int) :: j 3296 3297 Note that pointer arguments also frequently need the 'VALUE' 3298attribute, see *note Working with Pointers::. 3299 3300 Strings are handled quite differently in C and Fortran. In C a 3301string is a 'NUL'-terminated array of characters while in Fortran each 3302string has a length associated with it and is thus not terminated (by 3303e.g. 'NUL'). For example, if one wants to use the following C 3304function, 3305 3306 #include <stdio.h> 3307 void print_C(char *string) /* equivalent: char string[] */ 3308 { 3309 printf("%s\n", string); 3310 } 3311 3312 to print "Hello World" from Fortran, one can call it using 3313 3314 use iso_c_binding, only: C_CHAR, C_NULL_CHAR 3315 interface 3316 subroutine print_c(string) bind(C, name="print_C") 3317 use iso_c_binding, only: c_char 3318 character(kind=c_char) :: string(*) 3319 end subroutine print_c 3320 end interface 3321 call print_c(C_CHAR_"Hello World"//C_NULL_CHAR) 3322 3323 As the example shows, one needs to ensure that the string is 'NUL' 3324terminated. Additionally, the dummy argument STRING of 'print_C' is a 3325length-one assumed-size array; using 'character(len=*)' is not allowed. 3326The example above uses 'c_char_"Hello World"' to ensure the string 3327literal has the right type; typically the default character kind and 3328'c_char' are the same and thus '"Hello World"' is equivalent. However, 3329the standard does not guarantee this. 3330 3331 The use of strings is now further illustrated using the C library 3332function 'strncpy', whose prototype is 3333 3334 char *strncpy(char *restrict s1, const char *restrict s2, size_t n); 3335 3336 The function 'strncpy' copies at most N characters from string S2 to 3337S1 and returns S1. In the following example, we ignore the return 3338value: 3339 3340 use iso_c_binding 3341 implicit none 3342 character(len=30) :: str,str2 3343 interface 3344 ! Ignore the return value of strncpy -> subroutine 3345 ! "restrict" is always assumed if we do not pass a pointer 3346 subroutine strncpy(dest, src, n) bind(C) 3347 import 3348 character(kind=c_char), intent(out) :: dest(*) 3349 character(kind=c_char), intent(in) :: src(*) 3350 integer(c_size_t), value, intent(in) :: n 3351 end subroutine strncpy 3352 end interface 3353 str = repeat('X',30) ! Initialize whole string with 'X' 3354 call strncpy(str, c_char_"Hello World"//C_NULL_CHAR, & 3355 len(c_char_"Hello World",kind=c_size_t)) 3356 print '(a)', str ! prints: "Hello WorldXXXXXXXXXXXXXXXXXXX" 3357 end 3358 3359 The intrinsic procedures are described in *note Intrinsic 3360Procedures::. 3361 3362 3363File: gfortran.info, Node: Working with Pointers, Next: Further Interoperability of Fortran with C, Prev: Interoperable Subroutines and Functions, Up: Interoperability with C 3364 33657.1.5 Working with Pointers 3366--------------------------- 3367 3368C pointers are represented in Fortran via the special opaque derived 3369type 'type(c_ptr)' (with private components). Thus one needs to use 3370intrinsic conversion procedures to convert from or to C pointers. 3371 3372 For some applications, using an assumed type ('TYPE(*)') can be an 3373alternative to a C pointer; see *note Further Interoperability of 3374Fortran with C::. 3375 3376 For example, 3377 3378 use iso_c_binding 3379 type(c_ptr) :: cptr1, cptr2 3380 integer, target :: array(7), scalar 3381 integer, pointer :: pa(:), ps 3382 cptr1 = c_loc(array(1)) ! The programmer needs to ensure that the 3383 ! array is contiguous if required by the C 3384 ! procedure 3385 cptr2 = c_loc(scalar) 3386 call c_f_pointer(cptr2, ps) 3387 call c_f_pointer(cptr2, pa, shape=[7]) 3388 3389 When converting C to Fortran arrays, the one-dimensional 'SHAPE' 3390argument has to be passed. 3391 3392 If a pointer is a dummy-argument of an interoperable procedure, it 3393usually has to be declared using the 'VALUE' attribute. 'void*' matches 3394'TYPE(C_PTR), VALUE', while 'TYPE(C_PTR)' alone matches 'void**'. 3395 3396 Procedure pointers are handled analogously to pointers; the C type is 3397'TYPE(C_FUNPTR)' and the intrinsic conversion procedures are 3398'C_F_PROCPOINTER' and 'C_FUNLOC'. 3399 3400 Let us consider two examples of actually passing a procedure pointer 3401from C to Fortran and vice versa. Note that these examples are also 3402very similar to passing ordinary pointers between both languages. 3403First, consider this code in C: 3404 3405 /* Procedure implemented in Fortran. */ 3406 void get_values (void (*)(double)); 3407 3408 /* Call-back routine we want called from Fortran. */ 3409 void 3410 print_it (double x) 3411 { 3412 printf ("Number is %f.\n", x); 3413 } 3414 3415 /* Call Fortran routine and pass call-back to it. */ 3416 void 3417 foobar () 3418 { 3419 get_values (&print_it); 3420 } 3421 3422 A matching implementation for 'get_values' in Fortran, that correctly 3423receives the procedure pointer from C and is able to call it, is given 3424in the following 'MODULE': 3425 3426 MODULE m 3427 IMPLICIT NONE 3428 3429 ! Define interface of call-back routine. 3430 ABSTRACT INTERFACE 3431 SUBROUTINE callback (x) 3432 USE, INTRINSIC :: ISO_C_BINDING 3433 REAL(KIND=C_DOUBLE), INTENT(IN), VALUE :: x 3434 END SUBROUTINE callback 3435 END INTERFACE 3436 3437 CONTAINS 3438 3439 ! Define C-bound procedure. 3440 SUBROUTINE get_values (cproc) BIND(C) 3441 USE, INTRINSIC :: ISO_C_BINDING 3442 TYPE(C_FUNPTR), INTENT(IN), VALUE :: cproc 3443 3444 PROCEDURE(callback), POINTER :: proc 3445 3446 ! Convert C to Fortran procedure pointer. 3447 CALL C_F_PROCPOINTER (cproc, proc) 3448 3449 ! Call it. 3450 CALL proc (1.0_C_DOUBLE) 3451 CALL proc (-42.0_C_DOUBLE) 3452 CALL proc (18.12_C_DOUBLE) 3453 END SUBROUTINE get_values 3454 3455 END MODULE m 3456 3457 Next, we want to call a C routine that expects a procedure pointer 3458argument and pass it a Fortran procedure (which clearly must be 3459interoperable!). Again, the C function may be: 3460 3461 int 3462 call_it (int (*func)(int), int arg) 3463 { 3464 return func (arg); 3465 } 3466 3467 It can be used as in the following Fortran code: 3468 3469 MODULE m 3470 USE, INTRINSIC :: ISO_C_BINDING 3471 IMPLICIT NONE 3472 3473 ! Define interface of C function. 3474 INTERFACE 3475 INTEGER(KIND=C_INT) FUNCTION call_it (func, arg) BIND(C) 3476 USE, INTRINSIC :: ISO_C_BINDING 3477 TYPE(C_FUNPTR), INTENT(IN), VALUE :: func 3478 INTEGER(KIND=C_INT), INTENT(IN), VALUE :: arg 3479 END FUNCTION call_it 3480 END INTERFACE 3481 3482 CONTAINS 3483 3484 ! Define procedure passed to C function. 3485 ! It must be interoperable! 3486 INTEGER(KIND=C_INT) FUNCTION double_it (arg) BIND(C) 3487 INTEGER(KIND=C_INT), INTENT(IN), VALUE :: arg 3488 double_it = arg + arg 3489 END FUNCTION double_it 3490 3491 ! Call C function. 3492 SUBROUTINE foobar () 3493 TYPE(C_FUNPTR) :: cproc 3494 INTEGER(KIND=C_INT) :: i 3495 3496 ! Get C procedure pointer. 3497 cproc = C_FUNLOC (double_it) 3498 3499 ! Use it. 3500 DO i = 1_C_INT, 10_C_INT 3501 PRINT *, call_it (cproc, i) 3502 END DO 3503 END SUBROUTINE foobar 3504 3505 END MODULE m 3506 3507 3508File: gfortran.info, Node: Further Interoperability of Fortran with C, Prev: Working with Pointers, Up: Interoperability with C 3509 35107.1.6 Further Interoperability of Fortran with C 3511------------------------------------------------ 3512 3513The Technical Specification ISO/IEC TS 29113:2012 on further 3514interoperability of Fortran with C extends the interoperability support 3515of Fortran 2003 and Fortran 2008. Besides removing some restrictions 3516and constraints, it adds assumed-type ('TYPE(*)') and assumed-rank 3517('dimension') variables and allows for interoperability of 3518assumed-shape, assumed-rank and deferred-shape arrays, including 3519allocatables and pointers. 3520 3521 Note: Currently, GNU Fortran does not support the array descriptor 3522(dope vector) as specified in the Technical Specification, but uses an 3523array descriptor with different fields. The Chasm Language 3524Interoperability Tools, <http://chasm-interop.sourceforge.net/>, provide 3525an interface to GNU Fortran's array descriptor. 3526 3527 The Technical Specification adds the following new features, which 3528are supported by GNU Fortran: 3529 3530 * The 'ASYNCHRONOUS' attribute has been clarified and extended to 3531 allow its use with asynchronous communication in user-provided 3532 libraries such as in implementations of the Message Passing 3533 Interface specification. 3534 3535 * Many constraints have been relaxed, in particular for the 'C_LOC' 3536 and 'C_F_POINTER' intrinsics. 3537 3538 * The 'OPTIONAL' attribute is now allowed for dummy arguments; an 3539 absent argument matches a 'NULL' pointer. 3540 3541 * Assumed types ('TYPE(*)') have been added, which may only be used 3542 for dummy arguments. They are unlimited polymorphic but contrary 3543 to 'CLASS(*)' they do not contain any type information, similar to 3544 C's 'void *' pointers. Expressions of any type and kind can be 3545 passed; thus, it can be used as replacement for 'TYPE(C_PTR)', 3546 avoiding the use of 'C_LOC' in the caller. 3547 3548 Note, however, that 'TYPE(*)' only accepts scalar arguments, unless 3549 the 'DIMENSION' is explicitly specified. As 'DIMENSION(*)' only 3550 supports array (including array elements) but no scalars, it is not 3551 a full replacement for 'C_LOC'. On the other hand, assumed-type 3552 assumed-rank dummy arguments ('TYPE(*), DIMENSION(..)') allow for 3553 both scalars and arrays, but require special code on the callee 3554 side to handle the array descriptor. 3555 3556 * Assumed-rank arrays ('DIMENSION(..)') as dummy argument allow that 3557 scalars and arrays of any rank can be passed as actual argument. 3558 As the Technical Specification does not provide for direct means to 3559 operate with them, they have to be used either from the C side or 3560 be converted using 'C_LOC' and 'C_F_POINTER' to scalars or arrays 3561 of a specific rank. The rank can be determined using the 'RANK' 3562 intrinisic. 3563 3564 Currently unimplemented: 3565 3566 * GNU Fortran always uses an array descriptor, which does not match 3567 the one of the Technical Specification. The 3568 'ISO_Fortran_binding.h' header file and the C functions it 3569 specifies are not available. 3570 3571 * Using assumed-shape, assumed-rank and deferred-shape arrays in 3572 'BIND(C)' procedures is not fully supported. In particular, C 3573 interoperable strings of other length than one are not supported as 3574 this requires the new array descriptor. 3575 3576 3577File: gfortran.info, Node: GNU Fortran Compiler Directives, Next: Non-Fortran Main Program, Prev: Interoperability with C, Up: Mixed-Language Programming 3578 35797.2 GNU Fortran Compiler Directives 3580=================================== 3581 3582The Fortran standard describes how a conforming program shall behave; 3583however, the exact implementation is not standardized. In order to 3584allow the user to choose specific implementation details, compiler 3585directives can be used to set attributes of variables and procedures 3586which are not part of the standard. Whether a given attribute is 3587supported and its exact effects depend on both the operating system and 3588on the processor; see *note C Extensions: (gcc)Top. for details. 3589 3590 For procedures and procedure pointers, the following attributes can 3591be used to change the calling convention: 3592 3593 * 'CDECL' - standard C calling convention 3594 * 'STDCALL' - convention where the called procedure pops the stack 3595 * 'FASTCALL' - part of the arguments are passed via registers instead 3596 using the stack 3597 3598 Besides changing the calling convention, the attributes also 3599influence the decoration of the symbol name, e.g., by a leading 3600underscore or by a trailing at-sign followed by the number of bytes on 3601the stack. When assigning a procedure to a procedure pointer, both 3602should use the same calling convention. 3603 3604 On some systems, procedures and global variables (module variables 3605and 'COMMON' blocks) need special handling to be accessible when they 3606are in a shared library. The following attributes are available: 3607 3608 * 'DLLEXPORT' - provide a global pointer to a pointer in the DLL 3609 * 'DLLIMPORT' - reference the function or variable using a global 3610 pointer 3611 3612 For dummy arguments, the 'NO_ARG_CHECK' attribute can be used; in 3613other compilers, it is also known as 'IGNORE_TKR'. For dummy arguments 3614with this attribute actual arguments of any type and kind (similar to 3615'TYPE(*)'), scalars and arrays of any rank (no equivalent in Fortran 3616standard) are accepted. As with 'TYPE(*)', the argument is unlimited 3617polymorphic and no type information is available. Additionally, the 3618argument may only be passed to dummy arguments with the 'NO_ARG_CHECK' 3619attribute and as argument to the 'PRESENT' intrinsic function and to 3620'C_LOC' of the 'ISO_C_BINDING' module. 3621 3622 Variables with 'NO_ARG_CHECK' attribute shall be of assumed-type 3623('TYPE(*)'; recommended) or of type 'INTEGER', 'LOGICAL', 'REAL' or 3624'COMPLEX'. They shall not have the 'ALLOCATE', 'CODIMENSION', 3625'INTENT(OUT)', 'POINTER' or 'VALUE' attribute; furthermore, they shall 3626be either scalar or of assumed-size ('dimension(*)'). As 'TYPE(*)', the 3627'NO_ARG_CHECK' attribute requires an explicit interface. 3628 3629 * 'NO_ARG_CHECK' - disable the type, kind and rank checking 3630 3631 The attributes are specified using the syntax 3632 3633 '!GCC$ ATTRIBUTES' ATTRIBUTE-LIST '::' VARIABLE-LIST 3634 3635 where in free-form source code only whitespace is allowed before 3636'!GCC$' and in fixed-form source code '!GCC$', 'cGCC$' or '*GCC$' shall 3637start in the first column. 3638 3639 For procedures, the compiler directives shall be placed into the body 3640of the procedure; for variables and procedure pointers, they shall be in 3641the same declaration part as the variable or procedure pointer. 3642 3643 3644File: gfortran.info, Node: Non-Fortran Main Program, Next: Naming and argument-passing conventions, Prev: GNU Fortran Compiler Directives, Up: Mixed-Language Programming 3645 36467.3 Non-Fortran Main Program 3647============================ 3648 3649* Menu: 3650 3651* _gfortran_set_args:: Save command-line arguments 3652* _gfortran_set_options:: Set library option flags 3653* _gfortran_set_convert:: Set endian conversion 3654* _gfortran_set_record_marker:: Set length of record markers 3655* _gfortran_set_fpe:: Set when a Floating Point Exception should be raised 3656* _gfortran_set_max_subrecord_length:: Set subrecord length 3657 3658Even if you are doing mixed-language programming, it is very likely that 3659you do not need to know or use the information in this section. Since 3660it is about the internal structure of GNU Fortran, it may also change in 3661GCC minor releases. 3662 3663 When you compile a 'PROGRAM' with GNU Fortran, a function with the 3664name 'main' (in the symbol table of the object file) is generated, which 3665initializes the libgfortran library and then calls the actual program 3666which uses the name 'MAIN__', for historic reasons. If you link GNU 3667Fortran compiled procedures to, e.g., a C or C++ program or to a Fortran 3668program compiled by a different compiler, the libgfortran library is not 3669initialized and thus a few intrinsic procedures do not work properly, 3670e.g. those for obtaining the command-line arguments. 3671 3672 Therefore, if your 'PROGRAM' is not compiled with GNU Fortran and the 3673GNU Fortran compiled procedures require intrinsics relying on the 3674library initialization, you need to initialize the library yourself. 3675Using the default options, gfortran calls '_gfortran_set_args' and 3676'_gfortran_set_options'. The initialization of the former is needed if 3677the called procedures access the command line (and for backtracing); the 3678latter sets some flags based on the standard chosen or to enable 3679backtracing. In typical programs, it is not necessary to call any 3680initialization function. 3681 3682 If your 'PROGRAM' is compiled with GNU Fortran, you shall not call 3683any of the following functions. The libgfortran initialization 3684functions are shown in C syntax but using C bindings they are also 3685accessible from Fortran. 3686 3687 3688File: gfortran.info, Node: _gfortran_set_args, Next: _gfortran_set_options, Up: Non-Fortran Main Program 3689 36907.3.1 '_gfortran_set_args' -- Save command-line arguments 3691--------------------------------------------------------- 3692 3693_Description_: 3694 '_gfortran_set_args' saves the command-line arguments; this 3695 initialization is required if any of the command-line intrinsics is 3696 called. Additionally, it shall be called if backtracing is enabled 3697 (see '_gfortran_set_options'). 3698 3699_Syntax_: 3700 'void _gfortran_set_args (int argc, char *argv[])' 3701 3702_Arguments_: 3703 ARGC number of command line argument strings 3704 ARGV the command-line argument strings; argv[0] is 3705 the pathname of the executable itself. 3706 3707_Example_: 3708 int main (int argc, char *argv[]) 3709 { 3710 /* Initialize libgfortran. */ 3711 _gfortran_set_args (argc, argv); 3712 return 0; 3713 } 3714 3715 3716File: gfortran.info, Node: _gfortran_set_options, Next: _gfortran_set_convert, Prev: _gfortran_set_args, Up: Non-Fortran Main Program 3717 37187.3.2 '_gfortran_set_options' -- Set library option flags 3719--------------------------------------------------------- 3720 3721_Description_: 3722 '_gfortran_set_options' sets several flags related to the Fortran 3723 standard to be used, whether backtracing should be enabled and 3724 whether range checks should be performed. The syntax allows for 3725 upward compatibility since the number of passed flags is specified; 3726 for non-passed flags, the default value is used. See also *note 3727 Code Gen Options::. Please note that not all flags are actually 3728 used. 3729 3730_Syntax_: 3731 'void _gfortran_set_options (int num, int options[])' 3732 3733_Arguments_: 3734 NUM number of options passed 3735 ARGV The list of flag values 3736 3737_option flag list_: 3738 OPTION[0] Allowed standard; can give run-time errors if 3739 e.g. an input-output edit descriptor is invalid 3740 in a given standard. Possible values are 3741 (bitwise or-ed) 'GFC_STD_F77' (1), 3742 'GFC_STD_F95_OBS' (2), 'GFC_STD_F95_DEL' (4), 3743 'GFC_STD_F95' (8), 'GFC_STD_F2003' (16), 3744 'GFC_STD_GNU' (32), 'GFC_STD_LEGACY' (64), 3745 'GFC_STD_F2008' (128), 'GFC_STD_F2008_OBS' (256) 3746 and GFC_STD_F2008_TS (512). Default: 3747 'GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F95 3748 | GFC_STD_F2003 | GFC_STD_F2008 | 3749 GFC_STD_F2008_TS | GFC_STD_F2008_OBS | 3750 GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY'. 3751 OPTION[1] Standard-warning flag; prints a warning to 3752 standard error. Default: 'GFC_STD_F95_DEL | 3753 GFC_STD_LEGACY'. 3754 OPTION[2] If non zero, enable pedantic checking. Default: 3755 off. 3756 OPTION[3] Unused. 3757 OPTION[4] If non zero, enable backtracing on run-time 3758 errors. Default: off. (Default in the 3759 compiler: on.) Note: Installs a signal handler 3760 and requires command-line initialization using 3761 '_gfortran_set_args'. 3762 OPTION[5] If non zero, supports signed zeros. Default: 3763 enabled. 3764 OPTION[6] Enables run-time checking. Possible values are 3765 (bitwise or-ed): GFC_RTCHECK_BOUNDS (1), 3766 GFC_RTCHECK_ARRAY_TEMPS (2), 3767 GFC_RTCHECK_RECURSION (4), GFC_RTCHECK_DO (16), 3768 GFC_RTCHECK_POINTER (32). Default: disabled. 3769 OPTION[7] Unused. 3770 OPTION[8] Show a warning when invoking 'STOP' and 'ERROR 3771 STOP' if a floating-point exception occurred. 3772 Possible values are (bitwise or-ed) 3773 'GFC_FPE_INVALID' (1), 'GFC_FPE_DENORMAL' (2), 3774 'GFC_FPE_ZERO' (4), 'GFC_FPE_OVERFLOW' (8), 3775 'GFC_FPE_UNDERFLOW' (16), 'GFC_FPE_INEXACT' 3776 (32). Default: None (0). (Default in the 3777 compiler: 'GFC_FPE_INVALID | GFC_FPE_DENORMAL | 3778 GFC_FPE_ZERO | GFC_FPE_OVERFLOW | 3779 GFC_FPE_UNDERFLOW'.) 3780 3781_Example_: 3782 /* Use gfortran 4.9 default options. */ 3783 static int options[] = {68, 511, 0, 0, 1, 1, 0, 0, 31}; 3784 _gfortran_set_options (9, &options); 3785 3786 3787File: gfortran.info, Node: _gfortran_set_convert, Next: _gfortran_set_record_marker, Prev: _gfortran_set_options, Up: Non-Fortran Main Program 3788 37897.3.3 '_gfortran_set_convert' -- Set endian conversion 3790------------------------------------------------------ 3791 3792_Description_: 3793 '_gfortran_set_convert' set the representation of data for 3794 unformatted files. 3795 3796_Syntax_: 3797 'void _gfortran_set_convert (int conv)' 3798 3799_Arguments_: 3800 CONV Endian conversion, possible values: 3801 GFC_CONVERT_NATIVE (0, default), 3802 GFC_CONVERT_SWAP (1), GFC_CONVERT_BIG (2), 3803 GFC_CONVERT_LITTLE (3). 3804 3805_Example_: 3806 int main (int argc, char *argv[]) 3807 { 3808 /* Initialize libgfortran. */ 3809 _gfortran_set_args (argc, argv); 3810 _gfortran_set_convert (1); 3811 return 0; 3812 } 3813 3814 3815File: gfortran.info, Node: _gfortran_set_record_marker, Next: _gfortran_set_fpe, Prev: _gfortran_set_convert, Up: Non-Fortran Main Program 3816 38177.3.4 '_gfortran_set_record_marker' -- Set length of record markers 3818------------------------------------------------------------------- 3819 3820_Description_: 3821 '_gfortran_set_record_marker' sets the length of record markers for 3822 unformatted files. 3823 3824_Syntax_: 3825 'void _gfortran_set_record_marker (int val)' 3826 3827_Arguments_: 3828 VAL Length of the record marker; valid values are 4 3829 and 8. Default is 4. 3830 3831_Example_: 3832 int main (int argc, char *argv[]) 3833 { 3834 /* Initialize libgfortran. */ 3835 _gfortran_set_args (argc, argv); 3836 _gfortran_set_record_marker (8); 3837 return 0; 3838 } 3839 3840 3841File: gfortran.info, Node: _gfortran_set_fpe, Next: _gfortran_set_max_subrecord_length, Prev: _gfortran_set_record_marker, Up: Non-Fortran Main Program 3842 38437.3.5 '_gfortran_set_fpe' -- Enable floating point exception traps 3844------------------------------------------------------------------ 3845 3846_Description_: 3847 '_gfortran_set_fpe' enables floating point exception traps for the 3848 specified exceptions. On most systems, this will result in a 3849 SIGFPE signal being sent and the program being aborted. 3850 3851_Syntax_: 3852 'void _gfortran_set_fpe (int val)' 3853 3854_Arguments_: 3855 OPTION[0] IEEE exceptions. Possible values are (bitwise 3856 or-ed) zero (0, default) no trapping, 3857 'GFC_FPE_INVALID' (1), 'GFC_FPE_DENORMAL' (2), 3858 'GFC_FPE_ZERO' (4), 'GFC_FPE_OVERFLOW' (8), 3859 'GFC_FPE_UNDERFLOW' (16), and 'GFC_FPE_INEXACT' 3860 (32). 3861 3862_Example_: 3863 int main (int argc, char *argv[]) 3864 { 3865 /* Initialize libgfortran. */ 3866 _gfortran_set_args (argc, argv); 3867 /* FPE for invalid operations such as SQRT(-1.0). */ 3868 _gfortran_set_fpe (1); 3869 return 0; 3870 } 3871 3872 3873File: gfortran.info, Node: _gfortran_set_max_subrecord_length, Prev: _gfortran_set_fpe, Up: Non-Fortran Main Program 3874 38757.3.6 '_gfortran_set_max_subrecord_length' -- Set subrecord length 3876------------------------------------------------------------------ 3877 3878_Description_: 3879 '_gfortran_set_max_subrecord_length' set the maximum length for a 3880 subrecord. This option only makes sense for testing and debugging 3881 of unformatted I/O. 3882 3883_Syntax_: 3884 'void _gfortran_set_max_subrecord_length (int val)' 3885 3886_Arguments_: 3887 VAL the maximum length for a subrecord; the maximum 3888 permitted value is 2147483639, which is also the 3889 default. 3890 3891_Example_: 3892 int main (int argc, char *argv[]) 3893 { 3894 /* Initialize libgfortran. */ 3895 _gfortran_set_args (argc, argv); 3896 _gfortran_set_max_subrecord_length (8); 3897 return 0; 3898 } 3899 3900 3901File: gfortran.info, Node: Naming and argument-passing conventions, Prev: Non-Fortran Main Program, Up: Mixed-Language Programming 3902 39037.4 Naming and argument-passing conventions 3904=========================================== 3905 3906This section gives an overview about the naming convention of procedures 3907and global variables and about the argument passing conventions used by 3908GNU Fortran. If a C binding has been specified, the naming convention 3909and some of the argument-passing conventions change. If possible, 3910mixed-language and mixed-compiler projects should use the better defined 3911C binding for interoperability. See *note Interoperability with C::. 3912 3913* Menu: 3914 3915* Naming conventions:: 3916* Argument passing conventions:: 3917 3918 3919File: gfortran.info, Node: Naming conventions, Next: Argument passing conventions, Up: Naming and argument-passing conventions 3920 39217.4.1 Naming conventions 3922------------------------ 3923 3924According the Fortran standard, valid Fortran names consist of a letter 3925between 'A' to 'Z', 'a' to 'z', digits '0', '1' to '9' and underscores 3926('_') with the restriction that names may only start with a letter. As 3927vendor extension, the dollar sign ('$') is additionally permitted with 3928the option '-fdollar-ok', but not as first character and only if the 3929target system supports it. 3930 3931 By default, the procedure name is the lower-cased Fortran name with 3932an appended underscore ('_'); using '-fno-underscoring' no underscore is 3933appended while '-fsecond-underscore' appends two underscores. Depending 3934on the target system and the calling convention, the procedure might be 3935additionally dressed; for instance, on 32bit Windows with 'stdcall', an 3936at-sign '@' followed by an integer number is appended. For the changing 3937the calling convention, see *note GNU Fortran Compiler Directives::. 3938 3939 For common blocks, the same convention is used, i.e. by default an 3940underscore is appended to the lower-cased Fortran name. Blank commons 3941have the name '__BLNK__'. 3942 3943 For procedures and variables declared in the specification space of a 3944module, the name is formed by '__', followed by the lower-cased module 3945name, '_MOD_', and the lower-cased Fortran name. Note that no 3946underscore is appended. 3947 3948 3949File: gfortran.info, Node: Argument passing conventions, Prev: Naming conventions, Up: Naming and argument-passing conventions 3950 39517.4.2 Argument passing conventions 3952---------------------------------- 3953 3954Subroutines do not return a value (matching C99's 'void') while 3955functions either return a value as specified in the platform ABI or the 3956result variable is passed as hidden argument to the function and no 3957result is returned. A hidden result variable is used when the result 3958variable is an array or of type 'CHARACTER'. 3959 3960 Arguments are passed according to the platform ABI. In particular, 3961complex arguments might not be compatible to a struct with two real 3962components for the real and imaginary part. The argument passing 3963matches the one of C99's '_Complex'. Functions with scalar complex 3964result variables return their value and do not use a by-reference 3965argument. Note that with the '-ff2c' option, the argument passing is 3966modified and no longer completely matches the platform ABI. Some other 3967Fortran compilers use 'f2c' semantic by default; this might cause 3968problems with interoperablility. 3969 3970 GNU Fortran passes most arguments by reference, i.e. by passing a 3971pointer to the data. Note that the compiler might use a temporary 3972variable into which the actual argument has been copied, if required 3973semantically (copy-in/copy-out). 3974 3975 For arguments with 'ALLOCATABLE' and 'POINTER' attribute (including 3976procedure pointers), a pointer to the pointer is passed such that the 3977pointer address can be modified in the procedure. 3978 3979 For dummy arguments with the 'VALUE' attribute: Scalar arguments of 3980the type 'INTEGER', 'LOGICAL', 'REAL' and 'COMPLEX' are passed by value 3981according to the platform ABI. (As vendor extension and not recommended, 3982using '%VAL()' in the call to a procedure has the same effect.) For 3983'TYPE(C_PTR)' and procedure pointers, the pointer itself is passed such 3984that it can be modified without affecting the caller. 3985 3986 For Boolean ('LOGICAL') arguments, please note that GCC expects only 3987the integer value 0 and 1. If a GNU Fortran 'LOGICAL' variable contains 3988another integer value, the result is undefined. As some other Fortran 3989compilers use -1 for '.TRUE.', extra care has to be taken - such as 3990passing the value as 'INTEGER'. (The same value restriction also 3991applies to other front ends of GCC, e.g. to GCC's C99 compiler for 3992'_Bool' or GCC's Ada compiler for 'Boolean'.) 3993 3994 For arguments of 'CHARACTER' type, the character length is passed as 3995hidden argument. For deferred-length strings, the value is passed by 3996reference, otherwise by value. The character length has the type 3997'INTEGER(kind=4)'. Note with C binding, 'CHARACTER(len=1)' result 3998variables are returned according to the platform ABI and no hidden 3999length argument is used for dummy arguments; with 'VALUE', those 4000variables are passed by value. 4001 4002 For 'OPTIONAL' dummy arguments, an absent argument is denoted by a 4003NULL pointer, except for scalar dummy arguments of type 'INTEGER', 4004'LOGICAL', 'REAL' and 'COMPLEX' which have the 'VALUE' attribute. For 4005those, a hidden Boolean argument ('logical(kind=C_bool),value') is used 4006to indicate whether the argument is present. 4007 4008 Arguments which are assumed-shape, assumed-rank or deferred-rank 4009arrays or, with '-fcoarray=lib', allocatable scalar coarrays use an 4010array descriptor. All other arrays pass the address of the first 4011element of the array. With '-fcoarray=lib', the token and the offset 4012belonging to nonallocatable coarrays dummy arguments are passed as 4013hidden argument along the character length hidden arguments. The token 4014is an oparque pointer identifying the coarray and the offset is a 4015passed-by-value integer of kind 'C_PTRDIFF_T', denoting the byte offset 4016between the base address of the coarray and the passed scalar or first 4017element of the passed array. 4018 4019 The arguments are passed in the following order 4020 * Result variable, when the function result is passed by reference 4021 * Character length of the function result, if it is a of type 4022 'CHARACTER' and no C binding is used 4023 * The arguments in the order in which they appear in the Fortran 4024 declaration 4025 * The the present status for optional arguments with value attribute, 4026 which are internally passed by value 4027 * The character length and/or coarray token and offset for the first 4028 argument which is a 'CHARACTER' or a nonallocatable coarray dummy 4029 argument, followed by the hidden arguments of the next dummy 4030 argument of such a type 4031 4032 4033File: gfortran.info, Node: Intrinsic Procedures, Next: Intrinsic Modules, Prev: Mixed-Language Programming, Up: Top 4034 40358 Intrinsic Procedures 4036********************** 4037 4038* Menu: 4039 4040* Introduction: Introduction to Intrinsics 4041* 'ABORT': ABORT, Abort the program 4042* 'ABS': ABS, Absolute value 4043* 'ACCESS': ACCESS, Checks file access modes 4044* 'ACHAR': ACHAR, Character in ASCII collating sequence 4045* 'ACOS': ACOS, Arccosine function 4046* 'ACOSH': ACOSH, Inverse hyperbolic cosine function 4047* 'ADJUSTL': ADJUSTL, Left adjust a string 4048* 'ADJUSTR': ADJUSTR, Right adjust a string 4049* 'AIMAG': AIMAG, Imaginary part of complex number 4050* 'AINT': AINT, Truncate to a whole number 4051* 'ALARM': ALARM, Set an alarm clock 4052* 'ALL': ALL, Determine if all values are true 4053* 'ALLOCATED': ALLOCATED, Status of allocatable entity 4054* 'AND': AND, Bitwise logical AND 4055* 'ANINT': ANINT, Nearest whole number 4056* 'ANY': ANY, Determine if any values are true 4057* 'ASIN': ASIN, Arcsine function 4058* 'ASINH': ASINH, Inverse hyperbolic sine function 4059* 'ASSOCIATED': ASSOCIATED, Status of a pointer or pointer/target pair 4060* 'ATAN': ATAN, Arctangent function 4061* 'ATAN2': ATAN2, Arctangent function 4062* 'ATANH': ATANH, Inverse hyperbolic tangent function 4063* 'ATOMIC_DEFINE': ATOMIC_DEFINE, Setting a variable atomically 4064* 'ATOMIC_REF': ATOMIC_REF, Obtaining the value of a variable atomically 4065* 'BACKTRACE': BACKTRACE, Show a backtrace 4066* 'BESSEL_J0': BESSEL_J0, Bessel function of the first kind of order 0 4067* 'BESSEL_J1': BESSEL_J1, Bessel function of the first kind of order 1 4068* 'BESSEL_JN': BESSEL_JN, Bessel function of the first kind 4069* 'BESSEL_Y0': BESSEL_Y0, Bessel function of the second kind of order 0 4070* 'BESSEL_Y1': BESSEL_Y1, Bessel function of the second kind of order 1 4071* 'BESSEL_YN': BESSEL_YN, Bessel function of the second kind 4072* 'BGE': BGE, Bitwise greater than or equal to 4073* 'BGT': BGT, Bitwise greater than 4074* 'BIT_SIZE': BIT_SIZE, Bit size inquiry function 4075* 'BLE': BLE, Bitwise less than or equal to 4076* 'BLT': BLT, Bitwise less than 4077* 'BTEST': BTEST, Bit test function 4078* 'C_ASSOCIATED': C_ASSOCIATED, Status of a C pointer 4079* 'C_F_POINTER': C_F_POINTER, Convert C into Fortran pointer 4080* 'C_F_PROCPOINTER': C_F_PROCPOINTER, Convert C into Fortran procedure pointer 4081* 'C_FUNLOC': C_FUNLOC, Obtain the C address of a procedure 4082* 'C_LOC': C_LOC, Obtain the C address of an object 4083* 'C_SIZEOF': C_SIZEOF, Size in bytes of an expression 4084* 'CEILING': CEILING, Integer ceiling function 4085* 'CHAR': CHAR, Integer-to-character conversion function 4086* 'CHDIR': CHDIR, Change working directory 4087* 'CHMOD': CHMOD, Change access permissions of files 4088* 'CMPLX': CMPLX, Complex conversion function 4089* 'COMMAND_ARGUMENT_COUNT': COMMAND_ARGUMENT_COUNT, Get number of command line arguments 4090* 'COMPILER_OPTIONS': COMPILER_OPTIONS, Options passed to the compiler 4091* 'COMPILER_VERSION': COMPILER_VERSION, Compiler version string 4092* 'COMPLEX': COMPLEX, Complex conversion function 4093* 'CONJG': CONJG, Complex conjugate function 4094* 'COS': COS, Cosine function 4095* 'COSH': COSH, Hyperbolic cosine function 4096* 'COUNT': COUNT, Count occurrences of TRUE in an array 4097* 'CPU_TIME': CPU_TIME, CPU time subroutine 4098* 'CSHIFT': CSHIFT, Circular shift elements of an array 4099* 'CTIME': CTIME, Subroutine (or function) to convert a time into a string 4100* 'DATE_AND_TIME': DATE_AND_TIME, Date and time subroutine 4101* 'DBLE': DBLE, Double precision conversion function 4102* 'DCMPLX': DCMPLX, Double complex conversion function 4103* 'DIGITS': DIGITS, Significant digits function 4104* 'DIM': DIM, Positive difference 4105* 'DOT_PRODUCT': DOT_PRODUCT, Dot product function 4106* 'DPROD': DPROD, Double product function 4107* 'DREAL': DREAL, Double real part function 4108* 'DSHIFTL': DSHIFTL, Combined left shift 4109* 'DSHIFTR': DSHIFTR, Combined right shift 4110* 'DTIME': DTIME, Execution time subroutine (or function) 4111* 'EOSHIFT': EOSHIFT, End-off shift elements of an array 4112* 'EPSILON': EPSILON, Epsilon function 4113* 'ERF': ERF, Error function 4114* 'ERFC': ERFC, Complementary error function 4115* 'ERFC_SCALED': ERFC_SCALED, Exponentially-scaled complementary error function 4116* 'ETIME': ETIME, Execution time subroutine (or function) 4117* 'EXECUTE_COMMAND_LINE': EXECUTE_COMMAND_LINE, Execute a shell command 4118* 'EXIT': EXIT, Exit the program with status. 4119* 'EXP': EXP, Exponential function 4120* 'EXPONENT': EXPONENT, Exponent function 4121* 'EXTENDS_TYPE_OF': EXTENDS_TYPE_OF, Query dynamic type for extension 4122* 'FDATE': FDATE, Subroutine (or function) to get the current time as a string 4123* 'FGET': FGET, Read a single character in stream mode from stdin 4124* 'FGETC': FGETC, Read a single character in stream mode 4125* 'FLOOR': FLOOR, Integer floor function 4126* 'FLUSH': FLUSH, Flush I/O unit(s) 4127* 'FNUM': FNUM, File number function 4128* 'FPUT': FPUT, Write a single character in stream mode to stdout 4129* 'FPUTC': FPUTC, Write a single character in stream mode 4130* 'FRACTION': FRACTION, Fractional part of the model representation 4131* 'FREE': FREE, Memory de-allocation subroutine 4132* 'FSEEK': FSEEK, Low level file positioning subroutine 4133* 'FSTAT': FSTAT, Get file status 4134* 'FTELL': FTELL, Current stream position 4135* 'GAMMA': GAMMA, Gamma function 4136* 'GERROR': GERROR, Get last system error message 4137* 'GETARG': GETARG, Get command line arguments 4138* 'GET_COMMAND': GET_COMMAND, Get the entire command line 4139* 'GET_COMMAND_ARGUMENT': GET_COMMAND_ARGUMENT, Get command line arguments 4140* 'GETCWD': GETCWD, Get current working directory 4141* 'GETENV': GETENV, Get an environmental variable 4142* 'GET_ENVIRONMENT_VARIABLE': GET_ENVIRONMENT_VARIABLE, Get an environmental variable 4143* 'GETGID': GETGID, Group ID function 4144* 'GETLOG': GETLOG, Get login name 4145* 'GETPID': GETPID, Process ID function 4146* 'GETUID': GETUID, User ID function 4147* 'GMTIME': GMTIME, Convert time to GMT info 4148* 'HOSTNM': HOSTNM, Get system host name 4149* 'HUGE': HUGE, Largest number of a kind 4150* 'HYPOT': HYPOT, Euclidean distance function 4151* 'IACHAR': IACHAR, Code in ASCII collating sequence 4152* 'IALL': IALL, Bitwise AND of array elements 4153* 'IAND': IAND, Bitwise logical and 4154* 'IANY': IANY, Bitwise OR of array elements 4155* 'IARGC': IARGC, Get the number of command line arguments 4156* 'IBCLR': IBCLR, Clear bit 4157* 'IBITS': IBITS, Bit extraction 4158* 'IBSET': IBSET, Set bit 4159* 'ICHAR': ICHAR, Character-to-integer conversion function 4160* 'IDATE': IDATE, Current local time (day/month/year) 4161* 'IEOR': IEOR, Bitwise logical exclusive or 4162* 'IERRNO': IERRNO, Function to get the last system error number 4163* 'IMAGE_INDEX': IMAGE_INDEX, Cosubscript to image index conversion 4164* 'INDEX': INDEX intrinsic, Position of a substring within a string 4165* 'INT': INT, Convert to integer type 4166* 'INT2': INT2, Convert to 16-bit integer type 4167* 'INT8': INT8, Convert to 64-bit integer type 4168* 'IOR': IOR, Bitwise logical or 4169* 'IPARITY': IPARITY, Bitwise XOR of array elements 4170* 'IRAND': IRAND, Integer pseudo-random number 4171* 'IS_IOSTAT_END': IS_IOSTAT_END, Test for end-of-file value 4172* 'IS_IOSTAT_EOR': IS_IOSTAT_EOR, Test for end-of-record value 4173* 'ISATTY': ISATTY, Whether a unit is a terminal device 4174* 'ISHFT': ISHFT, Shift bits 4175* 'ISHFTC': ISHFTC, Shift bits circularly 4176* 'ISNAN': ISNAN, Tests for a NaN 4177* 'ITIME': ITIME, Current local time (hour/minutes/seconds) 4178* 'KILL': KILL, Send a signal to a process 4179* 'KIND': KIND, Kind of an entity 4180* 'LBOUND': LBOUND, Lower dimension bounds of an array 4181* 'LCOBOUND': LCOBOUND, Lower codimension bounds of an array 4182* 'LEADZ': LEADZ, Number of leading zero bits of an integer 4183* 'LEN': LEN, Length of a character entity 4184* 'LEN_TRIM': LEN_TRIM, Length of a character entity without trailing blank characters 4185* 'LGE': LGE, Lexical greater than or equal 4186* 'LGT': LGT, Lexical greater than 4187* 'LINK': LINK, Create a hard link 4188* 'LLE': LLE, Lexical less than or equal 4189* 'LLT': LLT, Lexical less than 4190* 'LNBLNK': LNBLNK, Index of the last non-blank character in a string 4191* 'LOC': LOC, Returns the address of a variable 4192* 'LOG': LOG, Logarithm function 4193* 'LOG10': LOG10, Base 10 logarithm function 4194* 'LOG_GAMMA': LOG_GAMMA, Logarithm of the Gamma function 4195* 'LOGICAL': LOGICAL, Convert to logical type 4196* 'LONG': LONG, Convert to integer type 4197* 'LSHIFT': LSHIFT, Left shift bits 4198* 'LSTAT': LSTAT, Get file status 4199* 'LTIME': LTIME, Convert time to local time info 4200* 'MALLOC': MALLOC, Dynamic memory allocation function 4201* 'MASKL': MASKL, Left justified mask 4202* 'MASKR': MASKR, Right justified mask 4203* 'MATMUL': MATMUL, matrix multiplication 4204* 'MAX': MAX, Maximum value of an argument list 4205* 'MAXEXPONENT': MAXEXPONENT, Maximum exponent of a real kind 4206* 'MAXLOC': MAXLOC, Location of the maximum value within an array 4207* 'MAXVAL': MAXVAL, Maximum value of an array 4208* 'MCLOCK': MCLOCK, Time function 4209* 'MCLOCK8': MCLOCK8, Time function (64-bit) 4210* 'MERGE': MERGE, Merge arrays 4211* 'MERGE_BITS': MERGE_BITS, Merge of bits under mask 4212* 'MIN': MIN, Minimum value of an argument list 4213* 'MINEXPONENT': MINEXPONENT, Minimum exponent of a real kind 4214* 'MINLOC': MINLOC, Location of the minimum value within an array 4215* 'MINVAL': MINVAL, Minimum value of an array 4216* 'MOD': MOD, Remainder function 4217* 'MODULO': MODULO, Modulo function 4218* 'MOVE_ALLOC': MOVE_ALLOC, Move allocation from one object to another 4219* 'MVBITS': MVBITS, Move bits from one integer to another 4220* 'NEAREST': NEAREST, Nearest representable number 4221* 'NEW_LINE': NEW_LINE, New line character 4222* 'NINT': NINT, Nearest whole number 4223* 'NORM2': NORM2, Euclidean vector norm 4224* 'NOT': NOT, Logical negation 4225* 'NULL': NULL, Function that returns an disassociated pointer 4226* 'NUM_IMAGES': NUM_IMAGES, Number of images 4227* 'OR': OR, Bitwise logical OR 4228* 'PACK': PACK, Pack an array into an array of rank one 4229* 'PARITY': PARITY, Reduction with exclusive OR 4230* 'PERROR': PERROR, Print system error message 4231* 'POPCNT': POPCNT, Number of bits set 4232* 'POPPAR': POPPAR, Parity of the number of bits set 4233* 'PRECISION': PRECISION, Decimal precision of a real kind 4234* 'PRESENT': PRESENT, Determine whether an optional dummy argument is specified 4235* 'PRODUCT': PRODUCT, Product of array elements 4236* 'RADIX': RADIX, Base of a data model 4237* 'RAN': RAN, Real pseudo-random number 4238* 'RAND': RAND, Real pseudo-random number 4239* 'RANDOM_NUMBER': RANDOM_NUMBER, Pseudo-random number 4240* 'RANDOM_SEED': RANDOM_SEED, Initialize a pseudo-random number sequence 4241* 'RANGE': RANGE, Decimal exponent range 4242* 'RANK' : RANK, Rank of a data object 4243* 'REAL': REAL, Convert to real type 4244* 'RENAME': RENAME, Rename a file 4245* 'REPEAT': REPEAT, Repeated string concatenation 4246* 'RESHAPE': RESHAPE, Function to reshape an array 4247* 'RRSPACING': RRSPACING, Reciprocal of the relative spacing 4248* 'RSHIFT': RSHIFT, Right shift bits 4249* 'SAME_TYPE_AS': SAME_TYPE_AS, Query dynamic types for equality 4250* 'SCALE': SCALE, Scale a real value 4251* 'SCAN': SCAN, Scan a string for the presence of a set of characters 4252* 'SECNDS': SECNDS, Time function 4253* 'SECOND': SECOND, CPU time function 4254* 'SELECTED_CHAR_KIND': SELECTED_CHAR_KIND, Choose character kind 4255* 'SELECTED_INT_KIND': SELECTED_INT_KIND, Choose integer kind 4256* 'SELECTED_REAL_KIND': SELECTED_REAL_KIND, Choose real kind 4257* 'SET_EXPONENT': SET_EXPONENT, Set the exponent of the model 4258* 'SHAPE': SHAPE, Determine the shape of an array 4259* 'SHIFTA': SHIFTA, Right shift with fill 4260* 'SHIFTL': SHIFTL, Left shift 4261* 'SHIFTR': SHIFTR, Right shift 4262* 'SIGN': SIGN, Sign copying function 4263* 'SIGNAL': SIGNAL, Signal handling subroutine (or function) 4264* 'SIN': SIN, Sine function 4265* 'SINH': SINH, Hyperbolic sine function 4266* 'SIZE': SIZE, Function to determine the size of an array 4267* 'SIZEOF': SIZEOF, Determine the size in bytes of an expression 4268* 'SLEEP': SLEEP, Sleep for the specified number of seconds 4269* 'SPACING': SPACING, Smallest distance between two numbers of a given type 4270* 'SPREAD': SPREAD, Add a dimension to an array 4271* 'SQRT': SQRT, Square-root function 4272* 'SRAND': SRAND, Reinitialize the random number generator 4273* 'STAT': STAT, Get file status 4274* 'STORAGE_SIZE': STORAGE_SIZE, Storage size in bits 4275* 'SUM': SUM, Sum of array elements 4276* 'SYMLNK': SYMLNK, Create a symbolic link 4277* 'SYSTEM': SYSTEM, Execute a shell command 4278* 'SYSTEM_CLOCK': SYSTEM_CLOCK, Time function 4279* 'TAN': TAN, Tangent function 4280* 'TANH': TANH, Hyperbolic tangent function 4281* 'THIS_IMAGE': THIS_IMAGE, Cosubscript index of this image 4282* 'TIME': TIME, Time function 4283* 'TIME8': TIME8, Time function (64-bit) 4284* 'TINY': TINY, Smallest positive number of a real kind 4285* 'TRAILZ': TRAILZ, Number of trailing zero bits of an integer 4286* 'TRANSFER': TRANSFER, Transfer bit patterns 4287* 'TRANSPOSE': TRANSPOSE, Transpose an array of rank two 4288* 'TRIM': TRIM, Remove trailing blank characters of a string 4289* 'TTYNAM': TTYNAM, Get the name of a terminal device. 4290* 'UBOUND': UBOUND, Upper dimension bounds of an array 4291* 'UCOBOUND': UCOBOUND, Upper codimension bounds of an array 4292* 'UMASK': UMASK, Set the file creation mask 4293* 'UNLINK': UNLINK, Remove a file from the file system 4294* 'UNPACK': UNPACK, Unpack an array of rank one into an array 4295* 'VERIFY': VERIFY, Scan a string for the absence of a set of characters 4296* 'XOR': XOR, Bitwise logical exclusive or 4297 4298 4299File: gfortran.info, Node: Introduction to Intrinsics, Next: ABORT, Up: Intrinsic Procedures 4300 43018.1 Introduction to intrinsic procedures 4302======================================== 4303 4304The intrinsic procedures provided by GNU Fortran include all of the 4305intrinsic procedures required by the Fortran 95 standard, a set of 4306intrinsic procedures for backwards compatibility with G77, and a 4307selection of intrinsic procedures from the Fortran 2003 and Fortran 2008 4308standards. Any conflict between a description here and a description in 4309either the Fortran 95 standard, the Fortran 2003 standard or the Fortran 43102008 standard is unintentional, and the standard(s) should be considered 4311authoritative. 4312 4313 The enumeration of the 'KIND' type parameter is processor defined in 4314the Fortran 95 standard. GNU Fortran defines the default integer type 4315and default real type by 'INTEGER(KIND=4)' and 'REAL(KIND=4)', 4316respectively. The standard mandates that both data types shall have 4317another kind, which have more precision. On typical target 4318architectures supported by 'gfortran', this kind type parameter is 4319'KIND=8'. Hence, 'REAL(KIND=8)' and 'DOUBLE PRECISION' are equivalent. 4320In the description of generic intrinsic procedures, the kind type 4321parameter will be specified by 'KIND=*', and in the description of 4322specific names for an intrinsic procedure the kind type parameter will 4323be explicitly given (e.g., 'REAL(KIND=4)' or 'REAL(KIND=8)'). Finally, 4324for brevity the optional 'KIND=' syntax will be omitted. 4325 4326 Many of the intrinsic procedures take one or more optional arguments. 4327This document follows the convention used in the Fortran 95 standard, 4328and denotes such arguments by square brackets. 4329 4330 GNU Fortran offers the '-std=f95' and '-std=gnu' options, which can 4331be used to restrict the set of intrinsic procedures to a given standard. 4332By default, 'gfortran' sets the '-std=gnu' option, and so all intrinsic 4333procedures described here are accepted. There is one caveat. For a 4334select group of intrinsic procedures, 'g77' implemented both a function 4335and a subroutine. Both classes have been implemented in 'gfortran' for 4336backwards compatibility with 'g77'. It is noted here that these 4337functions and subroutines cannot be intermixed in a given subprogram. 4338In the descriptions that follow, the applicable standard for each 4339intrinsic procedure is noted. 4340 4341 4342File: gfortran.info, Node: ABORT, Next: ABS, Prev: Introduction to Intrinsics, Up: Intrinsic Procedures 4343 43448.2 'ABORT' -- Abort the program 4345================================ 4346 4347_Description_: 4348 'ABORT' causes immediate termination of the program. On operating 4349 systems that support a core dump, 'ABORT' will produce a core dump. 4350 It will also print a backtrace, unless '-fno-backtrace' is given. 4351 4352_Standard_: 4353 GNU extension 4354 4355_Class_: 4356 Subroutine 4357 4358_Syntax_: 4359 'CALL ABORT' 4360 4361_Return value_: 4362 Does not return. 4363 4364_Example_: 4365 program test_abort 4366 integer :: i = 1, j = 2 4367 if (i /= j) call abort 4368 end program test_abort 4369 4370_See also_: 4371 *note EXIT::, *note KILL::, *note BACKTRACE:: 4372 4373 4374File: gfortran.info, Node: ABS, Next: ACCESS, Prev: ABORT, Up: Intrinsic Procedures 4375 43768.3 'ABS' -- Absolute value 4377=========================== 4378 4379_Description_: 4380 'ABS(A)' computes the absolute value of 'A'. 4381 4382_Standard_: 4383 Fortran 77 and later, has overloads that are GNU extensions 4384 4385_Class_: 4386 Elemental function 4387 4388_Syntax_: 4389 'RESULT = ABS(A)' 4390 4391_Arguments_: 4392 A The type of the argument shall be an 'INTEGER', 4393 'REAL', or 'COMPLEX'. 4394 4395_Return value_: 4396 The return value is of the same type and kind as the argument 4397 except the return value is 'REAL' for a 'COMPLEX' argument. 4398 4399_Example_: 4400 program test_abs 4401 integer :: i = -1 4402 real :: x = -1.e0 4403 complex :: z = (-1.e0,0.e0) 4404 i = abs(i) 4405 x = abs(x) 4406 x = abs(z) 4407 end program test_abs 4408 4409_Specific names_: 4410 Name Argument Return type Standard 4411 'ABS(A)' 'REAL(4) A' 'REAL(4)' Fortran 77 and 4412 later 4413 'CABS(A)' 'COMPLEX(4) 'REAL(4)' Fortran 77 and 4414 A' later 4415 'DABS(A)' 'REAL(8) A' 'REAL(8)' Fortran 77 and 4416 later 4417 'IABS(A)' 'INTEGER(4) 'INTEGER(4)' Fortran 77 and 4418 A' later 4419 'ZABS(A)' 'COMPLEX(8) 'COMPLEX(8)' GNU extension 4420 A' 4421 'CDABS(A)' 'COMPLEX(8) 'COMPLEX(8)' GNU extension 4422 A' 4423 4424 4425File: gfortran.info, Node: ACCESS, Next: ACHAR, Prev: ABS, Up: Intrinsic Procedures 4426 44278.4 'ACCESS' -- Checks file access modes 4428======================================== 4429 4430_Description_: 4431 'ACCESS(NAME, MODE)' checks whether the file NAME exists, is 4432 readable, writable or executable. Except for the executable check, 4433 'ACCESS' can be replaced by Fortran 95's 'INQUIRE'. 4434 4435_Standard_: 4436 GNU extension 4437 4438_Class_: 4439 Inquiry function 4440 4441_Syntax_: 4442 'RESULT = ACCESS(NAME, MODE)' 4443 4444_Arguments_: 4445 NAME Scalar 'CHARACTER' of default kind with the file 4446 name. Tailing blank are ignored unless the 4447 character 'achar(0)' is present, then all 4448 characters up to and excluding 'achar(0)' are 4449 used as file name. 4450 MODE Scalar 'CHARACTER' of default kind with the file 4451 access mode, may be any concatenation of '"r"' 4452 (readable), '"w"' (writable) and '"x"' 4453 (executable), or '" "' to check for existence. 4454 4455_Return value_: 4456 Returns a scalar 'INTEGER', which is '0' if the file is accessible 4457 in the given mode; otherwise or if an invalid argument has been 4458 given for 'MODE' the value '1' is returned. 4459 4460_Example_: 4461 program access_test 4462 implicit none 4463 character(len=*), parameter :: file = 'test.dat' 4464 character(len=*), parameter :: file2 = 'test.dat '//achar(0) 4465 if(access(file,' ') == 0) print *, trim(file),' is exists' 4466 if(access(file,'r') == 0) print *, trim(file),' is readable' 4467 if(access(file,'w') == 0) print *, trim(file),' is writable' 4468 if(access(file,'x') == 0) print *, trim(file),' is executable' 4469 if(access(file2,'rwx') == 0) & 4470 print *, trim(file2),' is readable, writable and executable' 4471 end program access_test 4472_Specific names_: 4473_See also_: 4474 4475 4476File: gfortran.info, Node: ACHAR, Next: ACOS, Prev: ACCESS, Up: Intrinsic Procedures 4477 44788.5 'ACHAR' -- Character in ASCII collating sequence 4479==================================================== 4480 4481_Description_: 4482 'ACHAR(I)' returns the character located at position 'I' in the 4483 ASCII collating sequence. 4484 4485_Standard_: 4486 Fortran 77 and later, with KIND argument Fortran 2003 and later 4487 4488_Class_: 4489 Elemental function 4490 4491_Syntax_: 4492 'RESULT = ACHAR(I [, KIND])' 4493 4494_Arguments_: 4495 I The type shall be 'INTEGER'. 4496 KIND (Optional) An 'INTEGER' initialization 4497 expression indicating the kind parameter of the 4498 result. 4499 4500_Return value_: 4501 The return value is of type 'CHARACTER' with a length of one. If 4502 the KIND argument is present, the return value is of the specified 4503 kind and of the default kind otherwise. 4504 4505_Example_: 4506 program test_achar 4507 character c 4508 c = achar(32) 4509 end program test_achar 4510 4511_Note_: 4512 See *note ICHAR:: for a discussion of converting between numerical 4513 values and formatted string representations. 4514 4515_See also_: 4516 *note CHAR::, *note IACHAR::, *note ICHAR:: 4517 4518 4519File: gfortran.info, Node: ACOS, Next: ACOSH, Prev: ACHAR, Up: Intrinsic Procedures 4520 45218.6 'ACOS' -- Arccosine function 4522================================ 4523 4524_Description_: 4525 'ACOS(X)' computes the arccosine of X (inverse of 'COS(X)'). 4526 4527_Standard_: 4528 Fortran 77 and later, for a complex argument Fortran 2008 or later 4529 4530_Class_: 4531 Elemental function 4532 4533_Syntax_: 4534 'RESULT = ACOS(X)' 4535 4536_Arguments_: 4537 X The type shall either be 'REAL' with a magnitude 4538 that is less than or equal to one - or the type 4539 shall be 'COMPLEX'. 4540 4541_Return value_: 4542 The return value is of the same type and kind as X. The real part 4543 of the result is in radians and lies in the range 0 \leq \Re 4544 \acos(x) \leq \pi. 4545 4546_Example_: 4547 program test_acos 4548 real(8) :: x = 0.866_8 4549 x = acos(x) 4550 end program test_acos 4551 4552_Specific names_: 4553 Name Argument Return type Standard 4554 'ACOS(X)' 'REAL(4) X' 'REAL(4)' Fortran 77 and 4555 later 4556 'DACOS(X)' 'REAL(8) X' 'REAL(8)' Fortran 77 and 4557 later 4558 4559_See also_: 4560 Inverse function: *note COS:: 4561 4562 4563File: gfortran.info, Node: ACOSH, Next: ADJUSTL, Prev: ACOS, Up: Intrinsic Procedures 4564 45658.7 'ACOSH' -- Inverse hyperbolic cosine function 4566================================================= 4567 4568_Description_: 4569 'ACOSH(X)' computes the inverse hyperbolic cosine of X. 4570 4571_Standard_: 4572 Fortran 2008 and later 4573 4574_Class_: 4575 Elemental function 4576 4577_Syntax_: 4578 'RESULT = ACOSH(X)' 4579 4580_Arguments_: 4581 X The type shall be 'REAL' or 'COMPLEX'. 4582 4583_Return value_: 4584 The return value has the same type and kind as X. If X is complex, 4585 the imaginary part of the result is in radians and lies between 0 4586 \leq \Im \acosh(x) \leq \pi. 4587 4588_Example_: 4589 PROGRAM test_acosh 4590 REAL(8), DIMENSION(3) :: x = (/ 1.0, 2.0, 3.0 /) 4591 WRITE (*,*) ACOSH(x) 4592 END PROGRAM 4593 4594_Specific names_: 4595 Name Argument Return type Standard 4596 'DACOSH(X)' 'REAL(8) X' 'REAL(8)' GNU extension 4597 4598_See also_: 4599 Inverse function: *note COSH:: 4600 4601 4602File: gfortran.info, Node: ADJUSTL, Next: ADJUSTR, Prev: ACOSH, Up: Intrinsic Procedures 4603 46048.8 'ADJUSTL' -- Left adjust a string 4605===================================== 4606 4607_Description_: 4608 'ADJUSTL(STRING)' will left adjust a string by removing leading 4609 spaces. Spaces are inserted at the end of the string as needed. 4610 4611_Standard_: 4612 Fortran 90 and later 4613 4614_Class_: 4615 Elemental function 4616 4617_Syntax_: 4618 'RESULT = ADJUSTL(STRING)' 4619 4620_Arguments_: 4621 STRING The type shall be 'CHARACTER'. 4622 4623_Return value_: 4624 The return value is of type 'CHARACTER' and of the same kind as 4625 STRING where leading spaces are removed and the same number of 4626 spaces are inserted on the end of STRING. 4627 4628_Example_: 4629 program test_adjustl 4630 character(len=20) :: str = ' gfortran' 4631 str = adjustl(str) 4632 print *, str 4633 end program test_adjustl 4634 4635_See also_: 4636 *note ADJUSTR::, *note TRIM:: 4637 4638 4639File: gfortran.info, Node: ADJUSTR, Next: AIMAG, Prev: ADJUSTL, Up: Intrinsic Procedures 4640 46418.9 'ADJUSTR' -- Right adjust a string 4642====================================== 4643 4644_Description_: 4645 'ADJUSTR(STRING)' will right adjust a string by removing trailing 4646 spaces. Spaces are inserted at the start of the string as needed. 4647 4648_Standard_: 4649 Fortran 95 and later 4650 4651_Class_: 4652 Elemental function 4653 4654_Syntax_: 4655 'RESULT = ADJUSTR(STRING)' 4656 4657_Arguments_: 4658 STR The type shall be 'CHARACTER'. 4659 4660_Return value_: 4661 The return value is of type 'CHARACTER' and of the same kind as 4662 STRING where trailing spaces are removed and the same number of 4663 spaces are inserted at the start of STRING. 4664 4665_Example_: 4666 program test_adjustr 4667 character(len=20) :: str = 'gfortran' 4668 str = adjustr(str) 4669 print *, str 4670 end program test_adjustr 4671 4672_See also_: 4673 *note ADJUSTL::, *note TRIM:: 4674 4675 4676File: gfortran.info, Node: AIMAG, Next: AINT, Prev: ADJUSTR, Up: Intrinsic Procedures 4677 46788.10 'AIMAG' -- Imaginary part of complex number 4679================================================ 4680 4681_Description_: 4682 'AIMAG(Z)' yields the imaginary part of complex argument 'Z'. The 4683 'IMAG(Z)' and 'IMAGPART(Z)' intrinsic functions are provided for 4684 compatibility with 'g77', and their use in new code is strongly 4685 discouraged. 4686 4687_Standard_: 4688 Fortran 77 and later, has overloads that are GNU extensions 4689 4690_Class_: 4691 Elemental function 4692 4693_Syntax_: 4694 'RESULT = AIMAG(Z)' 4695 4696_Arguments_: 4697 Z The type of the argument shall be 'COMPLEX'. 4698 4699_Return value_: 4700 The return value is of type 'REAL' with the kind type parameter of 4701 the argument. 4702 4703_Example_: 4704 program test_aimag 4705 complex(4) z4 4706 complex(8) z8 4707 z4 = cmplx(1.e0_4, 0.e0_4) 4708 z8 = cmplx(0.e0_8, 1.e0_8) 4709 print *, aimag(z4), dimag(z8) 4710 end program test_aimag 4711 4712_Specific names_: 4713 Name Argument Return type Standard 4714 'AIMAG(Z)' 'COMPLEX Z' 'REAL' GNU extension 4715 'DIMAG(Z)' 'COMPLEX(8) 'REAL(8)' GNU extension 4716 Z' 4717 'IMAG(Z)' 'COMPLEX Z' 'REAL' GNU extension 4718 'IMAGPART(Z)' 'COMPLEX Z' 'REAL' GNU extension 4719 4720 4721File: gfortran.info, Node: AINT, Next: ALARM, Prev: AIMAG, Up: Intrinsic Procedures 4722 47238.11 'AINT' -- Truncate to a whole number 4724========================================= 4725 4726_Description_: 4727 'AINT(A [, KIND])' truncates its argument to a whole number. 4728 4729_Standard_: 4730 Fortran 77 and later 4731 4732_Class_: 4733 Elemental function 4734 4735_Syntax_: 4736 'RESULT = AINT(A [, KIND])' 4737 4738_Arguments_: 4739 A The type of the argument shall be 'REAL'. 4740 KIND (Optional) An 'INTEGER' initialization 4741 expression indicating the kind parameter of the 4742 result. 4743 4744_Return value_: 4745 The return value is of type 'REAL' with the kind type parameter of 4746 the argument if the optional KIND is absent; otherwise, the kind 4747 type parameter will be given by KIND. If the magnitude of X is 4748 less than one, 'AINT(X)' returns zero. If the magnitude is equal 4749 to or greater than one then it returns the largest whole number 4750 that does not exceed its magnitude. The sign is the same as the 4751 sign of X. 4752 4753_Example_: 4754 program test_aint 4755 real(4) x4 4756 real(8) x8 4757 x4 = 1.234E0_4 4758 x8 = 4.321_8 4759 print *, aint(x4), dint(x8) 4760 x8 = aint(x4,8) 4761 end program test_aint 4762 4763_Specific names_: 4764 Name Argument Return type Standard 4765 'AINT(A)' 'REAL(4) A' 'REAL(4)' Fortran 77 and 4766 later 4767 'DINT(A)' 'REAL(8) A' 'REAL(8)' Fortran 77 and 4768 later 4769 4770 4771File: gfortran.info, Node: ALARM, Next: ALL, Prev: AINT, Up: Intrinsic Procedures 4772 47738.12 'ALARM' -- Execute a routine after a given delay 4774===================================================== 4775 4776_Description_: 4777 'ALARM(SECONDS, HANDLER [, STATUS])' causes external subroutine 4778 HANDLER to be executed after a delay of SECONDS by using 'alarm(2)' 4779 to set up a signal and 'signal(2)' to catch it. If STATUS is 4780 supplied, it will be returned with the number of seconds remaining 4781 until any previously scheduled alarm was due to be delivered, or 4782 zero if there was no previously scheduled alarm. 4783 4784_Standard_: 4785 GNU extension 4786 4787_Class_: 4788 Subroutine 4789 4790_Syntax_: 4791 'CALL ALARM(SECONDS, HANDLER [, STATUS])' 4792 4793_Arguments_: 4794 SECONDS The type of the argument shall be a scalar 4795 'INTEGER'. It is 'INTENT(IN)'. 4796 HANDLER Signal handler ('INTEGER FUNCTION' or 4797 'SUBROUTINE') or dummy/global 'INTEGER' scalar. 4798 The scalar values may be either 'SIG_IGN=1' to 4799 ignore the alarm generated or 'SIG_DFL=0' to set 4800 the default action. It is 'INTENT(IN)'. 4801 STATUS (Optional) STATUS shall be a scalar variable of 4802 the default 'INTEGER' kind. It is 4803 'INTENT(OUT)'. 4804 4805_Example_: 4806 program test_alarm 4807 external handler_print 4808 integer i 4809 call alarm (3, handler_print, i) 4810 print *, i 4811 call sleep(10) 4812 end program test_alarm 4813 This will cause the external routine HANDLER_PRINT to be called 4814 after 3 seconds. 4815 4816 4817File: gfortran.info, Node: ALL, Next: ALLOCATED, Prev: ALARM, Up: Intrinsic Procedures 4818 48198.13 'ALL' -- All values in MASK along DIM are true 4820=================================================== 4821 4822_Description_: 4823 'ALL(MASK [, DIM])' determines if all the values are true in MASK 4824 in the array along dimension DIM. 4825 4826_Standard_: 4827 Fortran 95 and later 4828 4829_Class_: 4830 Transformational function 4831 4832_Syntax_: 4833 'RESULT = ALL(MASK [, DIM])' 4834 4835_Arguments_: 4836 MASK The type of the argument shall be 'LOGICAL' and 4837 it shall not be scalar. 4838 DIM (Optional) DIM shall be a scalar integer with a 4839 value that lies between one and the rank of 4840 MASK. 4841 4842_Return value_: 4843 'ALL(MASK)' returns a scalar value of type 'LOGICAL' where the kind 4844 type parameter is the same as the kind type parameter of MASK. If 4845 DIM is present, then 'ALL(MASK, DIM)' returns an array with the 4846 rank of MASK minus 1. The shape is determined from the shape of 4847 MASK where the DIM dimension is elided. 4848 4849 (A) 4850 'ALL(MASK)' is true if all elements of MASK are true. It also 4851 is true if MASK has zero size; otherwise, it is false. 4852 (B) 4853 If the rank of MASK is one, then 'ALL(MASK,DIM)' is equivalent 4854 to 'ALL(MASK)'. If the rank is greater than one, then 4855 'ALL(MASK,DIM)' is determined by applying 'ALL' to the array 4856 sections. 4857 4858_Example_: 4859 program test_all 4860 logical l 4861 l = all((/.true., .true., .true./)) 4862 print *, l 4863 call section 4864 contains 4865 subroutine section 4866 integer a(2,3), b(2,3) 4867 a = 1 4868 b = 1 4869 b(2,2) = 2 4870 print *, all(a .eq. b, 1) 4871 print *, all(a .eq. b, 2) 4872 end subroutine section 4873 end program test_all 4874 4875 4876File: gfortran.info, Node: ALLOCATED, Next: AND, Prev: ALL, Up: Intrinsic Procedures 4877 48788.14 'ALLOCATED' -- Status of an allocatable entity 4879=================================================== 4880 4881_Description_: 4882 'ALLOCATED(ARRAY)' and 'ALLOCATED(SCALAR)' check the allocation 4883 status of ARRAY and SCALAR, respectively. 4884 4885_Standard_: 4886 Fortran 95 and later. Note, the 'SCALAR=' keyword and allocatable 4887 scalar entities are available in Fortran 2003 and later. 4888 4889_Class_: 4890 Inquiry function 4891 4892_Syntax_: 4893 'RESULT = ALLOCATED(ARRAY)' 4894 'RESULT = ALLOCATED(SCALAR)' 4895 4896_Arguments_: 4897 ARRAY The argument shall be an 'ALLOCATABLE' array. 4898 SCALAR The argument shall be an 'ALLOCATABLE' scalar. 4899 4900_Return value_: 4901 The return value is a scalar 'LOGICAL' with the default logical 4902 kind type parameter. If the argument is allocated, then the result 4903 is '.TRUE.'; otherwise, it returns '.FALSE.' 4904 4905_Example_: 4906 program test_allocated 4907 integer :: i = 4 4908 real(4), allocatable :: x(:) 4909 if (.not. allocated(x)) allocate(x(i)) 4910 end program test_allocated 4911 4912 4913File: gfortran.info, Node: AND, Next: ANINT, Prev: ALLOCATED, Up: Intrinsic Procedures 4914 49158.15 'AND' -- Bitwise logical AND 4916================================= 4917 4918_Description_: 4919 Bitwise logical 'AND'. 4920 4921 This intrinsic routine is provided for backwards compatibility with 4922 GNU Fortran 77. For integer arguments, programmers should consider 4923 the use of the *note IAND:: intrinsic defined by the Fortran 4924 standard. 4925 4926_Standard_: 4927 GNU extension 4928 4929_Class_: 4930 Function 4931 4932_Syntax_: 4933 'RESULT = AND(I, J)' 4934 4935_Arguments_: 4936 I The type shall be either a scalar 'INTEGER' type 4937 or a scalar 'LOGICAL' type. 4938 J The type shall be the same as the type of I. 4939 4940_Return value_: 4941 The return type is either a scalar 'INTEGER' or a scalar 'LOGICAL'. 4942 If the kind type parameters differ, then the smaller kind type is 4943 implicitly converted to larger kind, and the return has the larger 4944 kind. 4945 4946_Example_: 4947 PROGRAM test_and 4948 LOGICAL :: T = .TRUE., F = .FALSE. 4949 INTEGER :: a, b 4950 DATA a / Z'F' /, b / Z'3' / 4951 4952 WRITE (*,*) AND(T, T), AND(T, F), AND(F, T), AND(F, F) 4953 WRITE (*,*) AND(a, b) 4954 END PROGRAM 4955 4956_See also_: 4957 Fortran 95 elemental function: *note IAND:: 4958 4959 4960File: gfortran.info, Node: ANINT, Next: ANY, Prev: AND, Up: Intrinsic Procedures 4961 49628.16 'ANINT' -- Nearest whole number 4963==================================== 4964 4965_Description_: 4966 'ANINT(A [, KIND])' rounds its argument to the nearest whole 4967 number. 4968 4969_Standard_: 4970 Fortran 77 and later 4971 4972_Class_: 4973 Elemental function 4974 4975_Syntax_: 4976 'RESULT = ANINT(A [, KIND])' 4977 4978_Arguments_: 4979 A The type of the argument shall be 'REAL'. 4980 KIND (Optional) An 'INTEGER' initialization 4981 expression indicating the kind parameter of the 4982 result. 4983 4984_Return value_: 4985 The return value is of type real with the kind type parameter of 4986 the argument if the optional KIND is absent; otherwise, the kind 4987 type parameter will be given by KIND. If A is greater than zero, 4988 'ANINT(A)' returns 'AINT(X+0.5)'. If A is less than or equal to 4989 zero then it returns 'AINT(X-0.5)'. 4990 4991_Example_: 4992 program test_anint 4993 real(4) x4 4994 real(8) x8 4995 x4 = 1.234E0_4 4996 x8 = 4.321_8 4997 print *, anint(x4), dnint(x8) 4998 x8 = anint(x4,8) 4999 end program test_anint 5000 5001_Specific names_: 5002 Name Argument Return type Standard 5003 'AINT(A)' 'REAL(4) A' 'REAL(4)' Fortran 77 and 5004 later 5005 'DNINT(A)' 'REAL(8) A' 'REAL(8)' Fortran 77 and 5006 later 5007 5008 5009File: gfortran.info, Node: ANY, Next: ASIN, Prev: ANINT, Up: Intrinsic Procedures 5010 50118.17 'ANY' -- Any value in MASK along DIM is true 5012================================================= 5013 5014_Description_: 5015 'ANY(MASK [, DIM])' determines if any of the values in the logical 5016 array MASK along dimension DIM are '.TRUE.'. 5017 5018_Standard_: 5019 Fortran 95 and later 5020 5021_Class_: 5022 Transformational function 5023 5024_Syntax_: 5025 'RESULT = ANY(MASK [, DIM])' 5026 5027_Arguments_: 5028 MASK The type of the argument shall be 'LOGICAL' and 5029 it shall not be scalar. 5030 DIM (Optional) DIM shall be a scalar integer with a 5031 value that lies between one and the rank of 5032 MASK. 5033 5034_Return value_: 5035 'ANY(MASK)' returns a scalar value of type 'LOGICAL' where the kind 5036 type parameter is the same as the kind type parameter of MASK. If 5037 DIM is present, then 'ANY(MASK, DIM)' returns an array with the 5038 rank of MASK minus 1. The shape is determined from the shape of 5039 MASK where the DIM dimension is elided. 5040 5041 (A) 5042 'ANY(MASK)' is true if any element of MASK is true; otherwise, 5043 it is false. It also is false if MASK has zero size. 5044 (B) 5045 If the rank of MASK is one, then 'ANY(MASK,DIM)' is equivalent 5046 to 'ANY(MASK)'. If the rank is greater than one, then 5047 'ANY(MASK,DIM)' is determined by applying 'ANY' to the array 5048 sections. 5049 5050_Example_: 5051 program test_any 5052 logical l 5053 l = any((/.true., .true., .true./)) 5054 print *, l 5055 call section 5056 contains 5057 subroutine section 5058 integer a(2,3), b(2,3) 5059 a = 1 5060 b = 1 5061 b(2,2) = 2 5062 print *, any(a .eq. b, 1) 5063 print *, any(a .eq. b, 2) 5064 end subroutine section 5065 end program test_any 5066 5067 5068File: gfortran.info, Node: ASIN, Next: ASINH, Prev: ANY, Up: Intrinsic Procedures 5069 50708.18 'ASIN' -- Arcsine function 5071=============================== 5072 5073_Description_: 5074 'ASIN(X)' computes the arcsine of its X (inverse of 'SIN(X)'). 5075 5076_Standard_: 5077 Fortran 77 and later, for a complex argument Fortran 2008 or later 5078 5079_Class_: 5080 Elemental function 5081 5082_Syntax_: 5083 'RESULT = ASIN(X)' 5084 5085_Arguments_: 5086 X The type shall be either 'REAL' and a magnitude 5087 that is less than or equal to one - or be 5088 'COMPLEX'. 5089 5090_Return value_: 5091 The return value is of the same type and kind as X. The real part 5092 of the result is in radians and lies in the range -\pi/2 \leq \Re 5093 \asin(x) \leq \pi/2. 5094 5095_Example_: 5096 program test_asin 5097 real(8) :: x = 0.866_8 5098 x = asin(x) 5099 end program test_asin 5100 5101_Specific names_: 5102 Name Argument Return type Standard 5103 'ASIN(X)' 'REAL(4) X' 'REAL(4)' Fortran 77 and 5104 later 5105 'DASIN(X)' 'REAL(8) X' 'REAL(8)' Fortran 77 and 5106 later 5107 5108_See also_: 5109 Inverse function: *note SIN:: 5110 5111 5112File: gfortran.info, Node: ASINH, Next: ASSOCIATED, Prev: ASIN, Up: Intrinsic Procedures 5113 51148.19 'ASINH' -- Inverse hyperbolic sine function 5115================================================ 5116 5117_Description_: 5118 'ASINH(X)' computes the inverse hyperbolic sine of X. 5119 5120_Standard_: 5121 Fortran 2008 and later 5122 5123_Class_: 5124 Elemental function 5125 5126_Syntax_: 5127 'RESULT = ASINH(X)' 5128 5129_Arguments_: 5130 X The type shall be 'REAL' or 'COMPLEX'. 5131 5132_Return value_: 5133 The return value is of the same type and kind as X. If X is 5134 complex, the imaginary part of the result is in radians and lies 5135 between -\pi/2 \leq \Im \asinh(x) \leq \pi/2. 5136 5137_Example_: 5138 PROGRAM test_asinh 5139 REAL(8), DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /) 5140 WRITE (*,*) ASINH(x) 5141 END PROGRAM 5142 5143_Specific names_: 5144 Name Argument Return type Standard 5145 'DASINH(X)' 'REAL(8) X' 'REAL(8)' GNU extension. 5146 5147_See also_: 5148 Inverse function: *note SINH:: 5149 5150 5151File: gfortran.info, Node: ASSOCIATED, Next: ATAN, Prev: ASINH, Up: Intrinsic Procedures 5152 51538.20 'ASSOCIATED' -- Status of a pointer or pointer/target pair 5154=============================================================== 5155 5156_Description_: 5157 'ASSOCIATED(POINTER [, TARGET])' determines the status of the 5158 pointer POINTER or if POINTER is associated with the target TARGET. 5159 5160_Standard_: 5161 Fortran 95 and later 5162 5163_Class_: 5164 Inquiry function 5165 5166_Syntax_: 5167 'RESULT = ASSOCIATED(POINTER [, TARGET])' 5168 5169_Arguments_: 5170 POINTER POINTER shall have the 'POINTER' attribute and 5171 it can be of any type. 5172 TARGET (Optional) TARGET shall be a pointer or a 5173 target. It must have the same type, kind type 5174 parameter, and array rank as POINTER. 5175 The association status of neither POINTER nor TARGET shall be 5176 undefined. 5177 5178_Return value_: 5179 'ASSOCIATED(POINTER)' returns a scalar value of type 'LOGICAL(4)'. 5180 There are several cases: 5181 (A) When the optional TARGET is not present then 5182 'ASSOCIATED(POINTER)' is true if POINTER is associated with a 5183 target; otherwise, it returns false. 5184 (B) If TARGET is present and a scalar target, the result is true if 5185 TARGET is not a zero-sized storage sequence and the target 5186 associated with POINTER occupies the same storage units. If 5187 POINTER is disassociated, the result is false. 5188 (C) If TARGET is present and an array target, the result is true if 5189 TARGET and POINTER have the same shape, are not zero-sized 5190 arrays, are arrays whose elements are not zero-sized storage 5191 sequences, and TARGET and POINTER occupy the same storage 5192 units in array element order. As in case(B), the result is 5193 false, if POINTER is disassociated. 5194 (D) If TARGET is present and an scalar pointer, the result is true 5195 if TARGET is associated with POINTER, the target associated 5196 with TARGET are not zero-sized storage sequences and occupy 5197 the same storage units. The result is false, if either TARGET 5198 or POINTER is disassociated. 5199 (E) If TARGET is present and an array pointer, the result is true if 5200 target associated with POINTER and the target associated with 5201 TARGET have the same shape, are not zero-sized arrays, are 5202 arrays whose elements are not zero-sized storage sequences, 5203 and TARGET and POINTER occupy the same storage units in array 5204 element order. The result is false, if either TARGET or 5205 POINTER is disassociated. 5206 5207_Example_: 5208 program test_associated 5209 implicit none 5210 real, target :: tgt(2) = (/1., 2./) 5211 real, pointer :: ptr(:) 5212 ptr => tgt 5213 if (associated(ptr) .eqv. .false.) call abort 5214 if (associated(ptr,tgt) .eqv. .false.) call abort 5215 end program test_associated 5216 5217_See also_: 5218 *note NULL:: 5219 5220 5221File: gfortran.info, Node: ATAN, Next: ATAN2, Prev: ASSOCIATED, Up: Intrinsic Procedures 5222 52238.21 'ATAN' -- Arctangent function 5224================================== 5225 5226_Description_: 5227 'ATAN(X)' computes the arctangent of X. 5228 5229_Standard_: 5230 Fortran 77 and later, for a complex argument and for two arguments 5231 Fortran 2008 or later 5232 5233_Class_: 5234 Elemental function 5235 5236_Syntax_: 5237 'RESULT = ATAN(X)' 5238 'RESULT = ATAN(Y, X)' 5239 5240_Arguments_: 5241 X The type shall be 'REAL' or 'COMPLEX'; if Y is 5242 present, X shall be REAL. 5243 Y shall 5244 be of the 5245 same type 5246 and kind 5247 as X. 5248 5249_Return value_: 5250 The return value is of the same type and kind as X. If Y is 5251 present, the result is identical to 'ATAN2(Y,X)'. Otherwise, it 5252 the arcus tangent of X, where the real part of the result is in 5253 radians and lies in the range -\pi/2 \leq \Re \atan(x) \leq \pi/2. 5254 5255_Example_: 5256 program test_atan 5257 real(8) :: x = 2.866_8 5258 x = atan(x) 5259 end program test_atan 5260 5261_Specific names_: 5262 Name Argument Return type Standard 5263 'ATAN(X)' 'REAL(4) X' 'REAL(4)' Fortran 77 and 5264 later 5265 'DATAN(X)' 'REAL(8) X' 'REAL(8)' Fortran 77 and 5266 later 5267 5268_See also_: 5269 Inverse function: *note TAN:: 5270 5271 5272File: gfortran.info, Node: ATAN2, Next: ATANH, Prev: ATAN, Up: Intrinsic Procedures 5273 52748.22 'ATAN2' -- Arctangent function 5275=================================== 5276 5277_Description_: 5278 'ATAN2(Y, X)' computes the principal value of the argument function 5279 of the complex number X + i Y. This function can be used to 5280 transform from Cartesian into polar coordinates and allows to 5281 determine the angle in the correct quadrant. 5282 5283_Standard_: 5284 Fortran 77 and later 5285 5286_Class_: 5287 Elemental function 5288 5289_Syntax_: 5290 'RESULT = ATAN2(Y, X)' 5291 5292_Arguments_: 5293 Y The type shall be 'REAL'. 5294 X The type and kind type parameter shall be the 5295 same as Y. If Y is zero, then X must be 5296 nonzero. 5297 5298_Return value_: 5299 The return value has the same type and kind type parameter as Y. 5300 It is the principal value of the complex number X + i Y. If X is 5301 nonzero, then it lies in the range -\pi \le \atan (x) \leq \pi. 5302 The sign is positive if Y is positive. If Y is zero, then the 5303 return value is zero if X is strictly positive, \pi if X is 5304 negative and Y is positive zero (or the processor does not handle 5305 signed zeros), and -\pi if X is negative and Y is negative zero. 5306 Finally, if X is zero, then the magnitude of the result is \pi/2. 5307 5308_Example_: 5309 program test_atan2 5310 real(4) :: x = 1.e0_4, y = 0.5e0_4 5311 x = atan2(y,x) 5312 end program test_atan2 5313 5314_Specific names_: 5315 Name Argument Return type Standard 5316 'ATAN2(X, 'REAL(4) X, 'REAL(4)' Fortran 77 and 5317 Y)' Y' later 5318 'DATAN2(X, 'REAL(8) X, 'REAL(8)' Fortran 77 and 5319 Y)' Y' later 5320 5321 5322File: gfortran.info, Node: ATANH, Next: ATOMIC_DEFINE, Prev: ATAN2, Up: Intrinsic Procedures 5323 53248.23 'ATANH' -- Inverse hyperbolic tangent function 5325=================================================== 5326 5327_Description_: 5328 'ATANH(X)' computes the inverse hyperbolic tangent of X. 5329 5330_Standard_: 5331 Fortran 2008 and later 5332 5333_Class_: 5334 Elemental function 5335 5336_Syntax_: 5337 'RESULT = ATANH(X)' 5338 5339_Arguments_: 5340 X The type shall be 'REAL' or 'COMPLEX'. 5341 5342_Return value_: 5343 The return value has same type and kind as X. If X is complex, the 5344 imaginary part of the result is in radians and lies between -\pi/2 5345 \leq \Im \atanh(x) \leq \pi/2. 5346 5347_Example_: 5348 PROGRAM test_atanh 5349 REAL, DIMENSION(3) :: x = (/ -1.0, 0.0, 1.0 /) 5350 WRITE (*,*) ATANH(x) 5351 END PROGRAM 5352 5353_Specific names_: 5354 Name Argument Return type Standard 5355 'DATANH(X)' 'REAL(8) X' 'REAL(8)' GNU extension 5356 5357_See also_: 5358 Inverse function: *note TANH:: 5359 5360 5361File: gfortran.info, Node: ATOMIC_DEFINE, Next: ATOMIC_REF, Prev: ATANH, Up: Intrinsic Procedures 5362 53638.24 'ATOMIC_DEFINE' -- Setting a variable atomically 5364===================================================== 5365 5366_Description_: 5367 'ATOMIC_DEFINE(ATOM, VALUE)' defines the variable ATOM with the 5368 value VALUE atomically. 5369 5370_Standard_: 5371 Fortran 2008 and later 5372 5373_Class_: 5374 Atomic subroutine 5375 5376_Syntax_: 5377 'CALL ATOMIC_DEFINE(ATOM, VALUE)' 5378 5379_Arguments_: 5380 ATOM Scalar coarray or coindexed variable of either 5381 integer type with 'ATOMIC_INT_KIND' kind or 5382 logical type with 'ATOMIC_LOGICAL_KIND' kind. 5383 VALURE Scalar and of the same type as ATOM. If the 5384 kind is different, the value is converted to the 5385 kind of ATOM. 5386 5387_Example_: 5388 program atomic 5389 use iso_fortran_env 5390 integer(atomic_int_kind) :: atom[*] 5391 call atomic_define (atom[1], this_image()) 5392 end program atomic 5393 5394_See also_: 5395 *note ATOMIC_REF::, *note ISO_FORTRAN_ENV:: 5396 5397 5398File: gfortran.info, Node: ATOMIC_REF, Next: BACKTRACE, Prev: ATOMIC_DEFINE, Up: Intrinsic Procedures 5399 54008.25 'ATOMIC_REF' -- Obtaining the value of a variable atomically 5401================================================================= 5402 5403_Description_: 5404 'ATOMIC_DEFINE(ATOM, VALUE)' atomically assigns the value of the 5405 variable ATOM to VALUE. 5406 5407_Standard_: 5408 Fortran 2008 and later 5409 5410_Class_: 5411 Atomic subroutine 5412 5413_Syntax_: 5414 'CALL ATOMIC_REF(VALUE, ATOM)' 5415 5416_Arguments_: 5417 VALURE Scalar and of the same type as ATOM. If the 5418 kind is different, the value is converted to the 5419 kind of ATOM. 5420 ATOM Scalar coarray or coindexed variable of either 5421 integer type with 'ATOMIC_INT_KIND' kind or 5422 logical type with 'ATOMIC_LOGICAL_KIND' kind. 5423 5424_Example_: 5425 program atomic 5426 use iso_fortran_env 5427 logical(atomic_logical_kind) :: atom[*] 5428 logical :: val 5429 call atomic_ref (atom, .false.) 5430 ! ... 5431 call atomic_ref (atom, val) 5432 if (val) then 5433 print *, "Obtained" 5434 end if 5435 end program atomic 5436 5437_See also_: 5438 *note ATOMIC_DEFINE::, *note ISO_FORTRAN_ENV:: 5439 5440 5441File: gfortran.info, Node: BACKTRACE, Next: BESSEL_J0, Prev: ATOMIC_REF, Up: Intrinsic Procedures 5442 54438.26 'BACKTRACE' -- Show a backtrace 5444==================================== 5445 5446_Description_: 5447 'BACKTRACE' shows a backtrace at an arbitrary place in user code. 5448 Program execution continues normally afterwards. The backtrace 5449 information is printed to the unit corresponding to 'ERROR_UNIT' in 5450 'ISO_FORTRAN_ENV'. 5451 5452_Standard_: 5453 GNU Extension 5454 5455_Class_: 5456 Subroutine 5457 5458_Syntax_: 5459 'CALL BACKTRACE' 5460 5461_Arguments_: 5462 None 5463 5464_See also_: 5465 *note ABORT:: 5466 5467 5468File: gfortran.info, Node: BESSEL_J0, Next: BESSEL_J1, Prev: BACKTRACE, Up: Intrinsic Procedures 5469 54708.27 'BESSEL_J0' -- Bessel function of the first kind of order 0 5471================================================================ 5472 5473_Description_: 5474 'BESSEL_J0(X)' computes the Bessel function of the first kind of 5475 order 0 of X. This function is available under the name 'BESJ0' as 5476 a GNU extension. 5477 5478_Standard_: 5479 Fortran 2008 and later 5480 5481_Class_: 5482 Elemental function 5483 5484_Syntax_: 5485 'RESULT = BESSEL_J0(X)' 5486 5487_Arguments_: 5488 X The type shall be 'REAL', and it shall be 5489 scalar. 5490 5491_Return value_: 5492 The return value is of type 'REAL' and lies in the range - 5493 0.4027... \leq Bessel (0,x) \leq 1. It has the same kind as X. 5494 5495_Example_: 5496 program test_besj0 5497 real(8) :: x = 0.0_8 5498 x = bessel_j0(x) 5499 end program test_besj0 5500 5501_Specific names_: 5502 Name Argument Return type Standard 5503 'DBESJ0(X)' 'REAL(8) X' 'REAL(8)' GNU extension 5504 5505 5506File: gfortran.info, Node: BESSEL_J1, Next: BESSEL_JN, Prev: BESSEL_J0, Up: Intrinsic Procedures 5507 55088.28 'BESSEL_J1' -- Bessel function of the first kind of order 1 5509================================================================ 5510 5511_Description_: 5512 'BESSEL_J1(X)' computes the Bessel function of the first kind of 5513 order 1 of X. This function is available under the name 'BESJ1' as 5514 a GNU extension. 5515 5516_Standard_: 5517 Fortran 2008 5518 5519_Class_: 5520 Elemental function 5521 5522_Syntax_: 5523 'RESULT = BESSEL_J1(X)' 5524 5525_Arguments_: 5526 X The type shall be 'REAL', and it shall be 5527 scalar. 5528 5529_Return value_: 5530 The return value is of type 'REAL' and it lies in the range - 5531 0.5818... \leq Bessel (0,x) \leq 0.5818 . It has the same kind as 5532 X. 5533 5534_Example_: 5535 program test_besj1 5536 real(8) :: x = 1.0_8 5537 x = bessel_j1(x) 5538 end program test_besj1 5539 5540_Specific names_: 5541 Name Argument Return type Standard 5542 'DBESJ1(X)' 'REAL(8) X' 'REAL(8)' GNU extension 5543 5544 5545File: gfortran.info, Node: BESSEL_JN, Next: BESSEL_Y0, Prev: BESSEL_J1, Up: Intrinsic Procedures 5546 55478.29 'BESSEL_JN' -- Bessel function of the first kind 5548===================================================== 5549 5550_Description_: 5551 'BESSEL_JN(N, X)' computes the Bessel function of the first kind of 5552 order N of X. This function is available under the name 'BESJN' as 5553 a GNU extension. If N and X are arrays, their ranks and shapes 5554 shall conform. 5555 5556 'BESSEL_JN(N1, N2, X)' returns an array with the Bessel functions 5557 of the first kind of the orders N1 to N2. 5558 5559_Standard_: 5560 Fortran 2008 and later, negative N is allowed as GNU extension 5561 5562_Class_: 5563 Elemental function, except for the transformational function 5564 'BESSEL_JN(N1, N2, X)' 5565 5566_Syntax_: 5567 'RESULT = BESSEL_JN(N, X)' 5568 'RESULT = BESSEL_JN(N1, N2, X)' 5569 5570_Arguments_: 5571 N Shall be a scalar or an array of type 'INTEGER'. 5572 N1 Shall be a non-negative scalar of type 5573 'INTEGER'. 5574 N2 Shall be a non-negative scalar of type 5575 'INTEGER'. 5576 X Shall be a scalar or an array of type 'REAL'; 5577 for 'BESSEL_JN(N1, N2, X)' it shall be scalar. 5578 5579_Return value_: 5580 The return value is a scalar of type 'REAL'. It has the same kind 5581 as X. 5582 5583_Note_: 5584 The transformational function uses a recurrence algorithm which 5585 might, for some values of X, lead to different results than calls 5586 to the elemental function. 5587 5588_Example_: 5589 program test_besjn 5590 real(8) :: x = 1.0_8 5591 x = bessel_jn(5,x) 5592 end program test_besjn 5593 5594_Specific names_: 5595 Name Argument Return type Standard 5596 'DBESJN(N, 'INTEGER N' 'REAL(8)' GNU extension 5597 X)' 5598 'REAL(8) X' 5599 5600 5601File: gfortran.info, Node: BESSEL_Y0, Next: BESSEL_Y1, Prev: BESSEL_JN, Up: Intrinsic Procedures 5602 56038.30 'BESSEL_Y0' -- Bessel function of the second kind of order 0 5604================================================================= 5605 5606_Description_: 5607 'BESSEL_Y0(X)' computes the Bessel function of the second kind of 5608 order 0 of X. This function is available under the name 'BESY0' as 5609 a GNU extension. 5610 5611_Standard_: 5612 Fortran 2008 and later 5613 5614_Class_: 5615 Elemental function 5616 5617_Syntax_: 5618 'RESULT = BESSEL_Y0(X)' 5619 5620_Arguments_: 5621 X The type shall be 'REAL', and it shall be 5622 scalar. 5623 5624_Return value_: 5625 The return value is a scalar of type 'REAL'. It has the same kind 5626 as X. 5627 5628_Example_: 5629 program test_besy0 5630 real(8) :: x = 0.0_8 5631 x = bessel_y0(x) 5632 end program test_besy0 5633 5634_Specific names_: 5635 Name Argument Return type Standard 5636 'DBESY0(X)' 'REAL(8) X' 'REAL(8)' GNU extension 5637 5638 5639File: gfortran.info, Node: BESSEL_Y1, Next: BESSEL_YN, Prev: BESSEL_Y0, Up: Intrinsic Procedures 5640 56418.31 'BESSEL_Y1' -- Bessel function of the second kind of order 1 5642================================================================= 5643 5644_Description_: 5645 'BESSEL_Y1(X)' computes the Bessel function of the second kind of 5646 order 1 of X. This function is available under the name 'BESY1' as 5647 a GNU extension. 5648 5649_Standard_: 5650 Fortran 2008 and later 5651 5652_Class_: 5653 Elemental function 5654 5655_Syntax_: 5656 'RESULT = BESSEL_Y1(X)' 5657 5658_Arguments_: 5659 X The type shall be 'REAL', and it shall be 5660 scalar. 5661 5662_Return value_: 5663 The return value is a scalar of type 'REAL'. It has the same kind 5664 as X. 5665 5666_Example_: 5667 program test_besy1 5668 real(8) :: x = 1.0_8 5669 x = bessel_y1(x) 5670 end program test_besy1 5671 5672_Specific names_: 5673 Name Argument Return type Standard 5674 'DBESY1(X)' 'REAL(8) X' 'REAL(8)' GNU extension 5675 5676 5677File: gfortran.info, Node: BESSEL_YN, Next: BGE, Prev: BESSEL_Y1, Up: Intrinsic Procedures 5678 56798.32 'BESSEL_YN' -- Bessel function of the second kind 5680====================================================== 5681 5682_Description_: 5683 'BESSEL_YN(N, X)' computes the Bessel function of the second kind 5684 of order N of X. This function is available under the name 'BESYN' 5685 as a GNU extension. If N and X are arrays, their ranks and shapes 5686 shall conform. 5687 5688 'BESSEL_YN(N1, N2, X)' returns an array with the Bessel functions 5689 of the first kind of the orders N1 to N2. 5690 5691_Standard_: 5692 Fortran 2008 and later, negative N is allowed as GNU extension 5693 5694_Class_: 5695 Elemental function, except for the transformational function 5696 'BESSEL_YN(N1, N2, X)' 5697 5698_Syntax_: 5699 'RESULT = BESSEL_YN(N, X)' 5700 'RESULT = BESSEL_YN(N1, N2, X)' 5701 5702_Arguments_: 5703 N Shall be a scalar or an array of type 'INTEGER' 5704 . 5705 N1 Shall be a non-negative scalar of type 5706 'INTEGER'. 5707 N2 Shall be a non-negative scalar of type 5708 'INTEGER'. 5709 X Shall be a scalar or an array of type 'REAL'; 5710 for 'BESSEL_YN(N1, N2, X)' it shall be scalar. 5711 5712_Return value_: 5713 The return value is a scalar of type 'REAL'. It has the same kind 5714 as X. 5715 5716_Note_: 5717 The transformational function uses a recurrence algorithm which 5718 might, for some values of X, lead to different results than calls 5719 to the elemental function. 5720 5721_Example_: 5722 program test_besyn 5723 real(8) :: x = 1.0_8 5724 x = bessel_yn(5,x) 5725 end program test_besyn 5726 5727_Specific names_: 5728 Name Argument Return type Standard 5729 'DBESYN(N,X)' 'INTEGER N' 'REAL(8)' GNU extension 5730 'REAL(8) X' 5731 5732 5733File: gfortran.info, Node: BGE, Next: BGT, Prev: BESSEL_YN, Up: Intrinsic Procedures 5734 57358.33 'BGE' -- Bitwise greater than or equal to 5736============================================== 5737 5738_Description_: 5739 Determines whether an integral is a bitwise greater than or equal 5740 to another. 5741 5742_Standard_: 5743 Fortran 2008 and later 5744 5745_Class_: 5746 Elemental function 5747 5748_Syntax_: 5749 'RESULT = BGE(I, J)' 5750 5751_Arguments_: 5752 I Shall be of 'INTEGER' type. 5753 J Shall be of 'INTEGER' type, and of the same kind 5754 as I. 5755 5756_Return value_: 5757 The return value is of type 'LOGICAL' and of the default kind. 5758 5759_See also_: 5760 *note BGT::, *note BLE::, *note BLT:: 5761 5762 5763File: gfortran.info, Node: BGT, Next: BIT_SIZE, Prev: BGE, Up: Intrinsic Procedures 5764 57658.34 'BGT' -- Bitwise greater than 5766================================== 5767 5768_Description_: 5769 Determines whether an integral is a bitwise greater than another. 5770 5771_Standard_: 5772 Fortran 2008 and later 5773 5774_Class_: 5775 Elemental function 5776 5777_Syntax_: 5778 'RESULT = BGT(I, J)' 5779 5780_Arguments_: 5781 I Shall be of 'INTEGER' type. 5782 J Shall be of 'INTEGER' type, and of the same kind 5783 as I. 5784 5785_Return value_: 5786 The return value is of type 'LOGICAL' and of the default kind. 5787 5788_See also_: 5789 *note BGE::, *note BLE::, *note BLT:: 5790 5791 5792File: gfortran.info, Node: BIT_SIZE, Next: BLE, Prev: BGT, Up: Intrinsic Procedures 5793 57948.35 'BIT_SIZE' -- Bit size inquiry function 5795============================================ 5796 5797_Description_: 5798 'BIT_SIZE(I)' returns the number of bits (integer precision plus 5799 sign bit) represented by the type of I. The result of 5800 'BIT_SIZE(I)' is independent of the actual value of I. 5801 5802_Standard_: 5803 Fortran 95 and later 5804 5805_Class_: 5806 Inquiry function 5807 5808_Syntax_: 5809 'RESULT = BIT_SIZE(I)' 5810 5811_Arguments_: 5812 I The type shall be 'INTEGER'. 5813 5814_Return value_: 5815 The return value is of type 'INTEGER' 5816 5817_Example_: 5818 program test_bit_size 5819 integer :: i = 123 5820 integer :: size 5821 size = bit_size(i) 5822 print *, size 5823 end program test_bit_size 5824 5825 5826File: gfortran.info, Node: BLE, Next: BLT, Prev: BIT_SIZE, Up: Intrinsic Procedures 5827 58288.36 'BLE' -- Bitwise less than or equal to 5829=========================================== 5830 5831_Description_: 5832 Determines whether an integral is a bitwise less than or equal to 5833 another. 5834 5835_Standard_: 5836 Fortran 2008 and later 5837 5838_Class_: 5839 Elemental function 5840 5841_Syntax_: 5842 'RESULT = BLE(I, J)' 5843 5844_Arguments_: 5845 I Shall be of 'INTEGER' type. 5846 J Shall be of 'INTEGER' type, and of the same kind 5847 as I. 5848 5849_Return value_: 5850 The return value is of type 'LOGICAL' and of the default kind. 5851 5852_See also_: 5853 *note BGT::, *note BGE::, *note BLT:: 5854 5855 5856File: gfortran.info, Node: BLT, Next: BTEST, Prev: BLE, Up: Intrinsic Procedures 5857 58588.37 'BLT' -- Bitwise less than 5859=============================== 5860 5861_Description_: 5862 Determines whether an integral is a bitwise less than another. 5863 5864_Standard_: 5865 Fortran 2008 and later 5866 5867_Class_: 5868 Elemental function 5869 5870_Syntax_: 5871 'RESULT = BLT(I, J)' 5872 5873_Arguments_: 5874 I Shall be of 'INTEGER' type. 5875 J Shall be of 'INTEGER' type, and of the same kind 5876 as I. 5877 5878_Return value_: 5879 The return value is of type 'LOGICAL' and of the default kind. 5880 5881_See also_: 5882 *note BGE::, *note BGT::, *note BLE:: 5883 5884 5885File: gfortran.info, Node: BTEST, Next: C_ASSOCIATED, Prev: BLT, Up: Intrinsic Procedures 5886 58878.38 'BTEST' -- Bit test function 5888================================= 5889 5890_Description_: 5891 'BTEST(I,POS)' returns logical '.TRUE.' if the bit at POS in I is 5892 set. The counting of the bits starts at 0. 5893 5894_Standard_: 5895 Fortran 95 and later 5896 5897_Class_: 5898 Elemental function 5899 5900_Syntax_: 5901 'RESULT = BTEST(I, POS)' 5902 5903_Arguments_: 5904 I The type shall be 'INTEGER'. 5905 POS The type shall be 'INTEGER'. 5906 5907_Return value_: 5908 The return value is of type 'LOGICAL' 5909 5910_Example_: 5911 program test_btest 5912 integer :: i = 32768 + 1024 + 64 5913 integer :: pos 5914 logical :: bool 5915 do pos=0,16 5916 bool = btest(i, pos) 5917 print *, pos, bool 5918 end do 5919 end program test_btest 5920 5921 5922File: gfortran.info, Node: C_ASSOCIATED, Next: C_F_POINTER, Prev: BTEST, Up: Intrinsic Procedures 5923 59248.39 'C_ASSOCIATED' -- Status of a C pointer 5925============================================ 5926 5927_Description_: 5928 'C_ASSOCIATED(c_prt_1[, c_ptr_2])' determines the status of the C 5929 pointer C_PTR_1 or if C_PTR_1 is associated with the target 5930 C_PTR_2. 5931 5932_Standard_: 5933 Fortran 2003 and later 5934 5935_Class_: 5936 Inquiry function 5937 5938_Syntax_: 5939 'RESULT = C_ASSOCIATED(c_prt_1[, c_ptr_2])' 5940 5941_Arguments_: 5942 C_PTR_1 Scalar of the type 'C_PTR' or 'C_FUNPTR'. 5943 C_PTR_2 (Optional) Scalar of the same type as C_PTR_1. 5944 5945_Return value_: 5946 The return value is of type 'LOGICAL'; it is '.false.' if either 5947 C_PTR_1 is a C NULL pointer or if C_PTR1 and C_PTR_2 point to 5948 different addresses. 5949 5950_Example_: 5951 subroutine association_test(a,b) 5952 use iso_c_binding, only: c_associated, c_loc, c_ptr 5953 implicit none 5954 real, pointer :: a 5955 type(c_ptr) :: b 5956 if(c_associated(b, c_loc(a))) & 5957 stop 'b and a do not point to same target' 5958 end subroutine association_test 5959 5960_See also_: 5961 *note C_LOC::, *note C_FUNLOC:: 5962 5963 5964File: gfortran.info, Node: C_F_POINTER, Next: C_F_PROCPOINTER, Prev: C_ASSOCIATED, Up: Intrinsic Procedures 5965 59668.40 'C_F_POINTER' -- Convert C into Fortran pointer 5967==================================================== 5968 5969_Description_: 5970 'C_F_POINTER(CPTR, FPTR[, SHAPE])' assigns the target of the C 5971 pointer CPTR to the Fortran pointer FPTR and specifies its shape. 5972 5973_Standard_: 5974 Fortran 2003 and later 5975 5976_Class_: 5977 Subroutine 5978 5979_Syntax_: 5980 'CALL C_F_POINTER(CPTR, FPTR[, SHAPE])' 5981 5982_Arguments_: 5983 CPTR scalar of the type 'C_PTR'. It is 'INTENT(IN)'. 5984 FPTR pointer interoperable with CPTR. It is 5985 'INTENT(OUT)'. 5986 SHAPE (Optional) Rank-one array of type 'INTEGER' with 5987 'INTENT(IN)'. It shall be present if and only 5988 if FPTR is an array. The size must be equal to 5989 the rank of FPTR. 5990 5991_Example_: 5992 program main 5993 use iso_c_binding 5994 implicit none 5995 interface 5996 subroutine my_routine(p) bind(c,name='myC_func') 5997 import :: c_ptr 5998 type(c_ptr), intent(out) :: p 5999 end subroutine 6000 end interface 6001 type(c_ptr) :: cptr 6002 real,pointer :: a(:) 6003 call my_routine(cptr) 6004 call c_f_pointer(cptr, a, [12]) 6005 end program main 6006 6007_See also_: 6008 *note C_LOC::, *note C_F_PROCPOINTER:: 6009 6010 6011File: gfortran.info, Node: C_F_PROCPOINTER, Next: C_FUNLOC, Prev: C_F_POINTER, Up: Intrinsic Procedures 6012 60138.41 'C_F_PROCPOINTER' -- Convert C into Fortran procedure pointer 6014================================================================== 6015 6016_Description_: 6017 'C_F_PROCPOINTER(CPTR, FPTR)' Assign the target of the C function 6018 pointer CPTR to the Fortran procedure pointer FPTR. 6019 6020_Standard_: 6021 Fortran 2003 and later 6022 6023_Class_: 6024 Subroutine 6025 6026_Syntax_: 6027 'CALL C_F_PROCPOINTER(cptr, fptr)' 6028 6029_Arguments_: 6030 CPTR scalar of the type 'C_FUNPTR'. It is 6031 'INTENT(IN)'. 6032 FPTR procedure pointer interoperable with CPTR. It 6033 is 'INTENT(OUT)'. 6034 6035_Example_: 6036 program main 6037 use iso_c_binding 6038 implicit none 6039 abstract interface 6040 function func(a) 6041 import :: c_float 6042 real(c_float), intent(in) :: a 6043 real(c_float) :: func 6044 end function 6045 end interface 6046 interface 6047 function getIterFunc() bind(c,name="getIterFunc") 6048 import :: c_funptr 6049 type(c_funptr) :: getIterFunc 6050 end function 6051 end interface 6052 type(c_funptr) :: cfunptr 6053 procedure(func), pointer :: myFunc 6054 cfunptr = getIterFunc() 6055 call c_f_procpointer(cfunptr, myFunc) 6056 end program main 6057 6058_See also_: 6059 *note C_LOC::, *note C_F_POINTER:: 6060 6061 6062File: gfortran.info, Node: C_FUNLOC, Next: C_LOC, Prev: C_F_PROCPOINTER, Up: Intrinsic Procedures 6063 60648.42 'C_FUNLOC' -- Obtain the C address of a procedure 6065====================================================== 6066 6067_Description_: 6068 'C_FUNLOC(x)' determines the C address of the argument. 6069 6070_Standard_: 6071 Fortran 2003 and later 6072 6073_Class_: 6074 Inquiry function 6075 6076_Syntax_: 6077 'RESULT = C_FUNLOC(x)' 6078 6079_Arguments_: 6080 X Interoperable function or pointer to such 6081 function. 6082 6083_Return value_: 6084 The return value is of type 'C_FUNPTR' and contains the C address 6085 of the argument. 6086 6087_Example_: 6088 module x 6089 use iso_c_binding 6090 implicit none 6091 contains 6092 subroutine sub(a) bind(c) 6093 real(c_float) :: a 6094 a = sqrt(a)+5.0 6095 end subroutine sub 6096 end module x 6097 program main 6098 use iso_c_binding 6099 use x 6100 implicit none 6101 interface 6102 subroutine my_routine(p) bind(c,name='myC_func') 6103 import :: c_funptr 6104 type(c_funptr), intent(in) :: p 6105 end subroutine 6106 end interface 6107 call my_routine(c_funloc(sub)) 6108 end program main 6109 6110_See also_: 6111 *note C_ASSOCIATED::, *note C_LOC::, *note C_F_POINTER::, *note 6112 C_F_PROCPOINTER:: 6113 6114 6115File: gfortran.info, Node: C_LOC, Next: C_SIZEOF, Prev: C_FUNLOC, Up: Intrinsic Procedures 6116 61178.43 'C_LOC' -- Obtain the C address of an object 6118================================================= 6119 6120_Description_: 6121 'C_LOC(X)' determines the C address of the argument. 6122 6123_Standard_: 6124 Fortran 2003 and later 6125 6126_Class_: 6127 Inquiry function 6128 6129_Syntax_: 6130 'RESULT = C_LOC(X)' 6131 6132_Arguments_: 6133 X Shall have either the POINTER or TARGET attribute. 6134 It shall not be a coindexed object. It shall either 6135 be a variable with interoperable type and kind type 6136 parameters, or be a scalar, nonpolymorphic variable 6137 with no length type parameters. 6138 6139 6140_Return value_: 6141 The return value is of type 'C_PTR' and contains the C address of 6142 the argument. 6143 6144_Example_: 6145 subroutine association_test(a,b) 6146 use iso_c_binding, only: c_associated, c_loc, c_ptr 6147 implicit none 6148 real, pointer :: a 6149 type(c_ptr) :: b 6150 if(c_associated(b, c_loc(a))) & 6151 stop 'b and a do not point to same target' 6152 end subroutine association_test 6153 6154_See also_: 6155 *note C_ASSOCIATED::, *note C_FUNLOC::, *note C_F_POINTER::, *note 6156 C_F_PROCPOINTER:: 6157 6158 6159File: gfortran.info, Node: C_SIZEOF, Next: CEILING, Prev: C_LOC, Up: Intrinsic Procedures 6160 61618.44 'C_SIZEOF' -- Size in bytes of an expression 6162================================================= 6163 6164_Description_: 6165 'C_SIZEOF(X)' calculates the number of bytes of storage the 6166 expression 'X' occupies. 6167 6168_Standard_: 6169 Fortran 2008 6170 6171_Class_: 6172 Inquiry function of the module 'ISO_C_BINDING' 6173 6174_Syntax_: 6175 'N = C_SIZEOF(X)' 6176 6177_Arguments_: 6178 X The argument shall be an interoperable data 6179 entity. 6180 6181_Return value_: 6182 The return value is of type integer and of the system-dependent 6183 kind 'C_SIZE_T' (from the 'ISO_C_BINDING' module). Its value is 6184 the number of bytes occupied by the argument. If the argument has 6185 the 'POINTER' attribute, the number of bytes of the storage area 6186 pointed to is returned. If the argument is of a derived type with 6187 'POINTER' or 'ALLOCATABLE' components, the return value does not 6188 account for the sizes of the data pointed to by these components. 6189 6190_Example_: 6191 use iso_c_binding 6192 integer(c_int) :: i 6193 real(c_float) :: r, s(5) 6194 print *, (c_sizeof(s)/c_sizeof(r) == 5) 6195 end 6196 The example will print '.TRUE.' unless you are using a platform 6197 where default 'REAL' variables are unusually padded. 6198 6199_See also_: 6200 *note SIZEOF::, *note STORAGE_SIZE:: 6201 6202 6203File: gfortran.info, Node: CEILING, Next: CHAR, Prev: C_SIZEOF, Up: Intrinsic Procedures 6204 62058.45 'CEILING' -- Integer ceiling function 6206========================================== 6207 6208_Description_: 6209 'CEILING(A)' returns the least integer greater than or equal to A. 6210 6211_Standard_: 6212 Fortran 95 and later 6213 6214_Class_: 6215 Elemental function 6216 6217_Syntax_: 6218 'RESULT = CEILING(A [, KIND])' 6219 6220_Arguments_: 6221 A The type shall be 'REAL'. 6222 KIND (Optional) An 'INTEGER' initialization 6223 expression indicating the kind parameter of the 6224 result. 6225 6226_Return value_: 6227 The return value is of type 'INTEGER(KIND)' if KIND is present and 6228 a default-kind 'INTEGER' otherwise. 6229 6230_Example_: 6231 program test_ceiling 6232 real :: x = 63.29 6233 real :: y = -63.59 6234 print *, ceiling(x) ! returns 64 6235 print *, ceiling(y) ! returns -63 6236 end program test_ceiling 6237 6238_See also_: 6239 *note FLOOR::, *note NINT:: 6240 6241 6242File: gfortran.info, Node: CHAR, Next: CHDIR, Prev: CEILING, Up: Intrinsic Procedures 6243 62448.46 'CHAR' -- Character conversion function 6245============================================ 6246 6247_Description_: 6248 'CHAR(I [, KIND])' returns the character represented by the integer 6249 I. 6250 6251_Standard_: 6252 Fortran 77 and later 6253 6254_Class_: 6255 Elemental function 6256 6257_Syntax_: 6258 'RESULT = CHAR(I [, KIND])' 6259 6260_Arguments_: 6261 I The type shall be 'INTEGER'. 6262 KIND (Optional) An 'INTEGER' initialization 6263 expression indicating the kind parameter of the 6264 result. 6265 6266_Return value_: 6267 The return value is of type 'CHARACTER(1)' 6268 6269_Example_: 6270 program test_char 6271 integer :: i = 74 6272 character(1) :: c 6273 c = char(i) 6274 print *, i, c ! returns 'J' 6275 end program test_char 6276 6277_Specific names_: 6278 Name Argument Return type Standard 6279 'CHAR(I)' 'INTEGER I' 'CHARACTER(LEN=1)'F77 and later 6280 6281_Note_: 6282 See *note ICHAR:: for a discussion of converting between numerical 6283 values and formatted string representations. 6284 6285_See also_: 6286 *note ACHAR::, *note IACHAR::, *note ICHAR:: 6287 6288 6289File: gfortran.info, Node: CHDIR, Next: CHMOD, Prev: CHAR, Up: Intrinsic Procedures 6290 62918.47 'CHDIR' -- Change working directory 6292======================================== 6293 6294_Description_: 6295 Change current working directory to a specified path. 6296 6297 This intrinsic is provided in both subroutine and function forms; 6298 however, only one form can be used in any given program unit. 6299 6300_Standard_: 6301 GNU extension 6302 6303_Class_: 6304 Subroutine, function 6305 6306_Syntax_: 6307 'CALL CHDIR(NAME [, STATUS])' 6308 'STATUS = CHDIR(NAME)' 6309 6310_Arguments_: 6311 NAME The type shall be 'CHARACTER' of default kind 6312 and shall specify a valid path within the file 6313 system. 6314 STATUS (Optional) 'INTEGER' status flag of the default 6315 kind. Returns 0 on success, and a system 6316 specific and nonzero error code otherwise. 6317 6318_Example_: 6319 PROGRAM test_chdir 6320 CHARACTER(len=255) :: path 6321 CALL getcwd(path) 6322 WRITE(*,*) TRIM(path) 6323 CALL chdir("/tmp") 6324 CALL getcwd(path) 6325 WRITE(*,*) TRIM(path) 6326 END PROGRAM 6327 6328_See also_: 6329 *note GETCWD:: 6330 6331 6332File: gfortran.info, Node: CHMOD, Next: CMPLX, Prev: CHDIR, Up: Intrinsic Procedures 6333 63348.48 'CHMOD' -- Change access permissions of files 6335================================================== 6336 6337_Description_: 6338 'CHMOD' changes the permissions of a file. 6339 6340 This intrinsic is provided in both subroutine and function forms; 6341 however, only one form can be used in any given program unit. 6342 6343_Standard_: 6344 GNU extension 6345 6346_Class_: 6347 Subroutine, function 6348 6349_Syntax_: 6350 'CALL CHMOD(NAME, MODE[, STATUS])' 6351 'STATUS = CHMOD(NAME, MODE)' 6352 6353_Arguments_: 6354 6355 NAME Scalar 'CHARACTER' of default kind with the file 6356 name. Trailing blanks are ignored unless the 6357 character 'achar(0)' is present, then all 6358 characters up to and excluding 'achar(0)' are 6359 used as the file name. 6360 6361 MODE Scalar 'CHARACTER' of default kind giving the 6362 file permission. MODE uses the same syntax as 6363 the 'chmod' utility as defined by the POSIX 6364 standard. The argument shall either be a string 6365 of a nonnegative octal number or a symbolic 6366 mode. 6367 6368 STATUS (optional) scalar 'INTEGER', which is '0' on 6369 success and nonzero otherwise. 6370 6371_Return value_: 6372 In either syntax, STATUS is set to '0' on success and nonzero 6373 otherwise. 6374 6375_Example_: 6376 'CHMOD' as subroutine 6377 program chmod_test 6378 implicit none 6379 integer :: status 6380 call chmod('test.dat','u+x',status) 6381 print *, 'Status: ', status 6382 end program chmod_test 6383 'CHMOD' as function: 6384 program chmod_test 6385 implicit none 6386 integer :: status 6387 status = chmod('test.dat','u+x') 6388 print *, 'Status: ', status 6389 end program chmod_test 6390 6391 6392File: gfortran.info, Node: CMPLX, Next: COMMAND_ARGUMENT_COUNT, Prev: CHMOD, Up: Intrinsic Procedures 6393 63948.49 'CMPLX' -- Complex conversion function 6395=========================================== 6396 6397_Description_: 6398 'CMPLX(X [, Y [, KIND]])' returns a complex number where X is 6399 converted to the real component. If Y is present it is converted 6400 to the imaginary component. If Y is not present then the imaginary 6401 component is set to 0.0. If X is complex then Y must not be 6402 present. 6403 6404_Standard_: 6405 Fortran 77 and later 6406 6407_Class_: 6408 Elemental function 6409 6410_Syntax_: 6411 'RESULT = CMPLX(X [, Y [, KIND]])' 6412 6413_Arguments_: 6414 X The type may be 'INTEGER', 'REAL', or 'COMPLEX'. 6415 Y (Optional; only allowed if X is not 'COMPLEX'.) 6416 May be 'INTEGER' or 'REAL'. 6417 KIND (Optional) An 'INTEGER' initialization 6418 expression indicating the kind parameter of the 6419 result. 6420 6421_Return value_: 6422 The return value is of 'COMPLEX' type, with a kind equal to KIND if 6423 it is specified. If KIND is not specified, the result is of the 6424 default 'COMPLEX' kind, regardless of the kinds of X and Y. 6425 6426_Example_: 6427 program test_cmplx 6428 integer :: i = 42 6429 real :: x = 3.14 6430 complex :: z 6431 z = cmplx(i, x) 6432 print *, z, cmplx(x) 6433 end program test_cmplx 6434 6435_See also_: 6436 *note COMPLEX:: 6437 6438 6439File: gfortran.info, Node: COMMAND_ARGUMENT_COUNT, Next: COMPILER_OPTIONS, Prev: CMPLX, Up: Intrinsic Procedures 6440 64418.50 'COMMAND_ARGUMENT_COUNT' -- Get number of command line arguments 6442===================================================================== 6443 6444_Description_: 6445 'COMMAND_ARGUMENT_COUNT' returns the number of arguments passed on 6446 the command line when the containing program was invoked. 6447 6448_Standard_: 6449 Fortran 2003 and later 6450 6451_Class_: 6452 Inquiry function 6453 6454_Syntax_: 6455 'RESULT = COMMAND_ARGUMENT_COUNT()' 6456 6457_Arguments_: 6458 None 6459 6460_Return value_: 6461 The return value is an 'INTEGER' of default kind. 6462 6463_Example_: 6464 program test_command_argument_count 6465 integer :: count 6466 count = command_argument_count() 6467 print *, count 6468 end program test_command_argument_count 6469 6470_See also_: 6471 *note GET_COMMAND::, *note GET_COMMAND_ARGUMENT:: 6472 6473 6474File: gfortran.info, Node: COMPILER_OPTIONS, Next: COMPILER_VERSION, Prev: COMMAND_ARGUMENT_COUNT, Up: Intrinsic Procedures 6475 64768.51 'COMPILER_OPTIONS' -- Options passed to the compiler 6477========================================================= 6478 6479_Description_: 6480 'COMPILER_OPTIONS' returns a string with the options used for 6481 compiling. 6482 6483_Standard_: 6484 Fortran 2008 6485 6486_Class_: 6487 Inquiry function of the module 'ISO_FORTRAN_ENV' 6488 6489_Syntax_: 6490 'STR = COMPILER_OPTIONS()' 6491 6492_Arguments_: 6493 None. 6494 6495_Return value_: 6496 The return value is a default-kind string with system-dependent 6497 length. It contains the compiler flags used to compile the file, 6498 which called the 'COMPILER_OPTIONS' intrinsic. 6499 6500_Example_: 6501 use iso_fortran_env 6502 print '(4a)', 'This file was compiled by ', & 6503 compiler_version(), ' using the options ', & 6504 compiler_options() 6505 end 6506 6507_See also_: 6508 *note COMPILER_VERSION::, *note ISO_FORTRAN_ENV:: 6509 6510 6511File: gfortran.info, Node: COMPILER_VERSION, Next: COMPLEX, Prev: COMPILER_OPTIONS, Up: Intrinsic Procedures 6512 65138.52 'COMPILER_VERSION' -- Compiler version string 6514================================================== 6515 6516_Description_: 6517 'COMPILER_VERSION' returns a string with the name and the version 6518 of the compiler. 6519 6520_Standard_: 6521 Fortran 2008 6522 6523_Class_: 6524 Inquiry function of the module 'ISO_FORTRAN_ENV' 6525 6526_Syntax_: 6527 'STR = COMPILER_VERSION()' 6528 6529_Arguments_: 6530 None. 6531 6532_Return value_: 6533 The return value is a default-kind string with system-dependent 6534 length. It contains the name of the compiler and its version 6535 number. 6536 6537_Example_: 6538 use iso_fortran_env 6539 print '(4a)', 'This file was compiled by ', & 6540 compiler_version(), ' using the options ', & 6541 compiler_options() 6542 end 6543 6544_See also_: 6545 *note COMPILER_OPTIONS::, *note ISO_FORTRAN_ENV:: 6546 6547 6548File: gfortran.info, Node: COMPLEX, Next: CONJG, Prev: COMPILER_VERSION, Up: Intrinsic Procedures 6549 65508.53 'COMPLEX' -- Complex conversion function 6551============================================= 6552 6553_Description_: 6554 'COMPLEX(X, Y)' returns a complex number where X is converted to 6555 the real component and Y is converted to the imaginary component. 6556 6557_Standard_: 6558 GNU extension 6559 6560_Class_: 6561 Elemental function 6562 6563_Syntax_: 6564 'RESULT = COMPLEX(X, Y)' 6565 6566_Arguments_: 6567 X The type may be 'INTEGER' or 'REAL'. 6568 Y The type may be 'INTEGER' or 'REAL'. 6569 6570_Return value_: 6571 If X and Y are both of 'INTEGER' type, then the return value is of 6572 default 'COMPLEX' type. 6573 6574 If X and Y are of 'REAL' type, or one is of 'REAL' type and one is 6575 of 'INTEGER' type, then the return value is of 'COMPLEX' type with 6576 a kind equal to that of the 'REAL' argument with the highest 6577 precision. 6578 6579_Example_: 6580 program test_complex 6581 integer :: i = 42 6582 real :: x = 3.14 6583 print *, complex(i, x) 6584 end program test_complex 6585 6586_See also_: 6587 *note CMPLX:: 6588 6589 6590File: gfortran.info, Node: CONJG, Next: COS, Prev: COMPLEX, Up: Intrinsic Procedures 6591 65928.54 'CONJG' -- Complex conjugate function 6593========================================== 6594 6595_Description_: 6596 'CONJG(Z)' returns the conjugate of Z. If Z is '(x, y)' then the 6597 result is '(x, -y)' 6598 6599_Standard_: 6600 Fortran 77 and later, has overloads that are GNU extensions 6601 6602_Class_: 6603 Elemental function 6604 6605_Syntax_: 6606 'Z = CONJG(Z)' 6607 6608_Arguments_: 6609 Z The type shall be 'COMPLEX'. 6610 6611_Return value_: 6612 The return value is of type 'COMPLEX'. 6613 6614_Example_: 6615 program test_conjg 6616 complex :: z = (2.0, 3.0) 6617 complex(8) :: dz = (2.71_8, -3.14_8) 6618 z= conjg(z) 6619 print *, z 6620 dz = dconjg(dz) 6621 print *, dz 6622 end program test_conjg 6623 6624_Specific names_: 6625 Name Argument Return type Standard 6626 'CONJG(Z)' 'COMPLEX Z' 'COMPLEX' GNU extension 6627 'DCONJG(Z)' 'COMPLEX(8) 'COMPLEX(8)' GNU extension 6628 Z' 6629 6630 6631File: gfortran.info, Node: COS, Next: COSH, Prev: CONJG, Up: Intrinsic Procedures 6632 66338.55 'COS' -- Cosine function 6634============================= 6635 6636_Description_: 6637 'COS(X)' computes the cosine of X. 6638 6639_Standard_: 6640 Fortran 77 and later, has overloads that are GNU extensions 6641 6642_Class_: 6643 Elemental function 6644 6645_Syntax_: 6646 'RESULT = COS(X)' 6647 6648_Arguments_: 6649 X The type shall be 'REAL' or 'COMPLEX'. 6650 6651_Return value_: 6652 The return value is of the same type and kind as X. The real part 6653 of the result is in radians. If X is of the type 'REAL', the 6654 return value lies in the range -1 \leq \cos (x) \leq 1. 6655 6656_Example_: 6657 program test_cos 6658 real :: x = 0.0 6659 x = cos(x) 6660 end program test_cos 6661 6662_Specific names_: 6663 Name Argument Return type Standard 6664 'COS(X)' 'REAL(4) X' 'REAL(4)' Fortran 77 and 6665 later 6666 'DCOS(X)' 'REAL(8) X' 'REAL(8)' Fortran 77 and 6667 later 6668 'CCOS(X)' 'COMPLEX(4) 'COMPLEX(4)' Fortran 77 and 6669 X' later 6670 'ZCOS(X)' 'COMPLEX(8) 'COMPLEX(8)' GNU extension 6671 X' 6672 'CDCOS(X)' 'COMPLEX(8) 'COMPLEX(8)' GNU extension 6673 X' 6674 6675_See also_: 6676 Inverse function: *note ACOS:: 6677 6678 6679File: gfortran.info, Node: COSH, Next: COUNT, Prev: COS, Up: Intrinsic Procedures 6680 66818.56 'COSH' -- Hyperbolic cosine function 6682========================================= 6683 6684_Description_: 6685 'COSH(X)' computes the hyperbolic cosine of X. 6686 6687_Standard_: 6688 Fortran 77 and later, for a complex argument Fortran 2008 or later 6689 6690_Class_: 6691 Elemental function 6692 6693_Syntax_: 6694 'X = COSH(X)' 6695 6696_Arguments_: 6697 X The type shall be 'REAL' or 'COMPLEX'. 6698 6699_Return value_: 6700 The return value has same type and kind as X. If X is complex, the 6701 imaginary part of the result is in radians. If X is 'REAL', the 6702 return value has a lower bound of one, \cosh (x) \geq 1. 6703 6704_Example_: 6705 program test_cosh 6706 real(8) :: x = 1.0_8 6707 x = cosh(x) 6708 end program test_cosh 6709 6710_Specific names_: 6711 Name Argument Return type Standard 6712 'COSH(X)' 'REAL(4) X' 'REAL(4)' Fortran 77 and 6713 later 6714 'DCOSH(X)' 'REAL(8) X' 'REAL(8)' Fortran 77 and 6715 later 6716 6717_See also_: 6718 Inverse function: *note ACOSH:: 6719 6720 6721File: gfortran.info, Node: COUNT, Next: CPU_TIME, Prev: COSH, Up: Intrinsic Procedures 6722 67238.57 'COUNT' -- Count function 6724============================== 6725 6726_Description_: 6727 6728 Counts the number of '.TRUE.' elements in a logical MASK, or, if 6729 the DIM argument is supplied, counts the number of elements along 6730 each row of the array in the DIM direction. If the array has zero 6731 size, or all of the elements of MASK are '.FALSE.', then the result 6732 is '0'. 6733 6734_Standard_: 6735 Fortran 95 and later, with KIND argument Fortran 2003 and later 6736 6737_Class_: 6738 Transformational function 6739 6740_Syntax_: 6741 'RESULT = COUNT(MASK [, DIM, KIND])' 6742 6743_Arguments_: 6744 MASK The type shall be 'LOGICAL'. 6745 DIM (Optional) The type shall be 'INTEGER'. 6746 KIND (Optional) An 'INTEGER' initialization 6747 expression indicating the kind parameter of the 6748 result. 6749 6750_Return value_: 6751 The return value is of type 'INTEGER' and of kind KIND. If KIND is 6752 absent, the return value is of default integer kind. If DIM is 6753 present, the result is an array with a rank one less than the rank 6754 of ARRAY, and a size corresponding to the shape of ARRAY with the 6755 DIM dimension removed. 6756 6757_Example_: 6758 program test_count 6759 integer, dimension(2,3) :: a, b 6760 logical, dimension(2,3) :: mask 6761 a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /)) 6762 b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /)) 6763 print '(3i3)', a(1,:) 6764 print '(3i3)', a(2,:) 6765 print * 6766 print '(3i3)', b(1,:) 6767 print '(3i3)', b(2,:) 6768 print * 6769 mask = a.ne.b 6770 print '(3l3)', mask(1,:) 6771 print '(3l3)', mask(2,:) 6772 print * 6773 print '(3i3)', count(mask) 6774 print * 6775 print '(3i3)', count(mask, 1) 6776 print * 6777 print '(3i3)', count(mask, 2) 6778 end program test_count 6779 6780 6781File: gfortran.info, Node: CPU_TIME, Next: CSHIFT, Prev: COUNT, Up: Intrinsic Procedures 6782 67838.58 'CPU_TIME' -- CPU elapsed time in seconds 6784============================================== 6785 6786_Description_: 6787 Returns a 'REAL' value representing the elapsed CPU time in 6788 seconds. This is useful for testing segments of code to determine 6789 execution time. 6790 6791 If a time source is available, time will be reported with 6792 microsecond resolution. If no time source is available, TIME is 6793 set to '-1.0'. 6794 6795 Note that TIME may contain a, system dependent, arbitrary offset 6796 and may not start with '0.0'. For 'CPU_TIME', the absolute value 6797 is meaningless, only differences between subsequent calls to this 6798 subroutine, as shown in the example below, should be used. 6799 6800_Standard_: 6801 Fortran 95 and later 6802 6803_Class_: 6804 Subroutine 6805 6806_Syntax_: 6807 'CALL CPU_TIME(TIME)' 6808 6809_Arguments_: 6810 TIME The type shall be 'REAL' with 'INTENT(OUT)'. 6811 6812_Return value_: 6813 None 6814 6815_Example_: 6816 program test_cpu_time 6817 real :: start, finish 6818 call cpu_time(start) 6819 ! put code to test here 6820 call cpu_time(finish) 6821 print '("Time = ",f6.3," seconds.")',finish-start 6822 end program test_cpu_time 6823 6824_See also_: 6825 *note SYSTEM_CLOCK::, *note DATE_AND_TIME:: 6826 6827 6828File: gfortran.info, Node: CSHIFT, Next: CTIME, Prev: CPU_TIME, Up: Intrinsic Procedures 6829 68308.59 'CSHIFT' -- Circular shift elements of an array 6831==================================================== 6832 6833_Description_: 6834 'CSHIFT(ARRAY, SHIFT [, DIM])' performs a circular shift on 6835 elements of ARRAY along the dimension of DIM. If DIM is omitted it 6836 is taken to be '1'. DIM is a scalar of type 'INTEGER' in the range 6837 of 1 \leq DIM \leq n) where n is the rank of ARRAY. If the rank of 6838 ARRAY is one, then all elements of ARRAY are shifted by SHIFT 6839 places. If rank is greater than one, then all complete rank one 6840 sections of ARRAY along the given dimension are shifted. Elements 6841 shifted out one end of each rank one section are shifted back in 6842 the other end. 6843 6844_Standard_: 6845 Fortran 95 and later 6846 6847_Class_: 6848 Transformational function 6849 6850_Syntax_: 6851 'RESULT = CSHIFT(ARRAY, SHIFT [, DIM])' 6852 6853_Arguments_: 6854 ARRAY Shall be an array of any type. 6855 SHIFT The type shall be 'INTEGER'. 6856 DIM The type shall be 'INTEGER'. 6857 6858_Return value_: 6859 Returns an array of same type and rank as the ARRAY argument. 6860 6861_Example_: 6862 program test_cshift 6863 integer, dimension(3,3) :: a 6864 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /)) 6865 print '(3i3)', a(1,:) 6866 print '(3i3)', a(2,:) 6867 print '(3i3)', a(3,:) 6868 a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2) 6869 print * 6870 print '(3i3)', a(1,:) 6871 print '(3i3)', a(2,:) 6872 print '(3i3)', a(3,:) 6873 end program test_cshift 6874 6875 6876File: gfortran.info, Node: CTIME, Next: DATE_AND_TIME, Prev: CSHIFT, Up: Intrinsic Procedures 6877 68788.60 'CTIME' -- Convert a time into a string 6879============================================ 6880 6881_Description_: 6882 'CTIME' converts a system time value, such as returned by 'TIME8', 6883 to a string. The output will be of the form 'Sat Aug 19 18:13:14 6884 1995'. 6885 6886 This intrinsic is provided in both subroutine and function forms; 6887 however, only one form can be used in any given program unit. 6888 6889_Standard_: 6890 GNU extension 6891 6892_Class_: 6893 Subroutine, function 6894 6895_Syntax_: 6896 'CALL CTIME(TIME, RESULT)'. 6897 'RESULT = CTIME(TIME)'. 6898 6899_Arguments_: 6900 TIME The type shall be of type 'INTEGER'. 6901 RESULT The type shall be of type 'CHARACTER' and of 6902 default kind. It is an 'INTENT(OUT)' argument. 6903 If the length of this variable is too short for 6904 the time and date string to fit completely, it 6905 will be blank on procedure return. 6906 6907_Return value_: 6908 The converted date and time as a string. 6909 6910_Example_: 6911 program test_ctime 6912 integer(8) :: i 6913 character(len=30) :: date 6914 i = time8() 6915 6916 ! Do something, main part of the program 6917 6918 call ctime(i,date) 6919 print *, 'Program was started on ', date 6920 end program test_ctime 6921 6922_See Also_: 6923 *note DATE_AND_TIME::, *note GMTIME::, *note LTIME::, *note TIME::, 6924 *note TIME8:: 6925 6926 6927File: gfortran.info, Node: DATE_AND_TIME, Next: DBLE, Prev: CTIME, Up: Intrinsic Procedures 6928 69298.61 'DATE_AND_TIME' -- Date and time subroutine 6930================================================ 6931 6932_Description_: 6933 'DATE_AND_TIME(DATE, TIME, ZONE, VALUES)' gets the corresponding 6934 date and time information from the real-time system clock. DATE is 6935 'INTENT(OUT)' and has form ccyymmdd. TIME is 'INTENT(OUT)' and has 6936 form hhmmss.sss. ZONE is 'INTENT(OUT)' and has form (+-)hhmm, 6937 representing the difference with respect to Coordinated Universal 6938 Time (UTC). Unavailable time and date parameters return blanks. 6939 6940 VALUES is 'INTENT(OUT)' and provides the following: 6941 6942 'VALUE(1)': The year 6943 'VALUE(2)': The month 6944 'VALUE(3)': The day of the month 6945 'VALUE(4)': Time difference with UTC in 6946 minutes 6947 'VALUE(5)': The hour of the day 6948 'VALUE(6)': The minutes of the hour 6949 'VALUE(7)': The seconds of the minute 6950 'VALUE(8)': The milliseconds of the 6951 second 6952 6953_Standard_: 6954 Fortran 95 and later 6955 6956_Class_: 6957 Subroutine 6958 6959_Syntax_: 6960 'CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])' 6961 6962_Arguments_: 6963 DATE (Optional) The type shall be 'CHARACTER(LEN=8)' 6964 or larger, and of default kind. 6965 TIME (Optional) The type shall be 'CHARACTER(LEN=10)' 6966 or larger, and of default kind. 6967 ZONE (Optional) The type shall be 'CHARACTER(LEN=5)' 6968 or larger, and of default kind. 6969 VALUES (Optional) The type shall be 'INTEGER(8)'. 6970 6971_Return value_: 6972 None 6973 6974_Example_: 6975 program test_time_and_date 6976 character(8) :: date 6977 character(10) :: time 6978 character(5) :: zone 6979 integer,dimension(8) :: values 6980 ! using keyword arguments 6981 call date_and_time(date,time,zone,values) 6982 call date_and_time(DATE=date,ZONE=zone) 6983 call date_and_time(TIME=time) 6984 call date_and_time(VALUES=values) 6985 print '(a,2x,a,2x,a)', date, time, zone 6986 print '(8i5)', values 6987 end program test_time_and_date 6988 6989_See also_: 6990 *note CPU_TIME::, *note SYSTEM_CLOCK:: 6991 6992 6993File: gfortran.info, Node: DBLE, Next: DCMPLX, Prev: DATE_AND_TIME, Up: Intrinsic Procedures 6994 69958.62 'DBLE' -- Double conversion function 6996========================================= 6997 6998_Description_: 6999 'DBLE(A)' Converts A to double precision real type. 7000 7001_Standard_: 7002 Fortran 77 and later 7003 7004_Class_: 7005 Elemental function 7006 7007_Syntax_: 7008 'RESULT = DBLE(A)' 7009 7010_Arguments_: 7011 A The type shall be 'INTEGER', 'REAL', or 7012 'COMPLEX'. 7013 7014_Return value_: 7015 The return value is of type double precision real. 7016 7017_Example_: 7018 program test_dble 7019 real :: x = 2.18 7020 integer :: i = 5 7021 complex :: z = (2.3,1.14) 7022 print *, dble(x), dble(i), dble(z) 7023 end program test_dble 7024 7025_See also_: 7026 *note REAL:: 7027 7028 7029File: gfortran.info, Node: DCMPLX, Next: DIGITS, Prev: DBLE, Up: Intrinsic Procedures 7030 70318.63 'DCMPLX' -- Double complex conversion function 7032=================================================== 7033 7034_Description_: 7035 'DCMPLX(X [,Y])' returns a double complex number where X is 7036 converted to the real component. If Y is present it is converted 7037 to the imaginary component. If Y is not present then the imaginary 7038 component is set to 0.0. If X is complex then Y must not be 7039 present. 7040 7041_Standard_: 7042 GNU extension 7043 7044_Class_: 7045 Elemental function 7046 7047_Syntax_: 7048 'RESULT = DCMPLX(X [, Y])' 7049 7050_Arguments_: 7051 X The type may be 'INTEGER', 'REAL', or 'COMPLEX'. 7052 Y (Optional if X is not 'COMPLEX'.) May be 7053 'INTEGER' or 'REAL'. 7054 7055_Return value_: 7056 The return value is of type 'COMPLEX(8)' 7057 7058_Example_: 7059 program test_dcmplx 7060 integer :: i = 42 7061 real :: x = 3.14 7062 complex :: z 7063 z = cmplx(i, x) 7064 print *, dcmplx(i) 7065 print *, dcmplx(x) 7066 print *, dcmplx(z) 7067 print *, dcmplx(x,i) 7068 end program test_dcmplx 7069 7070 7071File: gfortran.info, Node: DIGITS, Next: DIM, Prev: DCMPLX, Up: Intrinsic Procedures 7072 70738.64 'DIGITS' -- Significant binary digits function 7074=================================================== 7075 7076_Description_: 7077 'DIGITS(X)' returns the number of significant binary digits of the 7078 internal model representation of X. For example, on a system using 7079 a 32-bit floating point representation, a default real number would 7080 likely return 24. 7081 7082_Standard_: 7083 Fortran 95 and later 7084 7085_Class_: 7086 Inquiry function 7087 7088_Syntax_: 7089 'RESULT = DIGITS(X)' 7090 7091_Arguments_: 7092 X The type may be 'INTEGER' or 'REAL'. 7093 7094_Return value_: 7095 The return value is of type 'INTEGER'. 7096 7097_Example_: 7098 program test_digits 7099 integer :: i = 12345 7100 real :: x = 3.143 7101 real(8) :: y = 2.33 7102 print *, digits(i) 7103 print *, digits(x) 7104 print *, digits(y) 7105 end program test_digits 7106 7107 7108File: gfortran.info, Node: DIM, Next: DOT_PRODUCT, Prev: DIGITS, Up: Intrinsic Procedures 7109 71108.65 'DIM' -- Positive difference 7111================================= 7112 7113_Description_: 7114 'DIM(X,Y)' returns the difference 'X-Y' if the result is positive; 7115 otherwise returns zero. 7116 7117_Standard_: 7118 Fortran 77 and later 7119 7120_Class_: 7121 Elemental function 7122 7123_Syntax_: 7124 'RESULT = DIM(X, Y)' 7125 7126_Arguments_: 7127 X The type shall be 'INTEGER' or 'REAL' 7128 Y The type shall be the same type and kind as X. 7129 7130_Return value_: 7131 The return value is of type 'INTEGER' or 'REAL'. 7132 7133_Example_: 7134 program test_dim 7135 integer :: i 7136 real(8) :: x 7137 i = dim(4, 15) 7138 x = dim(4.345_8, 2.111_8) 7139 print *, i 7140 print *, x 7141 end program test_dim 7142 7143_Specific names_: 7144 Name Argument Return type Standard 7145 'DIM(X,Y)' 'REAL(4) X, 'REAL(4)' Fortran 77 and 7146 Y' later 7147 'IDIM(X,Y)' 'INTEGER(4) 'INTEGER(4)' Fortran 77 and 7148 X, Y' later 7149 'DDIM(X,Y)' 'REAL(8) X, 'REAL(8)' Fortran 77 and 7150 Y' later 7151 7152 7153File: gfortran.info, Node: DOT_PRODUCT, Next: DPROD, Prev: DIM, Up: Intrinsic Procedures 7154 71558.66 'DOT_PRODUCT' -- Dot product function 7156========================================== 7157 7158_Description_: 7159 'DOT_PRODUCT(VECTOR_A, VECTOR_B)' computes the dot product 7160 multiplication of two vectors VECTOR_A and VECTOR_B. The two 7161 vectors may be either numeric or logical and must be arrays of rank 7162 one and of equal size. If the vectors are 'INTEGER' or 'REAL', the 7163 result is 'SUM(VECTOR_A*VECTOR_B)'. If the vectors are 'COMPLEX', 7164 the result is 'SUM(CONJG(VECTOR_A)*VECTOR_B)'. If the vectors are 7165 'LOGICAL', the result is 'ANY(VECTOR_A .AND. VECTOR_B)'. 7166 7167_Standard_: 7168 Fortran 95 and later 7169 7170_Class_: 7171 Transformational function 7172 7173_Syntax_: 7174 'RESULT = DOT_PRODUCT(VECTOR_A, VECTOR_B)' 7175 7176_Arguments_: 7177 VECTOR_A The type shall be numeric or 'LOGICAL', rank 1. 7178 VECTOR_B The type shall be numeric if VECTOR_A is of 7179 numeric type or 'LOGICAL' if VECTOR_A is of type 7180 'LOGICAL'. VECTOR_B shall be a rank-one array. 7181 7182_Return value_: 7183 If the arguments are numeric, the return value is a scalar of 7184 numeric type, 'INTEGER', 'REAL', or 'COMPLEX'. If the arguments 7185 are 'LOGICAL', the return value is '.TRUE.' or '.FALSE.'. 7186 7187_Example_: 7188 program test_dot_prod 7189 integer, dimension(3) :: a, b 7190 a = (/ 1, 2, 3 /) 7191 b = (/ 4, 5, 6 /) 7192 print '(3i3)', a 7193 print * 7194 print '(3i3)', b 7195 print * 7196 print *, dot_product(a,b) 7197 end program test_dot_prod 7198 7199 7200File: gfortran.info, Node: DPROD, Next: DREAL, Prev: DOT_PRODUCT, Up: Intrinsic Procedures 7201 72028.67 'DPROD' -- Double product function 7203======================================= 7204 7205_Description_: 7206 'DPROD(X,Y)' returns the product 'X*Y'. 7207 7208_Standard_: 7209 Fortran 77 and later 7210 7211_Class_: 7212 Elemental function 7213 7214_Syntax_: 7215 'RESULT = DPROD(X, Y)' 7216 7217_Arguments_: 7218 X The type shall be 'REAL'. 7219 Y The type shall be 'REAL'. 7220 7221_Return value_: 7222 The return value is of type 'REAL(8)'. 7223 7224_Example_: 7225 program test_dprod 7226 real :: x = 5.2 7227 real :: y = 2.3 7228 real(8) :: d 7229 d = dprod(x,y) 7230 print *, d 7231 end program test_dprod 7232 7233_Specific names_: 7234 Name Argument Return type Standard 7235 'DPROD(X,Y)' 'REAL(4) X, 'REAL(4)' Fortran 77 and 7236 Y' later 7237 7238 7239File: gfortran.info, Node: DREAL, Next: DSHIFTL, Prev: DPROD, Up: Intrinsic Procedures 7240 72418.68 'DREAL' -- Double real part function 7242========================================= 7243 7244_Description_: 7245 'DREAL(Z)' returns the real part of complex variable Z. 7246 7247_Standard_: 7248 GNU extension 7249 7250_Class_: 7251 Elemental function 7252 7253_Syntax_: 7254 'RESULT = DREAL(A)' 7255 7256_Arguments_: 7257 A The type shall be 'COMPLEX(8)'. 7258 7259_Return value_: 7260 The return value is of type 'REAL(8)'. 7261 7262_Example_: 7263 program test_dreal 7264 complex(8) :: z = (1.3_8,7.2_8) 7265 print *, dreal(z) 7266 end program test_dreal 7267 7268_See also_: 7269 *note AIMAG:: 7270 7271 7272File: gfortran.info, Node: DSHIFTL, Next: DSHIFTR, Prev: DREAL, Up: Intrinsic Procedures 7273 72748.69 'DSHIFTL' -- Combined left shift 7275===================================== 7276 7277_Description_: 7278 'DSHIFTL(I, J, SHIFT)' combines bits of I and J. The rightmost 7279 SHIFT bits of the result are the leftmost SHIFT bits of J, and the 7280 remaining bits are the rightmost bits of I. 7281 7282_Standard_: 7283 Fortran 2008 and later 7284 7285_Class_: 7286 Elemental function 7287 7288_Syntax_: 7289 'RESULT = DSHIFTL(I, J, SHIFT)' 7290 7291_Arguments_: 7292 I Shall be of type 'INTEGER' or a BOZ constant. 7293 J Shall be of type 'INTEGER' or a BOZ constant. 7294 If both I and J have integer type, then they 7295 shall have the same kind type parameter. I and 7296 J shall not both be BOZ constants. 7297 SHIFT Shall be of type 'INTEGER'. It shall be 7298 nonnegative. If I is not a BOZ constant, then 7299 SHIFT shall be less than or equal to 7300 'BIT_SIZE(I)'; otherwise, SHIFT shall be less 7301 than or equal to 'BIT_SIZE(J)'. 7302 7303_Return value_: 7304 If either I or J is a BOZ constant, it is first converted as if by 7305 the intrinsic function 'INT' to an integer type with the kind type 7306 parameter of the other. 7307 7308_See also_: 7309 *note DSHIFTR:: 7310 7311 7312File: gfortran.info, Node: DSHIFTR, Next: DTIME, Prev: DSHIFTL, Up: Intrinsic Procedures 7313 73148.70 'DSHIFTR' -- Combined right shift 7315====================================== 7316 7317_Description_: 7318 'DSHIFTR(I, J, SHIFT)' combines bits of I and J. The leftmost 7319 SHIFT bits of the result are the rightmost SHIFT bits of I, and the 7320 remaining bits are the leftmost bits of J. 7321 7322_Standard_: 7323 Fortran 2008 and later 7324 7325_Class_: 7326 Elemental function 7327 7328_Syntax_: 7329 'RESULT = DSHIFTR(I, J, SHIFT)' 7330 7331_Arguments_: 7332 I Shall be of type 'INTEGER' or a BOZ constant. 7333 J Shall be of type 'INTEGER' or a BOZ constant. 7334 If both I and J have integer type, then they 7335 shall have the same kind type parameter. I and 7336 J shall not both be BOZ constants. 7337 SHIFT Shall be of type 'INTEGER'. It shall be 7338 nonnegative. If I is not a BOZ constant, then 7339 SHIFT shall be less than or equal to 7340 'BIT_SIZE(I)'; otherwise, SHIFT shall be less 7341 than or equal to 'BIT_SIZE(J)'. 7342 7343_Return value_: 7344 If either I or J is a BOZ constant, it is first converted as if by 7345 the intrinsic function 'INT' to an integer type with the kind type 7346 parameter of the other. 7347 7348_See also_: 7349 *note DSHIFTL:: 7350 7351 7352File: gfortran.info, Node: DTIME, Next: EOSHIFT, Prev: DSHIFTR, Up: Intrinsic Procedures 7353 73548.71 'DTIME' -- Execution time subroutine (or function) 7355======================================================= 7356 7357_Description_: 7358 'DTIME(VALUES, TIME)' initially returns the number of seconds of 7359 runtime since the start of the process's execution in TIME. VALUES 7360 returns the user and system components of this time in 'VALUES(1)' 7361 and 'VALUES(2)' respectively. TIME is equal to 'VALUES(1) + 7362 VALUES(2)'. 7363 7364 Subsequent invocations of 'DTIME' return values accumulated since 7365 the previous invocation. 7366 7367 On some systems, the underlying timings are represented using types 7368 with sufficiently small limits that overflows (wrap around) are 7369 possible, such as 32-bit types. Therefore, the values returned by 7370 this intrinsic might be, or become, negative, or numerically less 7371 than previous values, during a single run of the compiled program. 7372 7373 Please note, that this implementation is thread safe if used within 7374 OpenMP directives, i.e., its state will be consistent while called 7375 from multiple threads. However, if 'DTIME' is called from multiple 7376 threads, the result is still the time since the last invocation. 7377 This may not give the intended results. If possible, use 7378 'CPU_TIME' instead. 7379 7380 This intrinsic is provided in both subroutine and function forms; 7381 however, only one form can be used in any given program unit. 7382 7383 VALUES and TIME are 'INTENT(OUT)' and provide the following: 7384 7385 'VALUES(1)': User time in seconds. 7386 'VALUES(2)': System time in seconds. 7387 'TIME': Run time since start in 7388 seconds. 7389 7390_Standard_: 7391 GNU extension 7392 7393_Class_: 7394 Subroutine, function 7395 7396_Syntax_: 7397 'CALL DTIME(VALUES, TIME)'. 7398 'TIME = DTIME(VALUES)', (not recommended). 7399 7400_Arguments_: 7401 VALUES The type shall be 'REAL(4), DIMENSION(2)'. 7402 TIME The type shall be 'REAL(4)'. 7403 7404_Return value_: 7405 Elapsed time in seconds since the last invocation or since the 7406 start of program execution if not called before. 7407 7408_Example_: 7409 program test_dtime 7410 integer(8) :: i, j 7411 real, dimension(2) :: tarray 7412 real :: result 7413 call dtime(tarray, result) 7414 print *, result 7415 print *, tarray(1) 7416 print *, tarray(2) 7417 do i=1,100000000 ! Just a delay 7418 j = i * i - i 7419 end do 7420 call dtime(tarray, result) 7421 print *, result 7422 print *, tarray(1) 7423 print *, tarray(2) 7424 end program test_dtime 7425 7426_See also_: 7427 *note CPU_TIME:: 7428 7429 7430File: gfortran.info, Node: EOSHIFT, Next: EPSILON, Prev: DTIME, Up: Intrinsic Procedures 7431 74328.72 'EOSHIFT' -- End-off shift elements of an array 7433==================================================== 7434 7435_Description_: 7436 'EOSHIFT(ARRAY, SHIFT[, BOUNDARY, DIM])' performs an end-off shift 7437 on elements of ARRAY along the dimension of DIM. If DIM is omitted 7438 it is taken to be '1'. DIM is a scalar of type 'INTEGER' in the 7439 range of 1 \leq DIM \leq n) where n is the rank of ARRAY. If the 7440 rank of ARRAY is one, then all elements of ARRAY are shifted by 7441 SHIFT places. If rank is greater than one, then all complete rank 7442 one sections of ARRAY along the given dimension are shifted. 7443 Elements shifted out one end of each rank one section are dropped. 7444 If BOUNDARY is present then the corresponding value of from 7445 BOUNDARY is copied back in the other end. If BOUNDARY is not 7446 present then the following are copied in depending on the type of 7447 ARRAY. 7448 7449 _Array _Boundary Value_ 7450 Type_ 7451 Numeric 0 of the type and kind of ARRAY. 7452 Logical '.FALSE.'. 7453 Character(LEN)LEN blanks. 7454 7455_Standard_: 7456 Fortran 95 and later 7457 7458_Class_: 7459 Transformational function 7460 7461_Syntax_: 7462 'RESULT = EOSHIFT(ARRAY, SHIFT [, BOUNDARY, DIM])' 7463 7464_Arguments_: 7465 ARRAY May be any type, not scalar. 7466 SHIFT The type shall be 'INTEGER'. 7467 BOUNDARY Same type as ARRAY. 7468 DIM The type shall be 'INTEGER'. 7469 7470_Return value_: 7471 Returns an array of same type and rank as the ARRAY argument. 7472 7473_Example_: 7474 program test_eoshift 7475 integer, dimension(3,3) :: a 7476 a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /)) 7477 print '(3i3)', a(1,:) 7478 print '(3i3)', a(2,:) 7479 print '(3i3)', a(3,:) 7480 a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2) 7481 print * 7482 print '(3i3)', a(1,:) 7483 print '(3i3)', a(2,:) 7484 print '(3i3)', a(3,:) 7485 end program test_eoshift 7486 7487 7488File: gfortran.info, Node: EPSILON, Next: ERF, Prev: EOSHIFT, Up: Intrinsic Procedures 7489 74908.73 'EPSILON' -- Epsilon function 7491================================== 7492 7493_Description_: 7494 'EPSILON(X)' returns the smallest number E of the same kind as X 7495 such that 1 + E > 1. 7496 7497_Standard_: 7498 Fortran 95 and later 7499 7500_Class_: 7501 Inquiry function 7502 7503_Syntax_: 7504 'RESULT = EPSILON(X)' 7505 7506_Arguments_: 7507 X The type shall be 'REAL'. 7508 7509_Return value_: 7510 The return value is of same type as the argument. 7511 7512_Example_: 7513 program test_epsilon 7514 real :: x = 3.143 7515 real(8) :: y = 2.33 7516 print *, EPSILON(x) 7517 print *, EPSILON(y) 7518 end program test_epsilon 7519 7520 7521File: gfortran.info, Node: ERF, Next: ERFC, Prev: EPSILON, Up: Intrinsic Procedures 7522 75238.74 'ERF' -- Error function 7524============================ 7525 7526_Description_: 7527 'ERF(X)' computes the error function of X. 7528 7529_Standard_: 7530 Fortran 2008 and later 7531 7532_Class_: 7533 Elemental function 7534 7535_Syntax_: 7536 'RESULT = ERF(X)' 7537 7538_Arguments_: 7539 X The type shall be 'REAL'. 7540 7541_Return value_: 7542 The return value is of type 'REAL', of the same kind as X and lies 7543 in the range -1 \leq erf (x) \leq 1 . 7544 7545_Example_: 7546 program test_erf 7547 real(8) :: x = 0.17_8 7548 x = erf(x) 7549 end program test_erf 7550 7551_Specific names_: 7552 Name Argument Return type Standard 7553 'DERF(X)' 'REAL(8) X' 'REAL(8)' GNU extension 7554 7555 7556File: gfortran.info, Node: ERFC, Next: ERFC_SCALED, Prev: ERF, Up: Intrinsic Procedures 7557 75588.75 'ERFC' -- Error function 7559============================= 7560 7561_Description_: 7562 'ERFC(X)' computes the complementary error function of X. 7563 7564_Standard_: 7565 Fortran 2008 and later 7566 7567_Class_: 7568 Elemental function 7569 7570_Syntax_: 7571 'RESULT = ERFC(X)' 7572 7573_Arguments_: 7574 X The type shall be 'REAL'. 7575 7576_Return value_: 7577 The return value is of type 'REAL' and of the same kind as X. It 7578 lies in the range 0 \leq erfc (x) \leq 2 . 7579 7580_Example_: 7581 program test_erfc 7582 real(8) :: x = 0.17_8 7583 x = erfc(x) 7584 end program test_erfc 7585 7586_Specific names_: 7587 Name Argument Return type Standard 7588 'DERFC(X)' 'REAL(8) X' 'REAL(8)' GNU extension 7589 7590 7591File: gfortran.info, Node: ERFC_SCALED, Next: ETIME, Prev: ERFC, Up: Intrinsic Procedures 7592 75938.76 'ERFC_SCALED' -- Error function 7594==================================== 7595 7596_Description_: 7597 'ERFC_SCALED(X)' computes the exponentially-scaled complementary 7598 error function of X. 7599 7600_Standard_: 7601 Fortran 2008 and later 7602 7603_Class_: 7604 Elemental function 7605 7606_Syntax_: 7607 'RESULT = ERFC_SCALED(X)' 7608 7609_Arguments_: 7610 X The type shall be 'REAL'. 7611 7612_Return value_: 7613 The return value is of type 'REAL' and of the same kind as X. 7614 7615_Example_: 7616 program test_erfc_scaled 7617 real(8) :: x = 0.17_8 7618 x = erfc_scaled(x) 7619 end program test_erfc_scaled 7620 7621 7622File: gfortran.info, Node: ETIME, Next: EXECUTE_COMMAND_LINE, Prev: ERFC_SCALED, Up: Intrinsic Procedures 7623 76248.77 'ETIME' -- Execution time subroutine (or function) 7625======================================================= 7626 7627_Description_: 7628 'ETIME(VALUES, TIME)' returns the number of seconds of runtime 7629 since the start of the process's execution in TIME. VALUES returns 7630 the user and system components of this time in 'VALUES(1)' and 7631 'VALUES(2)' respectively. TIME is equal to 'VALUES(1) + 7632 VALUES(2)'. 7633 7634 On some systems, the underlying timings are represented using types 7635 with sufficiently small limits that overflows (wrap around) are 7636 possible, such as 32-bit types. Therefore, the values returned by 7637 this intrinsic might be, or become, negative, or numerically less 7638 than previous values, during a single run of the compiled program. 7639 7640 This intrinsic is provided in both subroutine and function forms; 7641 however, only one form can be used in any given program unit. 7642 7643 VALUES and TIME are 'INTENT(OUT)' and provide the following: 7644 7645 'VALUES(1)': User time in seconds. 7646 'VALUES(2)': System time in seconds. 7647 'TIME': Run time since start in seconds. 7648 7649_Standard_: 7650 GNU extension 7651 7652_Class_: 7653 Subroutine, function 7654 7655_Syntax_: 7656 'CALL ETIME(VALUES, TIME)'. 7657 'TIME = ETIME(VALUES)', (not recommended). 7658 7659_Arguments_: 7660 VALUES The type shall be 'REAL(4), DIMENSION(2)'. 7661 TIME The type shall be 'REAL(4)'. 7662 7663_Return value_: 7664 Elapsed time in seconds since the start of program execution. 7665 7666_Example_: 7667 program test_etime 7668 integer(8) :: i, j 7669 real, dimension(2) :: tarray 7670 real :: result 7671 call ETIME(tarray, result) 7672 print *, result 7673 print *, tarray(1) 7674 print *, tarray(2) 7675 do i=1,100000000 ! Just a delay 7676 j = i * i - i 7677 end do 7678 call ETIME(tarray, result) 7679 print *, result 7680 print *, tarray(1) 7681 print *, tarray(2) 7682 end program test_etime 7683 7684_See also_: 7685 *note CPU_TIME:: 7686 7687 7688File: gfortran.info, Node: EXECUTE_COMMAND_LINE, Next: EXIT, Prev: ETIME, Up: Intrinsic Procedures 7689 76908.78 'EXECUTE_COMMAND_LINE' -- Execute a shell command 7691====================================================== 7692 7693_Description_: 7694 'EXECUTE_COMMAND_LINE' runs a shell command, synchronously or 7695 asynchronously. 7696 7697 The 'COMMAND' argument is passed to the shell and executed, using 7698 the C library's 'system' call. (The shell is 'sh' on Unix systems, 7699 and 'cmd.exe' on Windows.) If 'WAIT' is present and has the value 7700 false, the execution of the command is asynchronous if the system 7701 supports it; otherwise, the command is executed synchronously. 7702 7703 The three last arguments allow the user to get status information. 7704 After synchronous execution, 'EXITSTAT' contains the integer exit 7705 code of the command, as returned by 'system'. 'CMDSTAT' is set to 7706 zero if the command line was executed (whatever its exit status 7707 was). 'CMDMSG' is assigned an error message if an error has 7708 occurred. 7709 7710 Note that the 'system' function need not be thread-safe. It is the 7711 responsibility of the user to ensure that 'system' is not called 7712 concurrently. 7713 7714_Standard_: 7715 Fortran 2008 and later 7716 7717_Class_: 7718 Subroutine 7719 7720_Syntax_: 7721 'CALL EXECUTE_COMMAND_LINE(COMMAND [, WAIT, EXITSTAT, CMDSTAT, 7722 CMDMSG ])' 7723 7724_Arguments_: 7725 COMMAND Shall be a default 'CHARACTER' scalar. 7726 WAIT (Optional) Shall be a default 'LOGICAL' scalar. 7727 EXITSTAT (Optional) Shall be an 'INTEGER' of the default 7728 kind. 7729 CMDSTAT (Optional) Shall be an 'INTEGER' of the default 7730 kind. 7731 CMDMSG (Optional) Shall be an 'CHARACTER' scalar of the 7732 default kind. 7733 7734_Example_: 7735 program test_exec 7736 integer :: i 7737 7738 call execute_command_line ("external_prog.exe", exitstat=i) 7739 print *, "Exit status of external_prog.exe was ", i 7740 7741 call execute_command_line ("reindex_files.exe", wait=.false.) 7742 print *, "Now reindexing files in the background" 7743 7744 end program test_exec 7745 7746_Note_: 7747 7748 Because this intrinsic is implemented in terms of the 'system' 7749 function call, its behavior with respect to signaling is processor 7750 dependent. In particular, on POSIX-compliant systems, the SIGINT 7751 and SIGQUIT signals will be ignored, and the SIGCHLD will be 7752 blocked. As such, if the parent process is terminated, the child 7753 process might not be terminated alongside. 7754 7755_See also_: 7756 *note SYSTEM:: 7757 7758 7759File: gfortran.info, Node: EXIT, Next: EXP, Prev: EXECUTE_COMMAND_LINE, Up: Intrinsic Procedures 7760 77618.79 'EXIT' -- Exit the program with status. 7762============================================ 7763 7764_Description_: 7765 'EXIT' causes immediate termination of the program with status. If 7766 status is omitted it returns the canonical _success_ for the 7767 system. All Fortran I/O units are closed. 7768 7769_Standard_: 7770 GNU extension 7771 7772_Class_: 7773 Subroutine 7774 7775_Syntax_: 7776 'CALL EXIT([STATUS])' 7777 7778_Arguments_: 7779 STATUS Shall be an 'INTEGER' of the default kind. 7780 7781_Return value_: 7782 'STATUS' is passed to the parent process on exit. 7783 7784_Example_: 7785 program test_exit 7786 integer :: STATUS = 0 7787 print *, 'This program is going to exit.' 7788 call EXIT(STATUS) 7789 end program test_exit 7790 7791_See also_: 7792 *note ABORT::, *note KILL:: 7793 7794 7795File: gfortran.info, Node: EXP, Next: EXPONENT, Prev: EXIT, Up: Intrinsic Procedures 7796 77978.80 'EXP' -- Exponential function 7798================================== 7799 7800_Description_: 7801 'EXP(X)' computes the base e exponential of X. 7802 7803_Standard_: 7804 Fortran 77 and later, has overloads that are GNU extensions 7805 7806_Class_: 7807 Elemental function 7808 7809_Syntax_: 7810 'RESULT = EXP(X)' 7811 7812_Arguments_: 7813 X The type shall be 'REAL' or 'COMPLEX'. 7814 7815_Return value_: 7816 The return value has same type and kind as X. 7817 7818_Example_: 7819 program test_exp 7820 real :: x = 1.0 7821 x = exp(x) 7822 end program test_exp 7823 7824_Specific names_: 7825 Name Argument Return type Standard 7826 'EXP(X)' 'REAL(4) X' 'REAL(4)' Fortran 77 and 7827 later 7828 'DEXP(X)' 'REAL(8) X' 'REAL(8)' Fortran 77 and 7829 later 7830 'CEXP(X)' 'COMPLEX(4) 'COMPLEX(4)' Fortran 77 and 7831 X' later 7832 'ZEXP(X)' 'COMPLEX(8) 'COMPLEX(8)' GNU extension 7833 X' 7834 'CDEXP(X)' 'COMPLEX(8) 'COMPLEX(8)' GNU extension 7835 X' 7836 7837 7838File: gfortran.info, Node: EXPONENT, Next: EXTENDS_TYPE_OF, Prev: EXP, Up: Intrinsic Procedures 7839 78408.81 'EXPONENT' -- Exponent function 7841==================================== 7842 7843_Description_: 7844 'EXPONENT(X)' returns the value of the exponent part of X. If X is 7845 zero the value returned is zero. 7846 7847_Standard_: 7848 Fortran 95 and later 7849 7850_Class_: 7851 Elemental function 7852 7853_Syntax_: 7854 'RESULT = EXPONENT(X)' 7855 7856_Arguments_: 7857 X The type shall be 'REAL'. 7858 7859_Return value_: 7860 The return value is of type default 'INTEGER'. 7861 7862_Example_: 7863 program test_exponent 7864 real :: x = 1.0 7865 integer :: i 7866 i = exponent(x) 7867 print *, i 7868 print *, exponent(0.0) 7869 end program test_exponent 7870 7871 7872File: gfortran.info, Node: EXTENDS_TYPE_OF, Next: FDATE, Prev: EXPONENT, Up: Intrinsic Procedures 7873 78748.82 'EXTENDS_TYPE_OF' -- Query dynamic type for extension 7875========================================================== 7876 7877_Description_: 7878 Query dynamic type for extension. 7879 7880_Standard_: 7881 Fortran 2003 and later 7882 7883_Class_: 7884 Inquiry function 7885 7886_Syntax_: 7887 'RESULT = EXTENDS_TYPE_OF(A, MOLD)' 7888 7889_Arguments_: 7890 A Shall be an object of extensible declared type 7891 or unlimited polymorphic. 7892 MOLD Shall be an object of extensible declared type 7893 or unlimited polymorphic. 7894 7895_Return value_: 7896 The return value is a scalar of type default logical. It is true 7897 if and only if the dynamic type of A is an extension type of the 7898 dynamic type of MOLD. 7899 7900_See also_: 7901 *note SAME_TYPE_AS:: 7902 7903 7904File: gfortran.info, Node: FDATE, Next: FGET, Prev: EXTENDS_TYPE_OF, Up: Intrinsic Procedures 7905 79068.83 'FDATE' -- Get the current time as a string 7907================================================ 7908 7909_Description_: 7910 'FDATE(DATE)' returns the current date (using the same format as 7911 'CTIME') in DATE. It is equivalent to 'CALL CTIME(DATE, TIME())'. 7912 7913 This intrinsic is provided in both subroutine and function forms; 7914 however, only one form can be used in any given program unit. 7915 7916_Standard_: 7917 GNU extension 7918 7919_Class_: 7920 Subroutine, function 7921 7922_Syntax_: 7923 'CALL FDATE(DATE)'. 7924 'DATE = FDATE()'. 7925 7926_Arguments_: 7927 DATE The type shall be of type 'CHARACTER' of the 7928 default kind. It is an 'INTENT(OUT)' argument. 7929 If the length of this variable is too short for 7930 the date and time string to fit completely, it 7931 will be blank on procedure return. 7932 7933_Return value_: 7934 The current date and time as a string. 7935 7936_Example_: 7937 program test_fdate 7938 integer(8) :: i, j 7939 character(len=30) :: date 7940 call fdate(date) 7941 print *, 'Program started on ', date 7942 do i = 1, 100000000 ! Just a delay 7943 j = i * i - i 7944 end do 7945 call fdate(date) 7946 print *, 'Program ended on ', date 7947 end program test_fdate 7948 7949_See also_: 7950 *note DATE_AND_TIME::, *note CTIME:: 7951 7952 7953File: gfortran.info, Node: FGET, Next: FGETC, Prev: FDATE, Up: Intrinsic Procedures 7954 79558.84 'FGET' -- Read a single character in stream mode from stdin 7956================================================================ 7957 7958_Description_: 7959 Read a single character in stream mode from stdin by bypassing 7960 normal formatted output. Stream I/O should not be mixed with 7961 normal record-oriented (formatted or unformatted) I/O on the same 7962 unit; the results are unpredictable. 7963 7964 This intrinsic is provided in both subroutine and function forms; 7965 however, only one form can be used in any given program unit. 7966 7967 Note that the 'FGET' intrinsic is provided for backwards 7968 compatibility with 'g77'. GNU Fortran provides the Fortran 2003 7969 Stream facility. Programmers should consider the use of new stream 7970 IO feature in new code for future portability. See also *note 7971 Fortran 2003 status::. 7972 7973_Standard_: 7974 GNU extension 7975 7976_Class_: 7977 Subroutine, function 7978 7979_Syntax_: 7980 'CALL FGET(C [, STATUS])' 7981 'STATUS = FGET(C)' 7982 7983_Arguments_: 7984 C The type shall be 'CHARACTER' and of default 7985 kind. 7986 STATUS (Optional) status flag of type 'INTEGER'. 7987 Returns 0 on success, -1 on end-of-file, and a 7988 system specific positive error code otherwise. 7989 7990_Example_: 7991 PROGRAM test_fget 7992 INTEGER, PARAMETER :: strlen = 100 7993 INTEGER :: status, i = 1 7994 CHARACTER(len=strlen) :: str = "" 7995 7996 WRITE (*,*) 'Enter text:' 7997 DO 7998 CALL fget(str(i:i), status) 7999 if (status /= 0 .OR. i > strlen) exit 8000 i = i + 1 8001 END DO 8002 WRITE (*,*) TRIM(str) 8003 END PROGRAM 8004 8005_See also_: 8006 *note FGETC::, *note FPUT::, *note FPUTC:: 8007 8008 8009File: gfortran.info, Node: FGETC, Next: FLOOR, Prev: FGET, Up: Intrinsic Procedures 8010 80118.85 'FGETC' -- Read a single character in stream mode 8012====================================================== 8013 8014_Description_: 8015 Read a single character in stream mode by bypassing normal 8016 formatted output. Stream I/O should not be mixed with normal 8017 record-oriented (formatted or unformatted) I/O on the same unit; 8018 the results are unpredictable. 8019 8020 This intrinsic is provided in both subroutine and function forms; 8021 however, only one form can be used in any given program unit. 8022 8023 Note that the 'FGET' intrinsic is provided for backwards 8024 compatibility with 'g77'. GNU Fortran provides the Fortran 2003 8025 Stream facility. Programmers should consider the use of new stream 8026 IO feature in new code for future portability. See also *note 8027 Fortran 2003 status::. 8028 8029_Standard_: 8030 GNU extension 8031 8032_Class_: 8033 Subroutine, function 8034 8035_Syntax_: 8036 'CALL FGETC(UNIT, C [, STATUS])' 8037 'STATUS = FGETC(UNIT, C)' 8038 8039_Arguments_: 8040 UNIT The type shall be 'INTEGER'. 8041 C The type shall be 'CHARACTER' and of default 8042 kind. 8043 STATUS (Optional) status flag of type 'INTEGER'. 8044 Returns 0 on success, -1 on end-of-file and a 8045 system specific positive error code otherwise. 8046 8047_Example_: 8048 PROGRAM test_fgetc 8049 INTEGER :: fd = 42, status 8050 CHARACTER :: c 8051 8052 OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD") 8053 DO 8054 CALL fgetc(fd, c, status) 8055 IF (status /= 0) EXIT 8056 call fput(c) 8057 END DO 8058 CLOSE(UNIT=fd) 8059 END PROGRAM 8060 8061_See also_: 8062 *note FGET::, *note FPUT::, *note FPUTC:: 8063 8064 8065File: gfortran.info, Node: FLOOR, Next: FLUSH, Prev: FGETC, Up: Intrinsic Procedures 8066 80678.86 'FLOOR' -- Integer floor function 8068====================================== 8069 8070_Description_: 8071 'FLOOR(A)' returns the greatest integer less than or equal to X. 8072 8073_Standard_: 8074 Fortran 95 and later 8075 8076_Class_: 8077 Elemental function 8078 8079_Syntax_: 8080 'RESULT = FLOOR(A [, KIND])' 8081 8082_Arguments_: 8083 A The type shall be 'REAL'. 8084 KIND (Optional) An 'INTEGER' initialization 8085 expression indicating the kind parameter of the 8086 result. 8087 8088_Return value_: 8089 The return value is of type 'INTEGER(KIND)' if KIND is present and 8090 of default-kind 'INTEGER' otherwise. 8091 8092_Example_: 8093 program test_floor 8094 real :: x = 63.29 8095 real :: y = -63.59 8096 print *, floor(x) ! returns 63 8097 print *, floor(y) ! returns -64 8098 end program test_floor 8099 8100_See also_: 8101 *note CEILING::, *note NINT:: 8102 8103 8104File: gfortran.info, Node: FLUSH, Next: FNUM, Prev: FLOOR, Up: Intrinsic Procedures 8105 81068.87 'FLUSH' -- Flush I/O unit(s) 8107================================= 8108 8109_Description_: 8110 Flushes Fortran unit(s) currently open for output. Without the 8111 optional argument, all units are flushed, otherwise just the unit 8112 specified. 8113 8114_Standard_: 8115 GNU extension 8116 8117_Class_: 8118 Subroutine 8119 8120_Syntax_: 8121 'CALL FLUSH(UNIT)' 8122 8123_Arguments_: 8124 UNIT (Optional) The type shall be 'INTEGER'. 8125 8126_Note_: 8127 Beginning with the Fortran 2003 standard, there is a 'FLUSH' 8128 statement that should be preferred over the 'FLUSH' intrinsic. 8129 8130 The 'FLUSH' intrinsic and the Fortran 2003 'FLUSH' statement have 8131 identical effect: they flush the runtime library's I/O buffer so 8132 that the data becomes visible to other processes. This does not 8133 guarantee that the data is committed to disk. 8134 8135 On POSIX systems, you can request that all data is transferred to 8136 the storage device by calling the 'fsync' function, with the POSIX 8137 file descriptor of the I/O unit as argument (retrieved with GNU 8138 intrinsic 'FNUM'). The following example shows how: 8139 8140 ! Declare the interface for POSIX fsync function 8141 interface 8142 function fsync (fd) bind(c,name="fsync") 8143 use iso_c_binding, only: c_int 8144 integer(c_int), value :: fd 8145 integer(c_int) :: fsync 8146 end function fsync 8147 end interface 8148 8149 ! Variable declaration 8150 integer :: ret 8151 8152 ! Opening unit 10 8153 open (10,file="foo") 8154 8155 ! ... 8156 ! Perform I/O on unit 10 8157 ! ... 8158 8159 ! Flush and sync 8160 flush(10) 8161 ret = fsync(fnum(10)) 8162 8163 ! Handle possible error 8164 if (ret /= 0) stop "Error calling FSYNC" 8165 8166 8167File: gfortran.info, Node: FNUM, Next: FPUT, Prev: FLUSH, Up: Intrinsic Procedures 8168 81698.88 'FNUM' -- File number function 8170=================================== 8171 8172_Description_: 8173 'FNUM(UNIT)' returns the POSIX file descriptor number corresponding 8174 to the open Fortran I/O unit 'UNIT'. 8175 8176_Standard_: 8177 GNU extension 8178 8179_Class_: 8180 Function 8181 8182_Syntax_: 8183 'RESULT = FNUM(UNIT)' 8184 8185_Arguments_: 8186 UNIT The type shall be 'INTEGER'. 8187 8188_Return value_: 8189 The return value is of type 'INTEGER' 8190 8191_Example_: 8192 program test_fnum 8193 integer :: i 8194 open (unit=10, status = "scratch") 8195 i = fnum(10) 8196 print *, i 8197 close (10) 8198 end program test_fnum 8199 8200 8201File: gfortran.info, Node: FPUT, Next: FPUTC, Prev: FNUM, Up: Intrinsic Procedures 8202 82038.89 'FPUT' -- Write a single character in stream mode to stdout 8204================================================================ 8205 8206_Description_: 8207 Write a single character in stream mode to stdout by bypassing 8208 normal formatted output. Stream I/O should not be mixed with 8209 normal record-oriented (formatted or unformatted) I/O on the same 8210 unit; the results are unpredictable. 8211 8212 This intrinsic is provided in both subroutine and function forms; 8213 however, only one form can be used in any given program unit. 8214 8215 Note that the 'FGET' intrinsic is provided for backwards 8216 compatibility with 'g77'. GNU Fortran provides the Fortran 2003 8217 Stream facility. Programmers should consider the use of new stream 8218 IO feature in new code for future portability. See also *note 8219 Fortran 2003 status::. 8220 8221_Standard_: 8222 GNU extension 8223 8224_Class_: 8225 Subroutine, function 8226 8227_Syntax_: 8228 'CALL FPUT(C [, STATUS])' 8229 'STATUS = FPUT(C)' 8230 8231_Arguments_: 8232 C The type shall be 'CHARACTER' and of default 8233 kind. 8234 STATUS (Optional) status flag of type 'INTEGER'. 8235 Returns 0 on success, -1 on end-of-file and a 8236 system specific positive error code otherwise. 8237 8238_Example_: 8239 PROGRAM test_fput 8240 CHARACTER(len=10) :: str = "gfortran" 8241 INTEGER :: i 8242 DO i = 1, len_trim(str) 8243 CALL fput(str(i:i)) 8244 END DO 8245 END PROGRAM 8246 8247_See also_: 8248 *note FPUTC::, *note FGET::, *note FGETC:: 8249 8250 8251File: gfortran.info, Node: FPUTC, Next: FRACTION, Prev: FPUT, Up: Intrinsic Procedures 8252 82538.90 'FPUTC' -- Write a single character in stream mode 8254======================================================= 8255 8256_Description_: 8257 Write a single character in stream mode by bypassing normal 8258 formatted output. Stream I/O should not be mixed with normal 8259 record-oriented (formatted or unformatted) I/O on the same unit; 8260 the results are unpredictable. 8261 8262 This intrinsic is provided in both subroutine and function forms; 8263 however, only one form can be used in any given program unit. 8264 8265 Note that the 'FGET' intrinsic is provided for backwards 8266 compatibility with 'g77'. GNU Fortran provides the Fortran 2003 8267 Stream facility. Programmers should consider the use of new stream 8268 IO feature in new code for future portability. See also *note 8269 Fortran 2003 status::. 8270 8271_Standard_: 8272 GNU extension 8273 8274_Class_: 8275 Subroutine, function 8276 8277_Syntax_: 8278 'CALL FPUTC(UNIT, C [, STATUS])' 8279 'STATUS = FPUTC(UNIT, C)' 8280 8281_Arguments_: 8282 UNIT The type shall be 'INTEGER'. 8283 C The type shall be 'CHARACTER' and of default 8284 kind. 8285 STATUS (Optional) status flag of type 'INTEGER'. 8286 Returns 0 on success, -1 on end-of-file and a 8287 system specific positive error code otherwise. 8288 8289_Example_: 8290 PROGRAM test_fputc 8291 CHARACTER(len=10) :: str = "gfortran" 8292 INTEGER :: fd = 42, i 8293 8294 OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW") 8295 DO i = 1, len_trim(str) 8296 CALL fputc(fd, str(i:i)) 8297 END DO 8298 CLOSE(fd) 8299 END PROGRAM 8300 8301_See also_: 8302 *note FPUT::, *note FGET::, *note FGETC:: 8303 8304 8305File: gfortran.info, Node: FRACTION, Next: FREE, Prev: FPUTC, Up: Intrinsic Procedures 8306 83078.91 'FRACTION' -- Fractional part of the model representation 8308============================================================== 8309 8310_Description_: 8311 'FRACTION(X)' returns the fractional part of the model 8312 representation of 'X'. 8313 8314_Standard_: 8315 Fortran 95 and later 8316 8317_Class_: 8318 Elemental function 8319 8320_Syntax_: 8321 'Y = FRACTION(X)' 8322 8323_Arguments_: 8324 X The type of the argument shall be a 'REAL'. 8325 8326_Return value_: 8327 The return value is of the same type and kind as the argument. The 8328 fractional part of the model representation of 'X' is returned; it 8329 is 'X * RADIX(X)**(-EXPONENT(X))'. 8330 8331_Example_: 8332 program test_fraction 8333 real :: x 8334 x = 178.1387e-4 8335 print *, fraction(x), x * radix(x)**(-exponent(x)) 8336 end program test_fraction 8337 8338 8339File: gfortran.info, Node: FREE, Next: FSEEK, Prev: FRACTION, Up: Intrinsic Procedures 8340 83418.92 'FREE' -- Frees memory 8342=========================== 8343 8344_Description_: 8345 Frees memory previously allocated by 'MALLOC'. The 'FREE' 8346 intrinsic is an extension intended to be used with Cray pointers, 8347 and is provided in GNU Fortran to allow user to compile legacy 8348 code. For new code using Fortran 95 pointers, the memory 8349 de-allocation intrinsic is 'DEALLOCATE'. 8350 8351_Standard_: 8352 GNU extension 8353 8354_Class_: 8355 Subroutine 8356 8357_Syntax_: 8358 'CALL FREE(PTR)' 8359 8360_Arguments_: 8361 PTR The type shall be 'INTEGER'. It represents the 8362 location of the memory that should be 8363 de-allocated. 8364 8365_Return value_: 8366 None 8367 8368_Example_: 8369 See 'MALLOC' for an example. 8370 8371_See also_: 8372 *note MALLOC:: 8373 8374 8375File: gfortran.info, Node: FSEEK, Next: FSTAT, Prev: FREE, Up: Intrinsic Procedures 8376 83778.93 'FSEEK' -- Low level file positioning subroutine 8378===================================================== 8379 8380_Description_: 8381 Moves UNIT to the specified OFFSET. If WHENCE is set to 0, the 8382 OFFSET is taken as an absolute value 'SEEK_SET', if set to 1, 8383 OFFSET is taken to be relative to the current position 'SEEK_CUR', 8384 and if set to 2 relative to the end of the file 'SEEK_END'. On 8385 error, STATUS is set to a nonzero value. If STATUS the seek fails 8386 silently. 8387 8388 This intrinsic routine is not fully backwards compatible with 8389 'g77'. In 'g77', the 'FSEEK' takes a statement label instead of a 8390 STATUS variable. If FSEEK is used in old code, change 8391 CALL FSEEK(UNIT, OFFSET, WHENCE, *label) 8392 to 8393 INTEGER :: status 8394 CALL FSEEK(UNIT, OFFSET, WHENCE, status) 8395 IF (status /= 0) GOTO label 8396 8397 Please note that GNU Fortran provides the Fortran 2003 Stream 8398 facility. Programmers should consider the use of new stream IO 8399 feature in new code for future portability. See also *note Fortran 8400 2003 status::. 8401 8402_Standard_: 8403 GNU extension 8404 8405_Class_: 8406 Subroutine 8407 8408_Syntax_: 8409 'CALL FSEEK(UNIT, OFFSET, WHENCE[, STATUS])' 8410 8411_Arguments_: 8412 UNIT Shall be a scalar of type 'INTEGER'. 8413 OFFSET Shall be a scalar of type 'INTEGER'. 8414 WHENCE Shall be a scalar of type 'INTEGER'. Its value 8415 shall be either 0, 1 or 2. 8416 STATUS (Optional) shall be a scalar of type 8417 'INTEGER(4)'. 8418 8419_Example_: 8420 PROGRAM test_fseek 8421 INTEGER, PARAMETER :: SEEK_SET = 0, SEEK_CUR = 1, SEEK_END = 2 8422 INTEGER :: fd, offset, ierr 8423 8424 ierr = 0 8425 offset = 5 8426 fd = 10 8427 8428 OPEN(UNIT=fd, FILE="fseek.test") 8429 CALL FSEEK(fd, offset, SEEK_SET, ierr) ! move to OFFSET 8430 print *, FTELL(fd), ierr 8431 8432 CALL FSEEK(fd, 0, SEEK_END, ierr) ! move to end 8433 print *, FTELL(fd), ierr 8434 8435 CALL FSEEK(fd, 0, SEEK_SET, ierr) ! move to beginning 8436 print *, FTELL(fd), ierr 8437 8438 CLOSE(UNIT=fd) 8439 END PROGRAM 8440 8441_See also_: 8442 *note FTELL:: 8443 8444 8445File: gfortran.info, Node: FSTAT, Next: FTELL, Prev: FSEEK, Up: Intrinsic Procedures 8446 84478.94 'FSTAT' -- Get file status 8448=============================== 8449 8450_Description_: 8451 'FSTAT' is identical to *note STAT::, except that information about 8452 an already opened file is obtained. 8453 8454 The elements in 'VALUES' are the same as described by *note STAT::. 8455 8456 This intrinsic is provided in both subroutine and function forms; 8457 however, only one form can be used in any given program unit. 8458 8459_Standard_: 8460 GNU extension 8461 8462_Class_: 8463 Subroutine, function 8464 8465_Syntax_: 8466 'CALL FSTAT(UNIT, VALUES [, STATUS])' 8467 'STATUS = FSTAT(UNIT, VALUES)' 8468 8469_Arguments_: 8470 UNIT An open I/O unit number of type 'INTEGER'. 8471 VALUES The type shall be 'INTEGER(4), DIMENSION(13)'. 8472 STATUS (Optional) status flag of type 'INTEGER(4)'. 8473 Returns 0 on success and a system specific error 8474 code otherwise. 8475 8476_Example_: 8477 See *note STAT:: for an example. 8478 8479_See also_: 8480 To stat a link: *note LSTAT::, to stat a file: *note STAT:: 8481 8482 8483File: gfortran.info, Node: FTELL, Next: GAMMA, Prev: FSTAT, Up: Intrinsic Procedures 8484 84858.95 'FTELL' -- Current stream position 8486======================================= 8487 8488_Description_: 8489 Retrieves the current position within an open file. 8490 8491 This intrinsic is provided in both subroutine and function forms; 8492 however, only one form can be used in any given program unit. 8493 8494_Standard_: 8495 GNU extension 8496 8497_Class_: 8498 Subroutine, function 8499 8500_Syntax_: 8501 'CALL FTELL(UNIT, OFFSET)' 8502 'OFFSET = FTELL(UNIT)' 8503 8504_Arguments_: 8505 OFFSET Shall of type 'INTEGER'. 8506 UNIT Shall of type 'INTEGER'. 8507 8508_Return value_: 8509 In either syntax, OFFSET is set to the current offset of unit 8510 number UNIT, or to -1 if the unit is not currently open. 8511 8512_Example_: 8513 PROGRAM test_ftell 8514 INTEGER :: i 8515 OPEN(10, FILE="temp.dat") 8516 CALL ftell(10,i) 8517 WRITE(*,*) i 8518 END PROGRAM 8519 8520_See also_: 8521 *note FSEEK:: 8522 8523 8524File: gfortran.info, Node: GAMMA, Next: GERROR, Prev: FTELL, Up: Intrinsic Procedures 8525 85268.96 'GAMMA' -- Gamma function 8527============================== 8528 8529_Description_: 8530 'GAMMA(X)' computes Gamma (\Gamma) of X. For positive, integer 8531 values of X the Gamma function simplifies to the factorial function 8532 \Gamma(x)=(x-1)!. 8533 8534_Standard_: 8535 Fortran 2008 and later 8536 8537_Class_: 8538 Elemental function 8539 8540_Syntax_: 8541 'X = GAMMA(X)' 8542 8543_Arguments_: 8544 X Shall be of type 'REAL' and neither zero nor a 8545 negative integer. 8546 8547_Return value_: 8548 The return value is of type 'REAL' of the same kind as X. 8549 8550_Example_: 8551 program test_gamma 8552 real :: x = 1.0 8553 x = gamma(x) ! returns 1.0 8554 end program test_gamma 8555 8556_Specific names_: 8557 Name Argument Return type Standard 8558 'GAMMA(X)' 'REAL(4) X' 'REAL(4)' GNU Extension 8559 'DGAMMA(X)' 'REAL(8) X' 'REAL(8)' GNU Extension 8560 8561_See also_: 8562 Logarithm of the Gamma function: *note LOG_GAMMA:: 8563 8564 8565File: gfortran.info, Node: GERROR, Next: GETARG, Prev: GAMMA, Up: Intrinsic Procedures 8566 85678.97 'GERROR' -- Get last system error message 8568============================================== 8569 8570_Description_: 8571 Returns the system error message corresponding to the last system 8572 error. This resembles the functionality of 'strerror(3)' in C. 8573 8574_Standard_: 8575 GNU extension 8576 8577_Class_: 8578 Subroutine 8579 8580_Syntax_: 8581 'CALL GERROR(RESULT)' 8582 8583_Arguments_: 8584 RESULT Shall of type 'CHARACTER' and of default 8585 8586_Example_: 8587 PROGRAM test_gerror 8588 CHARACTER(len=100) :: msg 8589 CALL gerror(msg) 8590 WRITE(*,*) msg 8591 END PROGRAM 8592 8593_See also_: 8594 *note IERRNO::, *note PERROR:: 8595 8596 8597File: gfortran.info, Node: GETARG, Next: GET_COMMAND, Prev: GERROR, Up: Intrinsic Procedures 8598 85998.98 'GETARG' -- Get command line arguments 8600=========================================== 8601 8602_Description_: 8603 Retrieve the POS-th argument that was passed on the command line 8604 when the containing program was invoked. 8605 8606 This intrinsic routine is provided for backwards compatibility with 8607 GNU Fortran 77. In new code, programmers should consider the use 8608 of the *note GET_COMMAND_ARGUMENT:: intrinsic defined by the 8609 Fortran 2003 standard. 8610 8611_Standard_: 8612 GNU extension 8613 8614_Class_: 8615 Subroutine 8616 8617_Syntax_: 8618 'CALL GETARG(POS, VALUE)' 8619 8620_Arguments_: 8621 POS Shall be of type 'INTEGER' and not wider than 8622 the default integer kind; POS \geq 0 8623 VALUE Shall be of type 'CHARACTER' and of default 8624 kind. 8625 VALUE Shall be of type 'CHARACTER'. 8626 8627_Return value_: 8628 After 'GETARG' returns, the VALUE argument holds the POSth command 8629 line argument. If VALUE can not hold the argument, it is truncated 8630 to fit the length of VALUE. If there are less than POS arguments 8631 specified at the command line, VALUE will be filled with blanks. 8632 If POS = 0, VALUE is set to the name of the program (on systems 8633 that support this feature). 8634 8635_Example_: 8636 PROGRAM test_getarg 8637 INTEGER :: i 8638 CHARACTER(len=32) :: arg 8639 8640 DO i = 1, iargc() 8641 CALL getarg(i, arg) 8642 WRITE (*,*) arg 8643 END DO 8644 END PROGRAM 8645 8646_See also_: 8647 GNU Fortran 77 compatibility function: *note IARGC:: 8648 8649 Fortran 2003 functions and subroutines: *note GET_COMMAND::, *note 8650 GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT:: 8651 8652 8653File: gfortran.info, Node: GET_COMMAND, Next: GET_COMMAND_ARGUMENT, Prev: GETARG, Up: Intrinsic Procedures 8654 86558.99 'GET_COMMAND' -- Get the entire command line 8656================================================= 8657 8658_Description_: 8659 Retrieve the entire command line that was used to invoke the 8660 program. 8661 8662_Standard_: 8663 Fortran 2003 and later 8664 8665_Class_: 8666 Subroutine 8667 8668_Syntax_: 8669 'CALL GET_COMMAND([COMMAND, LENGTH, STATUS])' 8670 8671_Arguments_: 8672 COMMAND (Optional) shall be of type 'CHARACTER' and of 8673 default kind. 8674 LENGTH (Optional) Shall be of type 'INTEGER' and of 8675 default kind. 8676 STATUS (Optional) Shall be of type 'INTEGER' and of 8677 default kind. 8678 8679_Return value_: 8680 If COMMAND is present, stores the entire command line that was used 8681 to invoke the program in COMMAND. If LENGTH is present, it is 8682 assigned the length of the command line. If STATUS is present, it 8683 is assigned 0 upon success of the command, -1 if COMMAND is too 8684 short to store the command line, or a positive value in case of an 8685 error. 8686 8687_Example_: 8688 PROGRAM test_get_command 8689 CHARACTER(len=255) :: cmd 8690 CALL get_command(cmd) 8691 WRITE (*,*) TRIM(cmd) 8692 END PROGRAM 8693 8694_See also_: 8695 *note GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT:: 8696 8697 8698File: gfortran.info, Node: GET_COMMAND_ARGUMENT, Next: GETCWD, Prev: GET_COMMAND, Up: Intrinsic Procedures 8699 87008.100 'GET_COMMAND_ARGUMENT' -- Get command line arguments 8701========================================================== 8702 8703_Description_: 8704 Retrieve the NUMBER-th argument that was passed on the command line 8705 when the containing program was invoked. 8706 8707_Standard_: 8708 Fortran 2003 and later 8709 8710_Class_: 8711 Subroutine 8712 8713_Syntax_: 8714 'CALL GET_COMMAND_ARGUMENT(NUMBER [, VALUE, LENGTH, STATUS])' 8715 8716_Arguments_: 8717 NUMBER Shall be a scalar of type 'INTEGER' and of 8718 default kind, NUMBER \geq 0 8719 VALUE (Optional) Shall be a scalar of type 'CHARACTER' 8720 and of default kind. 8721 LENGTH (Optional) Shall be a scalar of type 'INTEGER' 8722 and of default kind. 8723 STATUS (Optional) Shall be a scalar of type 'INTEGER' 8724 and of default kind. 8725 8726_Return value_: 8727 After 'GET_COMMAND_ARGUMENT' returns, the VALUE argument holds the 8728 NUMBER-th command line argument. If VALUE can not hold the 8729 argument, it is truncated to fit the length of VALUE. If there are 8730 less than NUMBER arguments specified at the command line, VALUE 8731 will be filled with blanks. If NUMBER = 0, VALUE is set to the 8732 name of the program (on systems that support this feature). The 8733 LENGTH argument contains the length of the NUMBER-th command line 8734 argument. If the argument retrieval fails, STATUS is a positive 8735 number; if VALUE contains a truncated command line argument, STATUS 8736 is -1; and otherwise the STATUS is zero. 8737 8738_Example_: 8739 PROGRAM test_get_command_argument 8740 INTEGER :: i 8741 CHARACTER(len=32) :: arg 8742 8743 i = 0 8744 DO 8745 CALL get_command_argument(i, arg) 8746 IF (LEN_TRIM(arg) == 0) EXIT 8747 8748 WRITE (*,*) TRIM(arg) 8749 i = i+1 8750 END DO 8751 END PROGRAM 8752 8753_See also_: 8754 *note GET_COMMAND::, *note COMMAND_ARGUMENT_COUNT:: 8755 8756 8757File: gfortran.info, Node: GETCWD, Next: GETENV, Prev: GET_COMMAND_ARGUMENT, Up: Intrinsic Procedures 8758 87598.101 'GETCWD' -- Get current working directory 8760=============================================== 8761 8762_Description_: 8763 Get current working directory. 8764 8765 This intrinsic is provided in both subroutine and function forms; 8766 however, only one form can be used in any given program unit. 8767 8768_Standard_: 8769 GNU extension 8770 8771_Class_: 8772 Subroutine, function 8773 8774_Syntax_: 8775 'CALL GETCWD(C [, STATUS])' 8776 'STATUS = GETCWD(C)' 8777 8778_Arguments_: 8779 C The type shall be 'CHARACTER' and of default 8780 kind. 8781 STATUS (Optional) status flag. Returns 0 on success, a 8782 system specific and nonzero error code 8783 otherwise. 8784 8785_Example_: 8786 PROGRAM test_getcwd 8787 CHARACTER(len=255) :: cwd 8788 CALL getcwd(cwd) 8789 WRITE(*,*) TRIM(cwd) 8790 END PROGRAM 8791 8792_See also_: 8793 *note CHDIR:: 8794 8795 8796File: gfortran.info, Node: GETENV, Next: GET_ENVIRONMENT_VARIABLE, Prev: GETCWD, Up: Intrinsic Procedures 8797 87988.102 'GETENV' -- Get an environmental variable 8799=============================================== 8800 8801_Description_: 8802 Get the VALUE of the environmental variable NAME. 8803 8804 This intrinsic routine is provided for backwards compatibility with 8805 GNU Fortran 77. In new code, programmers should consider the use 8806 of the *note GET_ENVIRONMENT_VARIABLE:: intrinsic defined by the 8807 Fortran 2003 standard. 8808 8809 Note that 'GETENV' need not be thread-safe. It is the 8810 responsibility of the user to ensure that the environment is not 8811 being updated concurrently with a call to the 'GETENV' intrinsic. 8812 8813_Standard_: 8814 GNU extension 8815 8816_Class_: 8817 Subroutine 8818 8819_Syntax_: 8820 'CALL GETENV(NAME, VALUE)' 8821 8822_Arguments_: 8823 NAME Shall be of type 'CHARACTER' and of default 8824 kind. 8825 VALUE Shall be of type 'CHARACTER' and of default 8826 kind. 8827 8828_Return value_: 8829 Stores the value of NAME in VALUE. If VALUE is not large enough to 8830 hold the data, it is truncated. If NAME is not set, VALUE will be 8831 filled with blanks. 8832 8833_Example_: 8834 PROGRAM test_getenv 8835 CHARACTER(len=255) :: homedir 8836 CALL getenv("HOME", homedir) 8837 WRITE (*,*) TRIM(homedir) 8838 END PROGRAM 8839 8840_See also_: 8841 *note GET_ENVIRONMENT_VARIABLE:: 8842 8843 8844File: gfortran.info, Node: GET_ENVIRONMENT_VARIABLE, Next: GETGID, Prev: GETENV, Up: Intrinsic Procedures 8845 88468.103 'GET_ENVIRONMENT_VARIABLE' -- Get an environmental variable 8847================================================================= 8848 8849_Description_: 8850 Get the VALUE of the environmental variable NAME. 8851 8852 Note that 'GET_ENVIRONMENT_VARIABLE' need not be thread-safe. It 8853 is the responsibility of the user to ensure that the environment is 8854 not being updated concurrently with a call to the 8855 'GET_ENVIRONMENT_VARIABLE' intrinsic. 8856 8857_Standard_: 8858 Fortran 2003 and later 8859 8860_Class_: 8861 Subroutine 8862 8863_Syntax_: 8864 'CALL GET_ENVIRONMENT_VARIABLE(NAME[, VALUE, LENGTH, STATUS, 8865 TRIM_NAME)' 8866 8867_Arguments_: 8868 NAME Shall be a scalar of type 'CHARACTER' and of 8869 default kind. 8870 VALUE (Optional) Shall be a scalar of type 'CHARACTER' 8871 and of default kind. 8872 LENGTH (Optional) Shall be a scalar of type 'INTEGER' 8873 and of default kind. 8874 STATUS (Optional) Shall be a scalar of type 'INTEGER' 8875 and of default kind. 8876 TRIM_NAME (Optional) Shall be a scalar of type 'LOGICAL' 8877 and of default kind. 8878 8879_Return value_: 8880 Stores the value of NAME in VALUE. If VALUE is not large enough to 8881 hold the data, it is truncated. If NAME is not set, VALUE will be 8882 filled with blanks. Argument LENGTH contains the length needed for 8883 storing the environment variable NAME or zero if it is not present. 8884 STATUS is -1 if VALUE is present but too short for the environment 8885 variable; it is 1 if the environment variable does not exist and 2 8886 if the processor does not support environment variables; in all 8887 other cases STATUS is zero. If TRIM_NAME is present with the value 8888 '.FALSE.', the trailing blanks in NAME are significant; otherwise 8889 they are not part of the environment variable name. 8890 8891_Example_: 8892 PROGRAM test_getenv 8893 CHARACTER(len=255) :: homedir 8894 CALL get_environment_variable("HOME", homedir) 8895 WRITE (*,*) TRIM(homedir) 8896 END PROGRAM 8897 8898 8899File: gfortran.info, Node: GETGID, Next: GETLOG, Prev: GET_ENVIRONMENT_VARIABLE, Up: Intrinsic Procedures 8900 89018.104 'GETGID' -- Group ID function 8902=================================== 8903 8904_Description_: 8905 Returns the numerical group ID of the current process. 8906 8907_Standard_: 8908 GNU extension 8909 8910_Class_: 8911 Function 8912 8913_Syntax_: 8914 'RESULT = GETGID()' 8915 8916_Return value_: 8917 The return value of 'GETGID' is an 'INTEGER' of the default kind. 8918 8919_Example_: 8920 See 'GETPID' for an example. 8921 8922_See also_: 8923 *note GETPID::, *note GETUID:: 8924 8925 8926File: gfortran.info, Node: GETLOG, Next: GETPID, Prev: GETGID, Up: Intrinsic Procedures 8927 89288.105 'GETLOG' -- Get login name 8929================================ 8930 8931_Description_: 8932 Gets the username under which the program is running. 8933 8934_Standard_: 8935 GNU extension 8936 8937_Class_: 8938 Subroutine 8939 8940_Syntax_: 8941 'CALL GETLOG(C)' 8942 8943_Arguments_: 8944 C Shall be of type 'CHARACTER' and of default 8945 kind. 8946 8947_Return value_: 8948 Stores the current user name in LOGIN. (On systems where POSIX 8949 functions 'geteuid' and 'getpwuid' are not available, and the 8950 'getlogin' function is not implemented either, this will return a 8951 blank string.) 8952 8953_Example_: 8954 PROGRAM TEST_GETLOG 8955 CHARACTER(32) :: login 8956 CALL GETLOG(login) 8957 WRITE(*,*) login 8958 END PROGRAM 8959 8960_See also_: 8961 *note GETUID:: 8962 8963 8964File: gfortran.info, Node: GETPID, Next: GETUID, Prev: GETLOG, Up: Intrinsic Procedures 8965 89668.106 'GETPID' -- Process ID function 8967===================================== 8968 8969_Description_: 8970 Returns the numerical process identifier of the current process. 8971 8972_Standard_: 8973 GNU extension 8974 8975_Class_: 8976 Function 8977 8978_Syntax_: 8979 'RESULT = GETPID()' 8980 8981_Return value_: 8982 The return value of 'GETPID' is an 'INTEGER' of the default kind. 8983 8984_Example_: 8985 program info 8986 print *, "The current process ID is ", getpid() 8987 print *, "Your numerical user ID is ", getuid() 8988 print *, "Your numerical group ID is ", getgid() 8989 end program info 8990 8991_See also_: 8992 *note GETGID::, *note GETUID:: 8993 8994 8995File: gfortran.info, Node: GETUID, Next: GMTIME, Prev: GETPID, Up: Intrinsic Procedures 8996 89978.107 'GETUID' -- User ID function 8998================================== 8999 9000_Description_: 9001 Returns the numerical user ID of the current process. 9002 9003_Standard_: 9004 GNU extension 9005 9006_Class_: 9007 Function 9008 9009_Syntax_: 9010 'RESULT = GETUID()' 9011 9012_Return value_: 9013 The return value of 'GETUID' is an 'INTEGER' of the default kind. 9014 9015_Example_: 9016 See 'GETPID' for an example. 9017 9018_See also_: 9019 *note GETPID::, *note GETLOG:: 9020 9021 9022File: gfortran.info, Node: GMTIME, Next: HOSTNM, Prev: GETUID, Up: Intrinsic Procedures 9023 90248.108 'GMTIME' -- Convert time to GMT info 9025========================================== 9026 9027_Description_: 9028 Given a system time value TIME (as provided by the 'TIME8' 9029 intrinsic), fills VALUES with values extracted from it appropriate 9030 to the UTC time zone (Universal Coordinated Time, also known in 9031 some countries as GMT, Greenwich Mean Time), using 'gmtime(3)'. 9032 9033_Standard_: 9034 GNU extension 9035 9036_Class_: 9037 Subroutine 9038 9039_Syntax_: 9040 'CALL GMTIME(TIME, VALUES)' 9041 9042_Arguments_: 9043 TIME An 'INTEGER' scalar expression corresponding to 9044 a system time, with 'INTENT(IN)'. 9045 VALUES A default 'INTEGER' array with 9 elements, with 9046 'INTENT(OUT)'. 9047 9048_Return value_: 9049 The elements of VALUES are assigned as follows: 9050 1. Seconds after the minute, range 0-59 or 0-61 to allow for leap 9051 seconds 9052 2. Minutes after the hour, range 0-59 9053 3. Hours past midnight, range 0-23 9054 4. Day of month, range 0-31 9055 5. Number of months since January, range 0-12 9056 6. Years since 1900 9057 7. Number of days since Sunday, range 0-6 9058 8. Days since January 1 9059 9. Daylight savings indicator: positive if daylight savings is in 9060 effect, zero if not, and negative if the information is not 9061 available. 9062 9063_See also_: 9064 *note CTIME::, *note LTIME::, *note TIME::, *note TIME8:: 9065 9066 9067File: gfortran.info, Node: HOSTNM, Next: HUGE, Prev: GMTIME, Up: Intrinsic Procedures 9068 90698.109 'HOSTNM' -- Get system host name 9070====================================== 9071 9072_Description_: 9073 Retrieves the host name of the system on which the program is 9074 running. 9075 9076 This intrinsic is provided in both subroutine and function forms; 9077 however, only one form can be used in any given program unit. 9078 9079_Standard_: 9080 GNU extension 9081 9082_Class_: 9083 Subroutine, function 9084 9085_Syntax_: 9086 'CALL HOSTNM(C [, STATUS])' 9087 'STATUS = HOSTNM(NAME)' 9088 9089_Arguments_: 9090 C Shall of type 'CHARACTER' and of default kind. 9091 STATUS (Optional) status flag of type 'INTEGER'. 9092 Returns 0 on success, or a system specific error 9093 code otherwise. 9094 9095_Return value_: 9096 In either syntax, NAME is set to the current hostname if it can be 9097 obtained, or to a blank string otherwise. 9098 9099 9100File: gfortran.info, Node: HUGE, Next: HYPOT, Prev: HOSTNM, Up: Intrinsic Procedures 9101 91028.110 'HUGE' -- Largest number of a kind 9103======================================== 9104 9105_Description_: 9106 'HUGE(X)' returns the largest number that is not an infinity in the 9107 model of the type of 'X'. 9108 9109_Standard_: 9110 Fortran 95 and later 9111 9112_Class_: 9113 Inquiry function 9114 9115_Syntax_: 9116 'RESULT = HUGE(X)' 9117 9118_Arguments_: 9119 X Shall be of type 'REAL' or 'INTEGER'. 9120 9121_Return value_: 9122 The return value is of the same type and kind as X 9123 9124_Example_: 9125 program test_huge_tiny 9126 print *, huge(0), huge(0.0), huge(0.0d0) 9127 print *, tiny(0.0), tiny(0.0d0) 9128 end program test_huge_tiny 9129 9130 9131File: gfortran.info, Node: HYPOT, Next: IACHAR, Prev: HUGE, Up: Intrinsic Procedures 9132 91338.111 'HYPOT' -- Euclidean distance function 9134============================================ 9135 9136_Description_: 9137 'HYPOT(X,Y)' is the Euclidean distance function. It is equal to 9138 \sqrt{X^2 + Y^2}, without undue underflow or overflow. 9139 9140_Standard_: 9141 Fortran 2008 and later 9142 9143_Class_: 9144 Elemental function 9145 9146_Syntax_: 9147 'RESULT = HYPOT(X, Y)' 9148 9149_Arguments_: 9150 X The type shall be 'REAL'. 9151 Y The type and kind type parameter shall be the 9152 same as X. 9153 9154_Return value_: 9155 The return value has the same type and kind type parameter as X. 9156 9157_Example_: 9158 program test_hypot 9159 real(4) :: x = 1.e0_4, y = 0.5e0_4 9160 x = hypot(x,y) 9161 end program test_hypot 9162 9163 9164File: gfortran.info, Node: IACHAR, Next: IALL, Prev: HYPOT, Up: Intrinsic Procedures 9165 91668.112 'IACHAR' -- Code in ASCII collating sequence 9167================================================== 9168 9169_Description_: 9170 'IACHAR(C)' returns the code for the ASCII character in the first 9171 character position of 'C'. 9172 9173_Standard_: 9174 Fortran 95 and later, with KIND argument Fortran 2003 and later 9175 9176_Class_: 9177 Elemental function 9178 9179_Syntax_: 9180 'RESULT = IACHAR(C [, KIND])' 9181 9182_Arguments_: 9183 C Shall be a scalar 'CHARACTER', with 'INTENT(IN)' 9184 KIND (Optional) An 'INTEGER' initialization 9185 expression indicating the kind parameter of the 9186 result. 9187 9188_Return value_: 9189 The return value is of type 'INTEGER' and of kind KIND. If KIND is 9190 absent, the return value is of default integer kind. 9191 9192_Example_: 9193 program test_iachar 9194 integer i 9195 i = iachar(' ') 9196 end program test_iachar 9197 9198_Note_: 9199 See *note ICHAR:: for a discussion of converting between numerical 9200 values and formatted string representations. 9201 9202_See also_: 9203 *note ACHAR::, *note CHAR::, *note ICHAR:: 9204 9205 9206File: gfortran.info, Node: IALL, Next: IAND, Prev: IACHAR, Up: Intrinsic Procedures 9207 92088.113 'IALL' -- Bitwise AND of array elements 9209============================================= 9210 9211_Description_: 9212 Reduces with bitwise AND the elements of ARRAY along dimension DIM 9213 if the corresponding element in MASK is 'TRUE'. 9214 9215_Standard_: 9216 Fortran 2008 and later 9217 9218_Class_: 9219 Transformational function 9220 9221_Syntax_: 9222 'RESULT = IALL(ARRAY[, MASK])' 9223 'RESULT = IALL(ARRAY, DIM[, MASK])' 9224 9225_Arguments_: 9226 ARRAY Shall be an array of type 'INTEGER' 9227 DIM (Optional) shall be a scalar of type 'INTEGER' 9228 with a value in the range from 1 to n, where n 9229 equals the rank of ARRAY. 9230 MASK (Optional) shall be of type 'LOGICAL' and either 9231 be a scalar or an array of the same shape as 9232 ARRAY. 9233 9234_Return value_: 9235 The result is of the same type as ARRAY. 9236 9237 If DIM is absent, a scalar with the bitwise ALL of all elements in 9238 ARRAY is returned. Otherwise, an array of rank n-1, where n equals 9239 the rank of ARRAY, and a shape similar to that of ARRAY with 9240 dimension DIM dropped is returned. 9241 9242_Example_: 9243 PROGRAM test_iall 9244 INTEGER(1) :: a(2) 9245 9246 a(1) = b'00100100' 9247 a(2) = b'01101010' 9248 9249 ! prints 00100000 9250 PRINT '(b8.8)', IALL(a) 9251 END PROGRAM 9252 9253_See also_: 9254 *note IANY::, *note IPARITY::, *note IAND:: 9255 9256 9257File: gfortran.info, Node: IAND, Next: IANY, Prev: IALL, Up: Intrinsic Procedures 9258 92598.114 'IAND' -- Bitwise logical and 9260=================================== 9261 9262_Description_: 9263 Bitwise logical 'AND'. 9264 9265_Standard_: 9266 Fortran 95 and later 9267 9268_Class_: 9269 Elemental function 9270 9271_Syntax_: 9272 'RESULT = IAND(I, J)' 9273 9274_Arguments_: 9275 I The type shall be 'INTEGER'. 9276 J The type shall be 'INTEGER', of the same kind as 9277 I. (As a GNU extension, different kinds are 9278 also permitted.) 9279 9280_Return value_: 9281 The return type is 'INTEGER', of the same kind as the arguments. 9282 (If the argument kinds differ, it is of the same kind as the larger 9283 argument.) 9284 9285_Example_: 9286 PROGRAM test_iand 9287 INTEGER :: a, b 9288 DATA a / Z'F' /, b / Z'3' / 9289 WRITE (*,*) IAND(a, b) 9290 END PROGRAM 9291 9292_See also_: 9293 *note IOR::, *note IEOR::, *note IBITS::, *note IBSET::, *note 9294 IBCLR::, *note NOT:: 9295 9296 9297File: gfortran.info, Node: IANY, Next: IARGC, Prev: IAND, Up: Intrinsic Procedures 9298 92998.115 'IANY' -- Bitwise OR of array elements 9300============================================ 9301 9302_Description_: 9303 Reduces with bitwise OR (inclusive or) the elements of ARRAY along 9304 dimension DIM if the corresponding element in MASK is 'TRUE'. 9305 9306_Standard_: 9307 Fortran 2008 and later 9308 9309_Class_: 9310 Transformational function 9311 9312_Syntax_: 9313 'RESULT = IANY(ARRAY[, MASK])' 9314 'RESULT = IANY(ARRAY, DIM[, MASK])' 9315 9316_Arguments_: 9317 ARRAY Shall be an array of type 'INTEGER' 9318 DIM (Optional) shall be a scalar of type 'INTEGER' 9319 with a value in the range from 1 to n, where n 9320 equals the rank of ARRAY. 9321 MASK (Optional) shall be of type 'LOGICAL' and either 9322 be a scalar or an array of the same shape as 9323 ARRAY. 9324 9325_Return value_: 9326 The result is of the same type as ARRAY. 9327 9328 If DIM is absent, a scalar with the bitwise OR of all elements in 9329 ARRAY is returned. Otherwise, an array of rank n-1, where n equals 9330 the rank of ARRAY, and a shape similar to that of ARRAY with 9331 dimension DIM dropped is returned. 9332 9333_Example_: 9334 PROGRAM test_iany 9335 INTEGER(1) :: a(2) 9336 9337 a(1) = b'00100100' 9338 a(2) = b'01101010' 9339 9340 ! prints 01101110 9341 PRINT '(b8.8)', IANY(a) 9342 END PROGRAM 9343 9344_See also_: 9345 *note IPARITY::, *note IALL::, *note IOR:: 9346 9347 9348File: gfortran.info, Node: IARGC, Next: IBCLR, Prev: IANY, Up: Intrinsic Procedures 9349 93508.116 'IARGC' -- Get the number of command line arguments 9351========================================================= 9352 9353_Description_: 9354 'IARGC' returns the number of arguments passed on the command line 9355 when the containing program was invoked. 9356 9357 This intrinsic routine is provided for backwards compatibility with 9358 GNU Fortran 77. In new code, programmers should consider the use 9359 of the *note COMMAND_ARGUMENT_COUNT:: intrinsic defined by the 9360 Fortran 2003 standard. 9361 9362_Standard_: 9363 GNU extension 9364 9365_Class_: 9366 Function 9367 9368_Syntax_: 9369 'RESULT = IARGC()' 9370 9371_Arguments_: 9372 None. 9373 9374_Return value_: 9375 The number of command line arguments, type 'INTEGER(4)'. 9376 9377_Example_: 9378 See *note GETARG:: 9379 9380_See also_: 9381 GNU Fortran 77 compatibility subroutine: *note GETARG:: 9382 9383 Fortran 2003 functions and subroutines: *note GET_COMMAND::, *note 9384 GET_COMMAND_ARGUMENT::, *note COMMAND_ARGUMENT_COUNT:: 9385 9386 9387File: gfortran.info, Node: IBCLR, Next: IBITS, Prev: IARGC, Up: Intrinsic Procedures 9388 93898.117 'IBCLR' -- Clear bit 9390========================== 9391 9392_Description_: 9393 'IBCLR' returns the value of I with the bit at position POS set to 9394 zero. 9395 9396_Standard_: 9397 Fortran 95 and later 9398 9399_Class_: 9400 Elemental function 9401 9402_Syntax_: 9403 'RESULT = IBCLR(I, POS)' 9404 9405_Arguments_: 9406 I The type shall be 'INTEGER'. 9407 POS The type shall be 'INTEGER'. 9408 9409_Return value_: 9410 The return value is of type 'INTEGER' and of the same kind as I. 9411 9412_See also_: 9413 *note IBITS::, *note IBSET::, *note IAND::, *note IOR::, *note 9414 IEOR::, *note MVBITS:: 9415 9416 9417File: gfortran.info, Node: IBITS, Next: IBSET, Prev: IBCLR, Up: Intrinsic Procedures 9418 94198.118 'IBITS' -- Bit extraction 9420=============================== 9421 9422_Description_: 9423 'IBITS' extracts a field of length LEN from I, starting from bit 9424 position POS and extending left for LEN bits. The result is 9425 right-justified and the remaining bits are zeroed. The value of 9426 'POS+LEN' must be less than or equal to the value 'BIT_SIZE(I)'. 9427 9428_Standard_: 9429 Fortran 95 and later 9430 9431_Class_: 9432 Elemental function 9433 9434_Syntax_: 9435 'RESULT = IBITS(I, POS, LEN)' 9436 9437_Arguments_: 9438 I The type shall be 'INTEGER'. 9439 POS The type shall be 'INTEGER'. 9440 LEN The type shall be 'INTEGER'. 9441 9442_Return value_: 9443 The return value is of type 'INTEGER' and of the same kind as I. 9444 9445_See also_: 9446 *note BIT_SIZE::, *note IBCLR::, *note IBSET::, *note IAND::, *note 9447 IOR::, *note IEOR:: 9448 9449 9450File: gfortran.info, Node: IBSET, Next: ICHAR, Prev: IBITS, Up: Intrinsic Procedures 9451 94528.119 'IBSET' -- Set bit 9453======================== 9454 9455_Description_: 9456 'IBSET' returns the value of I with the bit at position POS set to 9457 one. 9458 9459_Standard_: 9460 Fortran 95 and later 9461 9462_Class_: 9463 Elemental function 9464 9465_Syntax_: 9466 'RESULT = IBSET(I, POS)' 9467 9468_Arguments_: 9469 I The type shall be 'INTEGER'. 9470 POS The type shall be 'INTEGER'. 9471 9472_Return value_: 9473 The return value is of type 'INTEGER' and of the same kind as I. 9474 9475_See also_: 9476 *note IBCLR::, *note IBITS::, *note IAND::, *note IOR::, *note 9477 IEOR::, *note MVBITS:: 9478 9479 9480File: gfortran.info, Node: ICHAR, Next: IDATE, Prev: IBSET, Up: Intrinsic Procedures 9481 94828.120 'ICHAR' -- Character-to-integer conversion function 9483========================================================= 9484 9485_Description_: 9486 'ICHAR(C)' returns the code for the character in the first 9487 character position of 'C' in the system's native character set. 9488 The correspondence between characters and their codes is not 9489 necessarily the same across different GNU Fortran implementations. 9490 9491_Standard_: 9492 Fortran 95 and later, with KIND argument Fortran 2003 and later 9493 9494_Class_: 9495 Elemental function 9496 9497_Syntax_: 9498 'RESULT = ICHAR(C [, KIND])' 9499 9500_Arguments_: 9501 C Shall be a scalar 'CHARACTER', with 'INTENT(IN)' 9502 KIND (Optional) An 'INTEGER' initialization 9503 expression indicating the kind parameter of the 9504 result. 9505 9506_Return value_: 9507 The return value is of type 'INTEGER' and of kind KIND. If KIND is 9508 absent, the return value is of default integer kind. 9509 9510_Example_: 9511 program test_ichar 9512 integer i 9513 i = ichar(' ') 9514 end program test_ichar 9515 9516_Specific names_: 9517 Name Argument Return type Standard 9518 'ICHAR(C)' 'CHARACTER 'INTEGER(4)' Fortran 77 and 9519 C' later 9520 9521_Note_: 9522 No intrinsic exists to convert between a numeric value and a 9523 formatted character string representation - for instance, given the 9524 'CHARACTER' value ''154'', obtaining an 'INTEGER' or 'REAL' value 9525 with the value 154, or vice versa. Instead, this functionality is 9526 provided by internal-file I/O, as in the following example: 9527 program read_val 9528 integer value 9529 character(len=10) string, string2 9530 string = '154' 9531 9532 ! Convert a string to a numeric value 9533 read (string,'(I10)') value 9534 print *, value 9535 9536 ! Convert a value to a formatted string 9537 write (string2,'(I10)') value 9538 print *, string2 9539 end program read_val 9540 9541_See also_: 9542 *note ACHAR::, *note CHAR::, *note IACHAR:: 9543 9544 9545File: gfortran.info, Node: IDATE, Next: IEOR, Prev: ICHAR, Up: Intrinsic Procedures 9546 95478.121 'IDATE' -- Get current local time subroutine (day/month/year) 9548=================================================================== 9549 9550_Description_: 9551 'IDATE(VALUES)' Fills VALUES with the numerical values at the 9552 current local time. The day (in the range 1-31), month (in the 9553 range 1-12), and year appear in elements 1, 2, and 3 of VALUES, 9554 respectively. The year has four significant digits. 9555 9556_Standard_: 9557 GNU extension 9558 9559_Class_: 9560 Subroutine 9561 9562_Syntax_: 9563 'CALL IDATE(VALUES)' 9564 9565_Arguments_: 9566 VALUES The type shall be 'INTEGER, DIMENSION(3)' and 9567 the kind shall be the default integer kind. 9568 9569_Return value_: 9570 Does not return anything. 9571 9572_Example_: 9573 program test_idate 9574 integer, dimension(3) :: tarray 9575 call idate(tarray) 9576 print *, tarray(1) 9577 print *, tarray(2) 9578 print *, tarray(3) 9579 end program test_idate 9580 9581 9582File: gfortran.info, Node: IEOR, Next: IERRNO, Prev: IDATE, Up: Intrinsic Procedures 9583 95848.122 'IEOR' -- Bitwise logical exclusive or 9585============================================ 9586 9587_Description_: 9588 'IEOR' returns the bitwise Boolean exclusive-OR of I and J. 9589 9590_Standard_: 9591 Fortran 95 and later 9592 9593_Class_: 9594 Elemental function 9595 9596_Syntax_: 9597 'RESULT = IEOR(I, J)' 9598 9599_Arguments_: 9600 I The type shall be 'INTEGER'. 9601 J The type shall be 'INTEGER', of the same kind as 9602 I. (As a GNU extension, different kinds are 9603 also permitted.) 9604 9605_Return value_: 9606 The return type is 'INTEGER', of the same kind as the arguments. 9607 (If the argument kinds differ, it is of the same kind as the larger 9608 argument.) 9609 9610_See also_: 9611 *note IOR::, *note IAND::, *note IBITS::, *note IBSET::, *note 9612 IBCLR::, *note NOT:: 9613 9614 9615File: gfortran.info, Node: IERRNO, Next: IMAGE_INDEX, Prev: IEOR, Up: Intrinsic Procedures 9616 96178.123 'IERRNO' -- Get the last system error number 9618================================================== 9619 9620_Description_: 9621 Returns the last system error number, as given by the C 'errno' 9622 variable. 9623 9624_Standard_: 9625 GNU extension 9626 9627_Class_: 9628 Function 9629 9630_Syntax_: 9631 'RESULT = IERRNO()' 9632 9633_Arguments_: 9634 None. 9635 9636_Return value_: 9637 The return value is of type 'INTEGER' and of the default integer 9638 kind. 9639 9640_See also_: 9641 *note PERROR:: 9642 9643 9644File: gfortran.info, Node: IMAGE_INDEX, Next: INDEX intrinsic, Prev: IERRNO, Up: Intrinsic Procedures 9645 96468.124 'IMAGE_INDEX' -- Function that converts a cosubscript to an image index 9647============================================================================= 9648 9649_Description_: 9650 Returns the image index belonging to a cosubscript. 9651 9652_Standard_: 9653 Fortran 2008 and later 9654 9655_Class_: 9656 Inquiry function. 9657 9658_Syntax_: 9659 'RESULT = IMAGE_INDEX(COARRAY, SUB)' 9660 9661_Arguments_: None. 9662 COARRAY Coarray of any type. 9663 SUB default integer rank-1 array of a size equal to 9664 the corank of COARRAY. 9665 9666_Return value_: 9667 Scalar default integer with the value of the image index which 9668 corresponds to the cosubscripts. For invalid cosubscripts the 9669 result is zero. 9670 9671_Example_: 9672 INTEGER :: array[2,-1:4,8,*] 9673 ! Writes 28 (or 0 if there are fewer than 28 images) 9674 WRITE (*,*) IMAGE_INDEX (array, [2,0,3,1]) 9675 9676_See also_: 9677 *note THIS_IMAGE::, *note NUM_IMAGES:: 9678 9679 9680File: gfortran.info, Node: INDEX intrinsic, Next: INT, Prev: IMAGE_INDEX, Up: Intrinsic Procedures 9681 96828.125 'INDEX' -- Position of a substring within a string 9683======================================================== 9684 9685_Description_: 9686 Returns the position of the start of the first occurrence of string 9687 SUBSTRING as a substring in STRING, counting from one. If 9688 SUBSTRING is not present in STRING, zero is returned. If the BACK 9689 argument is present and true, the return value is the start of the 9690 last occurrence rather than the first. 9691 9692_Standard_: 9693 Fortran 77 and later, with KIND argument Fortran 2003 and later 9694 9695_Class_: 9696 Elemental function 9697 9698_Syntax_: 9699 'RESULT = INDEX(STRING, SUBSTRING [, BACK [, KIND]])' 9700 9701_Arguments_: 9702 STRING Shall be a scalar 'CHARACTER', with 'INTENT(IN)' 9703 SUBSTRING Shall be a scalar 'CHARACTER', with 'INTENT(IN)' 9704 BACK (Optional) Shall be a scalar 'LOGICAL', with 9705 'INTENT(IN)' 9706 KIND (Optional) An 'INTEGER' initialization 9707 expression indicating the kind parameter of the 9708 result. 9709 9710_Return value_: 9711 The return value is of type 'INTEGER' and of kind KIND. If KIND is 9712 absent, the return value is of default integer kind. 9713 9714_Specific names_: 9715 Name Argument Return type Standard 9716 'INDEX(STRING, 'CHARACTER' 'INTEGER(4)' Fortran 77 and 9717 SUBSTRING)' later 9718 9719_See also_: 9720 *note SCAN::, *note VERIFY:: 9721 9722 9723File: gfortran.info, Node: INT, Next: INT2, Prev: INDEX intrinsic, Up: Intrinsic Procedures 9724 97258.126 'INT' -- Convert to integer type 9726====================================== 9727 9728_Description_: 9729 Convert to integer type 9730 9731_Standard_: 9732 Fortran 77 and later 9733 9734_Class_: 9735 Elemental function 9736 9737_Syntax_: 9738 'RESULT = INT(A [, KIND))' 9739 9740_Arguments_: 9741 A Shall be of type 'INTEGER', 'REAL', or 9742 'COMPLEX'. 9743 KIND (Optional) An 'INTEGER' initialization 9744 expression indicating the kind parameter of the 9745 result. 9746 9747_Return value_: 9748 These functions return a 'INTEGER' variable or array under the 9749 following rules: 9750 9751 (A) 9752 If A is of type 'INTEGER', 'INT(A) = A' 9753 (B) 9754 If A is of type 'REAL' and |A| < 1, 'INT(A)' equals '0'. If 9755 |A| \geq 1, then 'INT(A)' equals the largest integer that does 9756 not exceed the range of A and whose sign is the same as the 9757 sign of A. 9758 (C) 9759 If A is of type 'COMPLEX', rule B is applied to the real part 9760 of A. 9761 9762_Example_: 9763 program test_int 9764 integer :: i = 42 9765 complex :: z = (-3.7, 1.0) 9766 print *, int(i) 9767 print *, int(z), int(z,8) 9768 end program 9769 9770_Specific names_: 9771 Name Argument Return type Standard 9772 'INT(A)' 'REAL(4) A' 'INTEGER' Fortran 77 and 9773 later 9774 'IFIX(A)' 'REAL(4) A' 'INTEGER' Fortran 77 and 9775 later 9776 'IDINT(A)' 'REAL(8) A' 'INTEGER' Fortran 77 and 9777 later 9778 9779 9780File: gfortran.info, Node: INT2, Next: INT8, Prev: INT, Up: Intrinsic Procedures 9781 97828.127 'INT2' -- Convert to 16-bit integer type 9783============================================== 9784 9785_Description_: 9786 Convert to a 'KIND=2' integer type. This is equivalent to the 9787 standard 'INT' intrinsic with an optional argument of 'KIND=2', and 9788 is only included for backwards compatibility. 9789 9790 The 'SHORT' intrinsic is equivalent to 'INT2'. 9791 9792_Standard_: 9793 GNU extension 9794 9795_Class_: 9796 Elemental function 9797 9798_Syntax_: 9799 'RESULT = INT2(A)' 9800 9801_Arguments_: 9802 A Shall be of type 'INTEGER', 'REAL', or 9803 'COMPLEX'. 9804 9805_Return value_: 9806 The return value is a 'INTEGER(2)' variable. 9807 9808_See also_: 9809 *note INT::, *note INT8::, *note LONG:: 9810 9811 9812File: gfortran.info, Node: INT8, Next: IOR, Prev: INT2, Up: Intrinsic Procedures 9813 98148.128 'INT8' -- Convert to 64-bit integer type 9815============================================== 9816 9817_Description_: 9818 Convert to a 'KIND=8' integer type. This is equivalent to the 9819 standard 'INT' intrinsic with an optional argument of 'KIND=8', and 9820 is only included for backwards compatibility. 9821 9822_Standard_: 9823 GNU extension 9824 9825_Class_: 9826 Elemental function 9827 9828_Syntax_: 9829 'RESULT = INT8(A)' 9830 9831_Arguments_: 9832 A Shall be of type 'INTEGER', 'REAL', or 9833 'COMPLEX'. 9834 9835_Return value_: 9836 The return value is a 'INTEGER(8)' variable. 9837 9838_See also_: 9839 *note INT::, *note INT2::, *note LONG:: 9840 9841 9842File: gfortran.info, Node: IOR, Next: IPARITY, Prev: INT8, Up: Intrinsic Procedures 9843 98448.129 'IOR' -- Bitwise logical or 9845================================= 9846 9847_Description_: 9848 'IOR' returns the bitwise Boolean inclusive-OR of I and J. 9849 9850_Standard_: 9851 Fortran 95 and later 9852 9853_Class_: 9854 Elemental function 9855 9856_Syntax_: 9857 'RESULT = IOR(I, J)' 9858 9859_Arguments_: 9860 I The type shall be 'INTEGER'. 9861 J The type shall be 'INTEGER', of the same kind as 9862 I. (As a GNU extension, different kinds are 9863 also permitted.) 9864 9865_Return value_: 9866 The return type is 'INTEGER', of the same kind as the arguments. 9867 (If the argument kinds differ, it is of the same kind as the larger 9868 argument.) 9869 9870_See also_: 9871 *note IEOR::, *note IAND::, *note IBITS::, *note IBSET::, *note 9872 IBCLR::, *note NOT:: 9873 9874 9875File: gfortran.info, Node: IPARITY, Next: IRAND, Prev: IOR, Up: Intrinsic Procedures 9876 98778.130 'IPARITY' -- Bitwise XOR of array elements 9878================================================ 9879 9880_Description_: 9881 Reduces with bitwise XOR (exclusive or) the elements of ARRAY along 9882 dimension DIM if the corresponding element in MASK is 'TRUE'. 9883 9884_Standard_: 9885 Fortran 2008 and later 9886 9887_Class_: 9888 Transformational function 9889 9890_Syntax_: 9891 'RESULT = IPARITY(ARRAY[, MASK])' 9892 'RESULT = IPARITY(ARRAY, DIM[, MASK])' 9893 9894_Arguments_: 9895 ARRAY Shall be an array of type 'INTEGER' 9896 DIM (Optional) shall be a scalar of type 'INTEGER' 9897 with a value in the range from 1 to n, where n 9898 equals the rank of ARRAY. 9899 MASK (Optional) shall be of type 'LOGICAL' and either 9900 be a scalar or an array of the same shape as 9901 ARRAY. 9902 9903_Return value_: 9904 The result is of the same type as ARRAY. 9905 9906 If DIM is absent, a scalar with the bitwise XOR of all elements in 9907 ARRAY is returned. Otherwise, an array of rank n-1, where n equals 9908 the rank of ARRAY, and a shape similar to that of ARRAY with 9909 dimension DIM dropped is returned. 9910 9911_Example_: 9912 PROGRAM test_iparity 9913 INTEGER(1) :: a(2) 9914 9915 a(1) = b'00100100' 9916 a(2) = b'01101010' 9917 9918 ! prints 01001110 9919 PRINT '(b8.8)', IPARITY(a) 9920 END PROGRAM 9921 9922_See also_: 9923 *note IANY::, *note IALL::, *note IEOR::, *note PARITY:: 9924 9925 9926File: gfortran.info, Node: IRAND, Next: IS_IOSTAT_END, Prev: IPARITY, Up: Intrinsic Procedures 9927 99288.131 'IRAND' -- Integer pseudo-random number 9929============================================= 9930 9931_Description_: 9932 'IRAND(FLAG)' returns a pseudo-random number from a uniform 9933 distribution between 0 and a system-dependent limit (which is in 9934 most cases 2147483647). If FLAG is 0, the next number in the 9935 current sequence is returned; if FLAG is 1, the generator is 9936 restarted by 'CALL SRAND(0)'; if FLAG has any other value, it is 9937 used as a new seed with 'SRAND'. 9938 9939 This intrinsic routine is provided for backwards compatibility with 9940 GNU Fortran 77. It implements a simple modulo generator as 9941 provided by 'g77'. For new code, one should consider the use of 9942 *note RANDOM_NUMBER:: as it implements a superior algorithm. 9943 9944_Standard_: 9945 GNU extension 9946 9947_Class_: 9948 Function 9949 9950_Syntax_: 9951 'RESULT = IRAND(I)' 9952 9953_Arguments_: 9954 I Shall be a scalar 'INTEGER' of kind 4. 9955 9956_Return value_: 9957 The return value is of 'INTEGER(kind=4)' type. 9958 9959_Example_: 9960 program test_irand 9961 integer,parameter :: seed = 86456 9962 9963 call srand(seed) 9964 print *, irand(), irand(), irand(), irand() 9965 print *, irand(seed), irand(), irand(), irand() 9966 end program test_irand 9967 9968 9969File: gfortran.info, Node: IS_IOSTAT_END, Next: IS_IOSTAT_EOR, Prev: IRAND, Up: Intrinsic Procedures 9970 99718.132 'IS_IOSTAT_END' -- Test for end-of-file value 9972=================================================== 9973 9974_Description_: 9975 'IS_IOSTAT_END' tests whether an variable has the value of the I/O 9976 status "end of file". The function is equivalent to comparing the 9977 variable with the 'IOSTAT_END' parameter of the intrinsic module 9978 'ISO_FORTRAN_ENV'. 9979 9980_Standard_: 9981 Fortran 2003 and later 9982 9983_Class_: 9984 Elemental function 9985 9986_Syntax_: 9987 'RESULT = IS_IOSTAT_END(I)' 9988 9989_Arguments_: 9990 I Shall be of the type 'INTEGER'. 9991 9992_Return value_: 9993 Returns a 'LOGICAL' of the default kind, which '.TRUE.' if I has 9994 the value which indicates an end of file condition for 'IOSTAT=' 9995 specifiers, and is '.FALSE.' otherwise. 9996 9997_Example_: 9998 PROGRAM iostat 9999 IMPLICIT NONE 10000 INTEGER :: stat, i 10001 OPEN(88, FILE='test.dat') 10002 READ(88, *, IOSTAT=stat) i 10003 IF(IS_IOSTAT_END(stat)) STOP 'END OF FILE' 10004 END PROGRAM 10005 10006 10007File: gfortran.info, Node: IS_IOSTAT_EOR, Next: ISATTY, Prev: IS_IOSTAT_END, Up: Intrinsic Procedures 10008 100098.133 'IS_IOSTAT_EOR' -- Test for end-of-record value 10010===================================================== 10011 10012_Description_: 10013 'IS_IOSTAT_EOR' tests whether an variable has the value of the I/O 10014 status "end of record". The function is equivalent to comparing 10015 the variable with the 'IOSTAT_EOR' parameter of the intrinsic 10016 module 'ISO_FORTRAN_ENV'. 10017 10018_Standard_: 10019 Fortran 2003 and later 10020 10021_Class_: 10022 Elemental function 10023 10024_Syntax_: 10025 'RESULT = IS_IOSTAT_EOR(I)' 10026 10027_Arguments_: 10028 I Shall be of the type 'INTEGER'. 10029 10030_Return value_: 10031 Returns a 'LOGICAL' of the default kind, which '.TRUE.' if I has 10032 the value which indicates an end of file condition for 'IOSTAT=' 10033 specifiers, and is '.FALSE.' otherwise. 10034 10035_Example_: 10036 PROGRAM iostat 10037 IMPLICIT NONE 10038 INTEGER :: stat, i(50) 10039 OPEN(88, FILE='test.dat', FORM='UNFORMATTED') 10040 READ(88, IOSTAT=stat) i 10041 IF(IS_IOSTAT_EOR(stat)) STOP 'END OF RECORD' 10042 END PROGRAM 10043 10044 10045File: gfortran.info, Node: ISATTY, Next: ISHFT, Prev: IS_IOSTAT_EOR, Up: Intrinsic Procedures 10046 100478.134 'ISATTY' -- Whether a unit is a terminal device. 10048====================================================== 10049 10050_Description_: 10051 Determine whether a unit is connected to a terminal device. 10052 10053_Standard_: 10054 GNU extension 10055 10056_Class_: 10057 Function 10058 10059_Syntax_: 10060 'RESULT = ISATTY(UNIT)' 10061 10062_Arguments_: 10063 UNIT Shall be a scalar 'INTEGER'. 10064 10065_Return value_: 10066 Returns '.TRUE.' if the UNIT is connected to a terminal device, 10067 '.FALSE.' otherwise. 10068 10069_Example_: 10070 PROGRAM test_isatty 10071 INTEGER(kind=1) :: unit 10072 DO unit = 1, 10 10073 write(*,*) isatty(unit=unit) 10074 END DO 10075 END PROGRAM 10076_See also_: 10077 *note TTYNAM:: 10078 10079 10080File: gfortran.info, Node: ISHFT, Next: ISHFTC, Prev: ISATTY, Up: Intrinsic Procedures 10081 100828.135 'ISHFT' -- Shift bits 10083=========================== 10084 10085_Description_: 10086 'ISHFT' returns a value corresponding to I with all of the bits 10087 shifted SHIFT places. A value of SHIFT greater than zero 10088 corresponds to a left shift, a value of zero corresponds to no 10089 shift, and a value less than zero corresponds to a right shift. If 10090 the absolute value of SHIFT is greater than 'BIT_SIZE(I)', the 10091 value is undefined. Bits shifted out from the left end or right 10092 end are lost; zeros are shifted in from the opposite end. 10093 10094_Standard_: 10095 Fortran 95 and later 10096 10097_Class_: 10098 Elemental function 10099 10100_Syntax_: 10101 'RESULT = ISHFT(I, SHIFT)' 10102 10103_Arguments_: 10104 I The type shall be 'INTEGER'. 10105 SHIFT The type shall be 'INTEGER'. 10106 10107_Return value_: 10108 The return value is of type 'INTEGER' and of the same kind as I. 10109 10110_See also_: 10111 *note ISHFTC:: 10112 10113 10114File: gfortran.info, Node: ISHFTC, Next: ISNAN, Prev: ISHFT, Up: Intrinsic Procedures 10115 101168.136 'ISHFTC' -- Shift bits circularly 10117======================================= 10118 10119_Description_: 10120 'ISHFTC' returns a value corresponding to I with the rightmost SIZE 10121 bits shifted circularly SHIFT places; that is, bits shifted out one 10122 end are shifted into the opposite end. A value of SHIFT greater 10123 than zero corresponds to a left shift, a value of zero corresponds 10124 to no shift, and a value less than zero corresponds to a right 10125 shift. The absolute value of SHIFT must be less than SIZE. If the 10126 SIZE argument is omitted, it is taken to be equivalent to 10127 'BIT_SIZE(I)'. 10128 10129_Standard_: 10130 Fortran 95 and later 10131 10132_Class_: 10133 Elemental function 10134 10135_Syntax_: 10136 'RESULT = ISHFTC(I, SHIFT [, SIZE])' 10137 10138_Arguments_: 10139 I The type shall be 'INTEGER'. 10140 SHIFT The type shall be 'INTEGER'. 10141 SIZE (Optional) The type shall be 'INTEGER'; the 10142 value must be greater than zero and less than or 10143 equal to 'BIT_SIZE(I)'. 10144 10145_Return value_: 10146 The return value is of type 'INTEGER' and of the same kind as I. 10147 10148_See also_: 10149 *note ISHFT:: 10150 10151 10152File: gfortran.info, Node: ISNAN, Next: ITIME, Prev: ISHFTC, Up: Intrinsic Procedures 10153 101548.137 'ISNAN' -- Test for a NaN 10155=============================== 10156 10157_Description_: 10158 'ISNAN' tests whether a floating-point value is an IEEE 10159 Not-a-Number (NaN). 10160_Standard_: 10161 GNU extension 10162 10163_Class_: 10164 Elemental function 10165 10166_Syntax_: 10167 'ISNAN(X)' 10168 10169_Arguments_: 10170 X Variable of the type 'REAL'. 10171 10172 10173_Return value_: 10174 Returns a default-kind 'LOGICAL'. The returned value is 'TRUE' if 10175 X is a NaN and 'FALSE' otherwise. 10176 10177_Example_: 10178 program test_nan 10179 implicit none 10180 real :: x 10181 x = -1.0 10182 x = sqrt(x) 10183 if (isnan(x)) stop '"x" is a NaN' 10184 end program test_nan 10185 10186 10187File: gfortran.info, Node: ITIME, Next: KILL, Prev: ISNAN, Up: Intrinsic Procedures 10188 101898.138 'ITIME' -- Get current local time subroutine (hour/minutes/seconds) 10190========================================================================= 10191 10192_Description_: 10193 'IDATE(VALUES)' Fills VALUES with the numerical values at the 10194 current local time. The hour (in the range 1-24), minute (in the 10195 range 1-60), and seconds (in the range 1-60) appear in elements 1, 10196 2, and 3 of VALUES, respectively. 10197 10198_Standard_: 10199 GNU extension 10200 10201_Class_: 10202 Subroutine 10203 10204_Syntax_: 10205 'CALL ITIME(VALUES)' 10206 10207_Arguments_: 10208 VALUES The type shall be 'INTEGER, DIMENSION(3)' and 10209 the kind shall be the default integer kind. 10210 10211_Return value_: 10212 Does not return anything. 10213 10214_Example_: 10215 program test_itime 10216 integer, dimension(3) :: tarray 10217 call itime(tarray) 10218 print *, tarray(1) 10219 print *, tarray(2) 10220 print *, tarray(3) 10221 end program test_itime 10222 10223 10224File: gfortran.info, Node: KILL, Next: KIND, Prev: ITIME, Up: Intrinsic Procedures 10225 102268.139 'KILL' -- Send a signal to a process 10227========================================== 10228 10229_Description_: 10230_Standard_: 10231 Sends the signal specified by SIGNAL to the process PID. See 10232 'kill(2)'. 10233 10234 This intrinsic is provided in both subroutine and function forms; 10235 however, only one form can be used in any given program unit. 10236 10237_Class_: 10238 Subroutine, function 10239 10240_Syntax_: 10241 'CALL KILL(C, VALUE [, STATUS])' 10242 'STATUS = KILL(C, VALUE)' 10243 10244_Arguments_: 10245 C Shall be a scalar 'INTEGER', with 'INTENT(IN)' 10246 VALUE Shall be a scalar 'INTEGER', with 'INTENT(IN)' 10247 STATUS (Optional) status flag of type 'INTEGER(4)' or 10248 'INTEGER(8)'. Returns 0 on success, or a 10249 system-specific error code otherwise. 10250 10251_See also_: 10252 *note ABORT::, *note EXIT:: 10253 10254 10255File: gfortran.info, Node: KIND, Next: LBOUND, Prev: KILL, Up: Intrinsic Procedures 10256 102578.140 'KIND' -- Kind of an entity 10258================================= 10259 10260_Description_: 10261 'KIND(X)' returns the kind value of the entity X. 10262 10263_Standard_: 10264 Fortran 95 and later 10265 10266_Class_: 10267 Inquiry function 10268 10269_Syntax_: 10270 'K = KIND(X)' 10271 10272_Arguments_: 10273 X Shall be of type 'LOGICAL', 'INTEGER', 'REAL', 10274 'COMPLEX' or 'CHARACTER'. 10275 10276_Return value_: 10277 The return value is a scalar of type 'INTEGER' and of the default 10278 integer kind. 10279 10280_Example_: 10281 program test_kind 10282 integer,parameter :: kc = kind(' ') 10283 integer,parameter :: kl = kind(.true.) 10284 10285 print *, "The default character kind is ", kc 10286 print *, "The default logical kind is ", kl 10287 end program test_kind 10288 10289 10290File: gfortran.info, Node: LBOUND, Next: LCOBOUND, Prev: KIND, Up: Intrinsic Procedures 10291 102928.141 'LBOUND' -- Lower dimension bounds of an array 10293==================================================== 10294 10295_Description_: 10296 Returns the lower bounds of an array, or a single lower bound along 10297 the DIM dimension. 10298_Standard_: 10299 Fortran 95 and later, with KIND argument Fortran 2003 and later 10300 10301_Class_: 10302 Inquiry function 10303 10304_Syntax_: 10305 'RESULT = LBOUND(ARRAY [, DIM [, KIND]])' 10306 10307_Arguments_: 10308 ARRAY Shall be an array, of any type. 10309 DIM (Optional) Shall be a scalar 'INTEGER'. 10310 KIND (Optional) An 'INTEGER' initialization 10311 expression indicating the kind parameter of the 10312 result. 10313 10314_Return value_: 10315 The return value is of type 'INTEGER' and of kind KIND. If KIND is 10316 absent, the return value is of default integer kind. If DIM is 10317 absent, the result is an array of the lower bounds of ARRAY. If 10318 DIM is present, the result is a scalar corresponding to the lower 10319 bound of the array along that dimension. If ARRAY is an expression 10320 rather than a whole array or array structure component, or if it 10321 has a zero extent along the relevant dimension, the lower bound is 10322 taken to be 1. 10323 10324_See also_: 10325 *note UBOUND::, *note LCOBOUND:: 10326 10327 10328File: gfortran.info, Node: LCOBOUND, Next: LEADZ, Prev: LBOUND, Up: Intrinsic Procedures 10329 103308.142 'LCOBOUND' -- Lower codimension bounds of an array 10331======================================================== 10332 10333_Description_: 10334 Returns the lower bounds of a coarray, or a single lower cobound 10335 along the DIM codimension. 10336_Standard_: 10337 Fortran 2008 and later 10338 10339_Class_: 10340 Inquiry function 10341 10342_Syntax_: 10343 'RESULT = LCOBOUND(COARRAY [, DIM [, KIND]])' 10344 10345_Arguments_: 10346 ARRAY Shall be an coarray, of any type. 10347 DIM (Optional) Shall be a scalar 'INTEGER'. 10348 KIND (Optional) An 'INTEGER' initialization 10349 expression indicating the kind parameter of the 10350 result. 10351 10352_Return value_: 10353 The return value is of type 'INTEGER' and of kind KIND. If KIND is 10354 absent, the return value is of default integer kind. If DIM is 10355 absent, the result is an array of the lower cobounds of COARRAY. 10356 If DIM is present, the result is a scalar corresponding to the 10357 lower cobound of the array along that codimension. 10358 10359_See also_: 10360 *note UCOBOUND::, *note LBOUND:: 10361 10362 10363File: gfortran.info, Node: LEADZ, Next: LEN, Prev: LCOBOUND, Up: Intrinsic Procedures 10364 103658.143 'LEADZ' -- Number of leading zero bits of an integer 10366========================================================== 10367 10368_Description_: 10369 'LEADZ' returns the number of leading zero bits of an integer. 10370 10371_Standard_: 10372 Fortran 2008 and later 10373 10374_Class_: 10375 Elemental function 10376 10377_Syntax_: 10378 'RESULT = LEADZ(I)' 10379 10380_Arguments_: 10381 I Shall be of type 'INTEGER'. 10382 10383_Return value_: 10384 The type of the return value is the default 'INTEGER'. If all the 10385 bits of 'I' are zero, the result value is 'BIT_SIZE(I)'. 10386 10387_Example_: 10388 PROGRAM test_leadz 10389 WRITE (*,*) BIT_SIZE(1) ! prints 32 10390 WRITE (*,*) LEADZ(1) ! prints 31 10391 END PROGRAM 10392 10393_See also_: 10394 *note BIT_SIZE::, *note TRAILZ::, *note POPCNT::, *note POPPAR:: 10395 10396 10397File: gfortran.info, Node: LEN, Next: LEN_TRIM, Prev: LEADZ, Up: Intrinsic Procedures 10398 103998.144 'LEN' -- Length of a character entity 10400=========================================== 10401 10402_Description_: 10403 Returns the length of a character string. If STRING is an array, 10404 the length of an element of STRING is returned. Note that STRING 10405 need not be defined when this intrinsic is invoked, since only the 10406 length, not the content, of STRING is needed. 10407 10408_Standard_: 10409 Fortran 77 and later, with KIND argument Fortran 2003 and later 10410 10411_Class_: 10412 Inquiry function 10413 10414_Syntax_: 10415 'L = LEN(STRING [, KIND])' 10416 10417_Arguments_: 10418 STRING Shall be a scalar or array of type 'CHARACTER', 10419 with 'INTENT(IN)' 10420 KIND (Optional) An 'INTEGER' initialization 10421 expression indicating the kind parameter of the 10422 result. 10423 10424_Return value_: 10425 The return value is of type 'INTEGER' and of kind KIND. If KIND is 10426 absent, the return value is of default integer kind. 10427 10428_Specific names_: 10429 Name Argument Return type Standard 10430 'LEN(STRING)' 'CHARACTER' 'INTEGER' Fortran 77 and 10431 later 10432 10433_See also_: 10434 *note LEN_TRIM::, *note ADJUSTL::, *note ADJUSTR:: 10435 10436 10437File: gfortran.info, Node: LEN_TRIM, Next: LGE, Prev: LEN, Up: Intrinsic Procedures 10438 104398.145 'LEN_TRIM' -- Length of a character entity without trailing blank characters 10440================================================================================== 10441 10442_Description_: 10443 Returns the length of a character string, ignoring any trailing 10444 blanks. 10445 10446_Standard_: 10447 Fortran 95 and later, with KIND argument Fortran 2003 and later 10448 10449_Class_: 10450 Elemental function 10451 10452_Syntax_: 10453 'RESULT = LEN_TRIM(STRING [, KIND])' 10454 10455_Arguments_: 10456 STRING Shall be a scalar of type 'CHARACTER', with 10457 'INTENT(IN)' 10458 KIND (Optional) An 'INTEGER' initialization 10459 expression indicating the kind parameter of the 10460 result. 10461 10462_Return value_: 10463 The return value is of type 'INTEGER' and of kind KIND. If KIND is 10464 absent, the return value is of default integer kind. 10465 10466_See also_: 10467 *note LEN::, *note ADJUSTL::, *note ADJUSTR:: 10468 10469 10470File: gfortran.info, Node: LGE, Next: LGT, Prev: LEN_TRIM, Up: Intrinsic Procedures 10471 104728.146 'LGE' -- Lexical greater than or equal 10473============================================ 10474 10475_Description_: 10476 Determines whether one string is lexically greater than or equal to 10477 another string, where the two strings are interpreted as containing 10478 ASCII character codes. If the String A and String B are not the 10479 same length, the shorter is compared as if spaces were appended to 10480 it to form a value that has the same length as the longer. 10481 10482 In general, the lexical comparison intrinsics 'LGE', 'LGT', 'LLE', 10483 and 'LLT' differ from the corresponding intrinsic operators '.GE.', 10484 '.GT.', '.LE.', and '.LT.', in that the latter use the processor's 10485 character ordering (which is not ASCII on some targets), whereas 10486 the former always use the ASCII ordering. 10487 10488_Standard_: 10489 Fortran 77 and later 10490 10491_Class_: 10492 Elemental function 10493 10494_Syntax_: 10495 'RESULT = LGE(STRING_A, STRING_B)' 10496 10497_Arguments_: 10498 STRING_A Shall be of default 'CHARACTER' type. 10499 STRING_B Shall be of default 'CHARACTER' type. 10500 10501_Return value_: 10502 Returns '.TRUE.' if 'STRING_A >= STRING_B', and '.FALSE.' 10503 otherwise, based on the ASCII ordering. 10504 10505_Specific names_: 10506 Name Argument Return type Standard 10507 'LGE(STRING_A, 'CHARACTER' 'LOGICAL' Fortran 77 and 10508 STRING_B)' later 10509 10510_See also_: 10511 *note LGT::, *note LLE::, *note LLT:: 10512 10513 10514File: gfortran.info, Node: LGT, Next: LINK, Prev: LGE, Up: Intrinsic Procedures 10515 105168.147 'LGT' -- Lexical greater than 10517=================================== 10518 10519_Description_: 10520 Determines whether one string is lexically greater than another 10521 string, where the two strings are interpreted as containing ASCII 10522 character codes. If the String A and String B are not the same 10523 length, the shorter is compared as if spaces were appended to it to 10524 form a value that has the same length as the longer. 10525 10526 In general, the lexical comparison intrinsics 'LGE', 'LGT', 'LLE', 10527 and 'LLT' differ from the corresponding intrinsic operators '.GE.', 10528 '.GT.', '.LE.', and '.LT.', in that the latter use the processor's 10529 character ordering (which is not ASCII on some targets), whereas 10530 the former always use the ASCII ordering. 10531 10532_Standard_: 10533 Fortran 77 and later 10534 10535_Class_: 10536 Elemental function 10537 10538_Syntax_: 10539 'RESULT = LGT(STRING_A, STRING_B)' 10540 10541_Arguments_: 10542 STRING_A Shall be of default 'CHARACTER' type. 10543 STRING_B Shall be of default 'CHARACTER' type. 10544 10545_Return value_: 10546 Returns '.TRUE.' if 'STRING_A > STRING_B', and '.FALSE.' otherwise, 10547 based on the ASCII ordering. 10548 10549_Specific names_: 10550 Name Argument Return type Standard 10551 'LGT(STRING_A, 'CHARACTER' 'LOGICAL' Fortran 77 and 10552 STRING_B)' later 10553 10554_See also_: 10555 *note LGE::, *note LLE::, *note LLT:: 10556 10557 10558File: gfortran.info, Node: LINK, Next: LLE, Prev: LGT, Up: Intrinsic Procedures 10559 105608.148 'LINK' -- Create a hard link 10561================================== 10562 10563_Description_: 10564 Makes a (hard) link from file PATH1 to PATH2. A null character 10565 ('CHAR(0)') can be used to mark the end of the names in PATH1 and 10566 PATH2; otherwise, trailing blanks in the file names are ignored. 10567 If the STATUS argument is supplied, it contains 0 on success or a 10568 nonzero error code upon return; see 'link(2)'. 10569 10570 This intrinsic is provided in both subroutine and function forms; 10571 however, only one form can be used in any given program unit. 10572 10573_Standard_: 10574 GNU extension 10575 10576_Class_: 10577 Subroutine, function 10578 10579_Syntax_: 10580 'CALL LINK(PATH1, PATH2 [, STATUS])' 10581 'STATUS = LINK(PATH1, PATH2)' 10582 10583_Arguments_: 10584 PATH1 Shall be of default 'CHARACTER' type. 10585 PATH2 Shall be of default 'CHARACTER' type. 10586 STATUS (Optional) Shall be of default 'INTEGER' type. 10587 10588_See also_: 10589 *note SYMLNK::, *note UNLINK:: 10590 10591 10592File: gfortran.info, Node: LLE, Next: LLT, Prev: LINK, Up: Intrinsic Procedures 10593 105948.149 'LLE' -- Lexical less than or equal 10595========================================= 10596 10597_Description_: 10598 Determines whether one string is lexically less than or equal to 10599 another string, where the two strings are interpreted as containing 10600 ASCII character codes. If the String A and String B are not the 10601 same length, the shorter is compared as if spaces were appended to 10602 it to form a value that has the same length as the longer. 10603 10604 In general, the lexical comparison intrinsics 'LGE', 'LGT', 'LLE', 10605 and 'LLT' differ from the corresponding intrinsic operators '.GE.', 10606 '.GT.', '.LE.', and '.LT.', in that the latter use the processor's 10607 character ordering (which is not ASCII on some targets), whereas 10608 the former always use the ASCII ordering. 10609 10610_Standard_: 10611 Fortran 77 and later 10612 10613_Class_: 10614 Elemental function 10615 10616_Syntax_: 10617 'RESULT = LLE(STRING_A, STRING_B)' 10618 10619_Arguments_: 10620 STRING_A Shall be of default 'CHARACTER' type. 10621 STRING_B Shall be of default 'CHARACTER' type. 10622 10623_Return value_: 10624 Returns '.TRUE.' if 'STRING_A <= STRING_B', and '.FALSE.' 10625 otherwise, based on the ASCII ordering. 10626 10627_Specific names_: 10628 Name Argument Return type Standard 10629 'LLE(STRING_A, 'CHARACTER' 'LOGICAL' Fortran 77 and 10630 STRING_B)' later 10631 10632_See also_: 10633 *note LGE::, *note LGT::, *note LLT:: 10634 10635 10636File: gfortran.info, Node: LLT, Next: LNBLNK, Prev: LLE, Up: Intrinsic Procedures 10637 106388.150 'LLT' -- Lexical less than 10639================================ 10640 10641_Description_: 10642 Determines whether one string is lexically less than another 10643 string, where the two strings are interpreted as containing ASCII 10644 character codes. If the String A and String B are not the same 10645 length, the shorter is compared as if spaces were appended to it to 10646 form a value that has the same length as the longer. 10647 10648 In general, the lexical comparison intrinsics 'LGE', 'LGT', 'LLE', 10649 and 'LLT' differ from the corresponding intrinsic operators '.GE.', 10650 '.GT.', '.LE.', and '.LT.', in that the latter use the processor's 10651 character ordering (which is not ASCII on some targets), whereas 10652 the former always use the ASCII ordering. 10653 10654_Standard_: 10655 Fortran 77 and later 10656 10657_Class_: 10658 Elemental function 10659 10660_Syntax_: 10661 'RESULT = LLT(STRING_A, STRING_B)' 10662 10663_Arguments_: 10664 STRING_A Shall be of default 'CHARACTER' type. 10665 STRING_B Shall be of default 'CHARACTER' type. 10666 10667_Return value_: 10668 Returns '.TRUE.' if 'STRING_A < STRING_B', and '.FALSE.' otherwise, 10669 based on the ASCII ordering. 10670 10671_Specific names_: 10672 Name Argument Return type Standard 10673 'LLT(STRING_A, 'CHARACTER' 'LOGICAL' Fortran 77 and 10674 STRING_B)' later 10675 10676_See also_: 10677 *note LGE::, *note LGT::, *note LLE:: 10678 10679 10680File: gfortran.info, Node: LNBLNK, Next: LOC, Prev: LLT, Up: Intrinsic Procedures 10681 106828.151 'LNBLNK' -- Index of the last non-blank character in a string 10683=================================================================== 10684 10685_Description_: 10686 Returns the length of a character string, ignoring any trailing 10687 blanks. This is identical to the standard 'LEN_TRIM' intrinsic, 10688 and is only included for backwards compatibility. 10689 10690_Standard_: 10691 GNU extension 10692 10693_Class_: 10694 Elemental function 10695 10696_Syntax_: 10697 'RESULT = LNBLNK(STRING)' 10698 10699_Arguments_: 10700 STRING Shall be a scalar of type 'CHARACTER', with 10701 'INTENT(IN)' 10702 10703_Return value_: 10704 The return value is of 'INTEGER(kind=4)' type. 10705 10706_See also_: 10707 *note INDEX intrinsic::, *note LEN_TRIM:: 10708 10709 10710File: gfortran.info, Node: LOC, Next: LOG, Prev: LNBLNK, Up: Intrinsic Procedures 10711 107128.152 'LOC' -- Returns the address of a variable 10713================================================ 10714 10715_Description_: 10716 'LOC(X)' returns the address of X as an integer. 10717 10718_Standard_: 10719 GNU extension 10720 10721_Class_: 10722 Inquiry function 10723 10724_Syntax_: 10725 'RESULT = LOC(X)' 10726 10727_Arguments_: 10728 X Variable of any type. 10729 10730_Return value_: 10731 The return value is of type 'INTEGER', with a 'KIND' corresponding 10732 to the size (in bytes) of a memory address on the target machine. 10733 10734_Example_: 10735 program test_loc 10736 integer :: i 10737 real :: r 10738 i = loc(r) 10739 print *, i 10740 end program test_loc 10741 10742 10743File: gfortran.info, Node: LOG, Next: LOG10, Prev: LOC, Up: Intrinsic Procedures 10744 107458.153 'LOG' -- Natural logarithm function 10746========================================= 10747 10748_Description_: 10749 'LOG(X)' computes the natural logarithm of X, i.e. the logarithm 10750 to the base e. 10751 10752_Standard_: 10753 Fortran 77 and later 10754 10755_Class_: 10756 Elemental function 10757 10758_Syntax_: 10759 'RESULT = LOG(X)' 10760 10761_Arguments_: 10762 X The type shall be 'REAL' or 'COMPLEX'. 10763 10764_Return value_: 10765 The return value is of type 'REAL' or 'COMPLEX'. The kind type 10766 parameter is the same as X. If X is 'COMPLEX', the imaginary part 10767 \omega is in the range -\pi \leq \omega \leq \pi. 10768 10769_Example_: 10770 program test_log 10771 real(8) :: x = 2.7182818284590451_8 10772 complex :: z = (1.0, 2.0) 10773 x = log(x) ! will yield (approximately) 1 10774 z = log(z) 10775 end program test_log 10776 10777_Specific names_: 10778 Name Argument Return type Standard 10779 'ALOG(X)' 'REAL(4) X' 'REAL(4)' f95, gnu 10780 'DLOG(X)' 'REAL(8) X' 'REAL(8)' f95, gnu 10781 'CLOG(X)' 'COMPLEX(4) 'COMPLEX(4)' f95, gnu 10782 X' 10783 'ZLOG(X)' 'COMPLEX(8) 'COMPLEX(8)' f95, gnu 10784 X' 10785 'CDLOG(X)' 'COMPLEX(8) 'COMPLEX(8)' f95, gnu 10786 X' 10787 10788 10789File: gfortran.info, Node: LOG10, Next: LOG_GAMMA, Prev: LOG, Up: Intrinsic Procedures 10790 107918.154 'LOG10' -- Base 10 logarithm function 10792=========================================== 10793 10794_Description_: 10795 'LOG10(X)' computes the base 10 logarithm of X. 10796 10797_Standard_: 10798 Fortran 77 and later 10799 10800_Class_: 10801 Elemental function 10802 10803_Syntax_: 10804 'RESULT = LOG10(X)' 10805 10806_Arguments_: 10807 X The type shall be 'REAL'. 10808 10809_Return value_: 10810 The return value is of type 'REAL' or 'COMPLEX'. The kind type 10811 parameter is the same as X. 10812 10813_Example_: 10814 program test_log10 10815 real(8) :: x = 10.0_8 10816 x = log10(x) 10817 end program test_log10 10818 10819_Specific names_: 10820 Name Argument Return type Standard 10821 'ALOG10(X)' 'REAL(4) X' 'REAL(4)' Fortran 95 and 10822 later 10823 'DLOG10(X)' 'REAL(8) X' 'REAL(8)' Fortran 95 and 10824 later 10825 10826 10827File: gfortran.info, Node: LOG_GAMMA, Next: LOGICAL, Prev: LOG10, Up: Intrinsic Procedures 10828 108298.155 'LOG_GAMMA' -- Logarithm of the Gamma function 10830==================================================== 10831 10832_Description_: 10833 'LOG_GAMMA(X)' computes the natural logarithm of the absolute value 10834 of the Gamma (\Gamma) function. 10835 10836_Standard_: 10837 Fortran 2008 and later 10838 10839_Class_: 10840 Elemental function 10841 10842_Syntax_: 10843 'X = LOG_GAMMA(X)' 10844 10845_Arguments_: 10846 X Shall be of type 'REAL' and neither zero nor a 10847 negative integer. 10848 10849_Return value_: 10850 The return value is of type 'REAL' of the same kind as X. 10851 10852_Example_: 10853 program test_log_gamma 10854 real :: x = 1.0 10855 x = lgamma(x) ! returns 0.0 10856 end program test_log_gamma 10857 10858_Specific names_: 10859 Name Argument Return type Standard 10860 'LGAMMA(X)' 'REAL(4) X' 'REAL(4)' GNU Extension 10861 'ALGAMA(X)' 'REAL(4) X' 'REAL(4)' GNU Extension 10862 'DLGAMA(X)' 'REAL(8) X' 'REAL(8)' GNU Extension 10863 10864_See also_: 10865 Gamma function: *note GAMMA:: 10866 10867 10868File: gfortran.info, Node: LOGICAL, Next: LONG, Prev: LOG_GAMMA, Up: Intrinsic Procedures 10869 108708.156 'LOGICAL' -- Convert to logical type 10871========================================== 10872 10873_Description_: 10874 Converts one kind of 'LOGICAL' variable to another. 10875 10876_Standard_: 10877 Fortran 95 and later 10878 10879_Class_: 10880 Elemental function 10881 10882_Syntax_: 10883 'RESULT = LOGICAL(L [, KIND])' 10884 10885_Arguments_: 10886 L The type shall be 'LOGICAL'. 10887 KIND (Optional) An 'INTEGER' initialization 10888 expression indicating the kind parameter of the 10889 result. 10890 10891_Return value_: 10892 The return value is a 'LOGICAL' value equal to L, with a kind 10893 corresponding to KIND, or of the default logical kind if KIND is 10894 not given. 10895 10896_See also_: 10897 *note INT::, *note REAL::, *note CMPLX:: 10898 10899 10900File: gfortran.info, Node: LONG, Next: LSHIFT, Prev: LOGICAL, Up: Intrinsic Procedures 10901 109028.157 'LONG' -- Convert to integer type 10903======================================= 10904 10905_Description_: 10906 Convert to a 'KIND=4' integer type, which is the same size as a C 10907 'long' integer. This is equivalent to the standard 'INT' intrinsic 10908 with an optional argument of 'KIND=4', and is only included for 10909 backwards compatibility. 10910 10911_Standard_: 10912 GNU extension 10913 10914_Class_: 10915 Elemental function 10916 10917_Syntax_: 10918 'RESULT = LONG(A)' 10919 10920_Arguments_: 10921 A Shall be of type 'INTEGER', 'REAL', or 10922 'COMPLEX'. 10923 10924_Return value_: 10925 The return value is a 'INTEGER(4)' variable. 10926 10927_See also_: 10928 *note INT::, *note INT2::, *note INT8:: 10929 10930 10931File: gfortran.info, Node: LSHIFT, Next: LSTAT, Prev: LONG, Up: Intrinsic Procedures 10932 109338.158 'LSHIFT' -- Left shift bits 10934================================= 10935 10936_Description_: 10937 'LSHIFT' returns a value corresponding to I with all of the bits 10938 shifted left by SHIFT places. If the absolute value of SHIFT is 10939 greater than 'BIT_SIZE(I)', the value is undefined. Bits shifted 10940 out from the left end are lost; zeros are shifted in from the 10941 opposite end. 10942 10943 This function has been superseded by the 'ISHFT' intrinsic, which 10944 is standard in Fortran 95 and later, and the 'SHIFTL' intrinsic, 10945 which is standard in Fortran 2008 and later. 10946 10947_Standard_: 10948 GNU extension 10949 10950_Class_: 10951 Elemental function 10952 10953_Syntax_: 10954 'RESULT = LSHIFT(I, SHIFT)' 10955 10956_Arguments_: 10957 I The type shall be 'INTEGER'. 10958 SHIFT The type shall be 'INTEGER'. 10959 10960_Return value_: 10961 The return value is of type 'INTEGER' and of the same kind as I. 10962 10963_See also_: 10964 *note ISHFT::, *note ISHFTC::, *note RSHIFT::, *note SHIFTA::, 10965 *note SHIFTL::, *note SHIFTR:: 10966 10967 10968File: gfortran.info, Node: LSTAT, Next: LTIME, Prev: LSHIFT, Up: Intrinsic Procedures 10969 109708.159 'LSTAT' -- Get file status 10971================================ 10972 10973_Description_: 10974 'LSTAT' is identical to *note STAT::, except that if path is a 10975 symbolic link, then the link itself is statted, not the file that 10976 it refers to. 10977 10978 The elements in 'VALUES' are the same as described by *note STAT::. 10979 10980 This intrinsic is provided in both subroutine and function forms; 10981 however, only one form can be used in any given program unit. 10982 10983_Standard_: 10984 GNU extension 10985 10986_Class_: 10987 Subroutine, function 10988 10989_Syntax_: 10990 'CALL LSTAT(NAME, VALUES [, STATUS])' 10991 'STATUS = LSTAT(NAME, VALUES)' 10992 10993_Arguments_: 10994 NAME The type shall be 'CHARACTER' of the default 10995 kind, a valid path within the file system. 10996 VALUES The type shall be 'INTEGER(4), DIMENSION(13)'. 10997 STATUS (Optional) status flag of type 'INTEGER(4)'. 10998 Returns 0 on success and a system specific error 10999 code otherwise. 11000 11001_Example_: 11002 See *note STAT:: for an example. 11003 11004_See also_: 11005 To stat an open file: *note FSTAT::, to stat a file: *note STAT:: 11006 11007 11008File: gfortran.info, Node: LTIME, Next: MALLOC, Prev: LSTAT, Up: Intrinsic Procedures 11009 110108.160 'LTIME' -- Convert time to local time info 11011================================================ 11012 11013_Description_: 11014 Given a system time value TIME (as provided by the 'TIME8' 11015 intrinsic), fills VALUES with values extracted from it appropriate 11016 to the local time zone using 'localtime(3)'. 11017 11018_Standard_: 11019 GNU extension 11020 11021_Class_: 11022 Subroutine 11023 11024_Syntax_: 11025 'CALL LTIME(TIME, VALUES)' 11026 11027_Arguments_: 11028 TIME An 'INTEGER' scalar expression corresponding to 11029 a system time, with 'INTENT(IN)'. 11030 VALUES A default 'INTEGER' array with 9 elements, with 11031 'INTENT(OUT)'. 11032 11033_Return value_: 11034 The elements of VALUES are assigned as follows: 11035 1. Seconds after the minute, range 0-59 or 0-61 to allow for leap 11036 seconds 11037 2. Minutes after the hour, range 0-59 11038 3. Hours past midnight, range 0-23 11039 4. Day of month, range 0-31 11040 5. Number of months since January, range 0-12 11041 6. Years since 1900 11042 7. Number of days since Sunday, range 0-6 11043 8. Days since January 1 11044 9. Daylight savings indicator: positive if daylight savings is in 11045 effect, zero if not, and negative if the information is not 11046 available. 11047 11048_See also_: 11049 *note CTIME::, *note GMTIME::, *note TIME::, *note TIME8:: 11050 11051 11052File: gfortran.info, Node: MALLOC, Next: MASKL, Prev: LTIME, Up: Intrinsic Procedures 11053 110548.161 'MALLOC' -- Allocate dynamic memory 11055========================================= 11056 11057_Description_: 11058 'MALLOC(SIZE)' allocates SIZE bytes of dynamic memory and returns 11059 the address of the allocated memory. The 'MALLOC' intrinsic is an 11060 extension intended to be used with Cray pointers, and is provided 11061 in GNU Fortran to allow the user to compile legacy code. For new 11062 code using Fortran 95 pointers, the memory allocation intrinsic is 11063 'ALLOCATE'. 11064 11065_Standard_: 11066 GNU extension 11067 11068_Class_: 11069 Function 11070 11071_Syntax_: 11072 'PTR = MALLOC(SIZE)' 11073 11074_Arguments_: 11075 SIZE The type shall be 'INTEGER'. 11076 11077_Return value_: 11078 The return value is of type 'INTEGER(K)', with K such that 11079 variables of type 'INTEGER(K)' have the same size as C pointers 11080 ('sizeof(void *)'). 11081 11082_Example_: 11083 The following example demonstrates the use of 'MALLOC' and 'FREE' 11084 with Cray pointers. 11085 11086 program test_malloc 11087 implicit none 11088 integer i 11089 real*8 x(*), z 11090 pointer(ptr_x,x) 11091 11092 ptr_x = malloc(20*8) 11093 do i = 1, 20 11094 x(i) = sqrt(1.0d0 / i) 11095 end do 11096 z = 0 11097 do i = 1, 20 11098 z = z + x(i) 11099 print *, z 11100 end do 11101 call free(ptr_x) 11102 end program test_malloc 11103 11104_See also_: 11105 *note FREE:: 11106 11107 11108File: gfortran.info, Node: MASKL, Next: MASKR, Prev: MALLOC, Up: Intrinsic Procedures 11109 111108.162 'MASKL' -- Left justified mask 11111==================================== 11112 11113_Description_: 11114 'MASKL(I[, KIND])' has its leftmost I bits set to 1, and the 11115 remaining bits set to 0. 11116 11117_Standard_: 11118 Fortran 2008 and later 11119 11120_Class_: 11121 Elemental function 11122 11123_Syntax_: 11124 'RESULT = MASKL(I[, KIND])' 11125 11126_Arguments_: 11127 I Shall be of type 'INTEGER'. 11128 KIND Shall be a scalar constant expression of type 11129 'INTEGER'. 11130 11131_Return value_: 11132 The return value is of type 'INTEGER'. If KIND is present, it 11133 specifies the kind value of the return type; otherwise, it is of 11134 the default integer kind. 11135 11136_See also_: 11137 *note MASKR:: 11138 11139 11140File: gfortran.info, Node: MASKR, Next: MATMUL, Prev: MASKL, Up: Intrinsic Procedures 11141 111428.163 'MASKR' -- Right justified mask 11143===================================== 11144 11145_Description_: 11146 'MASKL(I[, KIND])' has its rightmost I bits set to 1, and the 11147 remaining bits set to 0. 11148 11149_Standard_: 11150 Fortran 2008 and later 11151 11152_Class_: 11153 Elemental function 11154 11155_Syntax_: 11156 'RESULT = MASKR(I[, KIND])' 11157 11158_Arguments_: 11159 I Shall be of type 'INTEGER'. 11160 KIND Shall be a scalar constant expression of type 11161 'INTEGER'. 11162 11163_Return value_: 11164 The return value is of type 'INTEGER'. If KIND is present, it 11165 specifies the kind value of the return type; otherwise, it is of 11166 the default integer kind. 11167 11168_See also_: 11169 *note MASKL:: 11170 11171 11172File: gfortran.info, Node: MATMUL, Next: MAX, Prev: MASKR, Up: Intrinsic Procedures 11173 111748.164 'MATMUL' -- matrix multiplication 11175======================================= 11176 11177_Description_: 11178 Performs a matrix multiplication on numeric or logical arguments. 11179 11180_Standard_: 11181 Fortran 95 and later 11182 11183_Class_: 11184 Transformational function 11185 11186_Syntax_: 11187 'RESULT = MATMUL(MATRIX_A, MATRIX_B)' 11188 11189_Arguments_: 11190 MATRIX_A An array of 'INTEGER', 'REAL', 'COMPLEX', or 11191 'LOGICAL' type, with a rank of one or two. 11192 MATRIX_B An array of 'INTEGER', 'REAL', or 'COMPLEX' type 11193 if MATRIX_A is of a numeric type; otherwise, an 11194 array of 'LOGICAL' type. The rank shall be one 11195 or two, and the first (or only) dimension of 11196 MATRIX_B shall be equal to the last (or only) 11197 dimension of MATRIX_A. 11198 11199_Return value_: 11200 The matrix product of MATRIX_A and MATRIX_B. The type and kind of 11201 the result follow the usual type and kind promotion rules, as for 11202 the '*' or '.AND.' operators. 11203 11204_See also_: 11205 11206 11207File: gfortran.info, Node: MAX, Next: MAXEXPONENT, Prev: MATMUL, Up: Intrinsic Procedures 11208 112098.165 'MAX' -- Maximum value of an argument list 11210================================================ 11211 11212_Description_: 11213 Returns the argument with the largest (most positive) value. 11214 11215_Standard_: 11216 Fortran 77 and later 11217 11218_Class_: 11219 Elemental function 11220 11221_Syntax_: 11222 'RESULT = MAX(A1, A2 [, A3 [, ...]])' 11223 11224_Arguments_: 11225 A1 The type shall be 'INTEGER' or 'REAL'. 11226 A2, A3, An expression of the same type and kind as A1. 11227 ... (As a GNU extension, arguments of different 11228 kinds are permitted.) 11229 11230_Return value_: 11231 The return value corresponds to the maximum value among the 11232 arguments, and has the same type and kind as the first argument. 11233 11234_Specific names_: 11235 Name Argument Return type Standard 11236 'MAX0(A1)' 'INTEGER(4) 'INTEGER(4)' Fortran 77 and 11237 A1' later 11238 'AMAX0(A1)' 'INTEGER(4) 'REAL(MAX(X))' Fortran 77 and 11239 A1' later 11240 'MAX1(A1)' 'REAL A1' 'INT(MAX(X))' Fortran 77 and 11241 later 11242 'AMAX1(A1)' 'REAL(4) A1' 'REAL(4)' Fortran 77 and 11243 later 11244 'DMAX1(A1)' 'REAL(8) A1' 'REAL(8)' Fortran 77 and 11245 later 11246 11247_See also_: 11248 *note MAXLOC:: *note MAXVAL::, *note MIN:: 11249 11250 11251File: gfortran.info, Node: MAXEXPONENT, Next: MAXLOC, Prev: MAX, Up: Intrinsic Procedures 11252 112538.166 'MAXEXPONENT' -- Maximum exponent of a real kind 11254====================================================== 11255 11256_Description_: 11257 'MAXEXPONENT(X)' returns the maximum exponent in the model of the 11258 type of 'X'. 11259 11260_Standard_: 11261 Fortran 95 and later 11262 11263_Class_: 11264 Inquiry function 11265 11266_Syntax_: 11267 'RESULT = MAXEXPONENT(X)' 11268 11269_Arguments_: 11270 X Shall be of type 'REAL'. 11271 11272_Return value_: 11273 The return value is of type 'INTEGER' and of the default integer 11274 kind. 11275 11276_Example_: 11277 program exponents 11278 real(kind=4) :: x 11279 real(kind=8) :: y 11280 11281 print *, minexponent(x), maxexponent(x) 11282 print *, minexponent(y), maxexponent(y) 11283 end program exponents 11284 11285 11286File: gfortran.info, Node: MAXLOC, Next: MAXVAL, Prev: MAXEXPONENT, Up: Intrinsic Procedures 11287 112888.167 'MAXLOC' -- Location of the maximum value within an array 11289=============================================================== 11290 11291_Description_: 11292 Determines the location of the element in the array with the 11293 maximum value, or, if the DIM argument is supplied, determines the 11294 locations of the maximum element along each row of the array in the 11295 DIM direction. If MASK is present, only the elements for which 11296 MASK is '.TRUE.' are considered. If more than one element in the 11297 array has the maximum value, the location returned is that of the 11298 first such element in array element order. If the array has zero 11299 size, or all of the elements of MASK are '.FALSE.', then the result 11300 is an array of zeroes. Similarly, if DIM is supplied and all of 11301 the elements of MASK along a given row are zero, the result value 11302 for that row is zero. 11303 11304_Standard_: 11305 Fortran 95 and later 11306 11307_Class_: 11308 Transformational function 11309 11310_Syntax_: 11311 'RESULT = MAXLOC(ARRAY, DIM [, MASK])' 11312 'RESULT = MAXLOC(ARRAY [, MASK])' 11313 11314_Arguments_: 11315 ARRAY Shall be an array of type 'INTEGER' or 'REAL'. 11316 DIM (Optional) Shall be a scalar of type 'INTEGER', 11317 with a value between one and the rank of ARRAY, 11318 inclusive. It may not be an optional dummy 11319 argument. 11320 MASK Shall be an array of type 'LOGICAL', and 11321 conformable with ARRAY. 11322 11323_Return value_: 11324 If DIM is absent, the result is a rank-one array with a length 11325 equal to the rank of ARRAY. If DIM is present, the result is an 11326 array with a rank one less than the rank of ARRAY, and a size 11327 corresponding to the size of ARRAY with the DIM dimension removed. 11328 If DIM is present and ARRAY has a rank of one, the result is a 11329 scalar. In all cases, the result is of default 'INTEGER' type. 11330 11331_See also_: 11332 *note MAX::, *note MAXVAL:: 11333 11334 11335File: gfortran.info, Node: MAXVAL, Next: MCLOCK, Prev: MAXLOC, Up: Intrinsic Procedures 11336 113378.168 'MAXVAL' -- Maximum value of an array 11338=========================================== 11339 11340_Description_: 11341 Determines the maximum value of the elements in an array value, or, 11342 if the DIM argument is supplied, determines the maximum value along 11343 each row of the array in the DIM direction. If MASK is present, 11344 only the elements for which MASK is '.TRUE.' are considered. If 11345 the array has zero size, or all of the elements of MASK are 11346 '.FALSE.', then the result is '-HUGE(ARRAY)' if ARRAY is numeric, 11347 or a string of nulls if ARRAY is of character type. 11348 11349_Standard_: 11350 Fortran 95 and later 11351 11352_Class_: 11353 Transformational function 11354 11355_Syntax_: 11356 'RESULT = MAXVAL(ARRAY, DIM [, MASK])' 11357 'RESULT = MAXVAL(ARRAY [, MASK])' 11358 11359_Arguments_: 11360 ARRAY Shall be an array of type 'INTEGER' or 'REAL'. 11361 DIM (Optional) Shall be a scalar of type 'INTEGER', 11362 with a value between one and the rank of ARRAY, 11363 inclusive. It may not be an optional dummy 11364 argument. 11365 MASK Shall be an array of type 'LOGICAL', and 11366 conformable with ARRAY. 11367 11368_Return value_: 11369 If DIM is absent, or if ARRAY has a rank of one, the result is a 11370 scalar. If DIM is present, the result is an array with a rank one 11371 less than the rank of ARRAY, and a size corresponding to the size 11372 of ARRAY with the DIM dimension removed. In all cases, the result 11373 is of the same type and kind as ARRAY. 11374 11375_See also_: 11376 *note MAX::, *note MAXLOC:: 11377 11378 11379File: gfortran.info, Node: MCLOCK, Next: MCLOCK8, Prev: MAXVAL, Up: Intrinsic Procedures 11380 113818.169 'MCLOCK' -- Time function 11382=============================== 11383 11384_Description_: 11385 Returns the number of clock ticks since the start of the process, 11386 based on the function 'clock(3)' in the C standard library. 11387 11388 This intrinsic is not fully portable, such as to systems with 11389 32-bit 'INTEGER' types but supporting times wider than 32 bits. 11390 Therefore, the values returned by this intrinsic might be, or 11391 become, negative, or numerically less than previous values, during 11392 a single run of the compiled program. 11393 11394_Standard_: 11395 GNU extension 11396 11397_Class_: 11398 Function 11399 11400_Syntax_: 11401 'RESULT = MCLOCK()' 11402 11403_Return value_: 11404 The return value is a scalar of type 'INTEGER(4)', equal to the 11405 number of clock ticks since the start of the process, or '-1' if 11406 the system does not support 'clock(3)'. 11407 11408_See also_: 11409 *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::, *note 11410 TIME:: 11411 11412 11413File: gfortran.info, Node: MCLOCK8, Next: MERGE, Prev: MCLOCK, Up: Intrinsic Procedures 11414 114158.170 'MCLOCK8' -- Time function (64-bit) 11416========================================= 11417 11418_Description_: 11419 Returns the number of clock ticks since the start of the process, 11420 based on the function 'clock(3)' in the C standard library. 11421 11422 _Warning:_ this intrinsic does not increase the range of the timing 11423 values over that returned by 'clock(3)'. On a system with a 32-bit 11424 'clock(3)', 'MCLOCK8' will return a 32-bit value, even though it is 11425 converted to a 64-bit 'INTEGER(8)' value. That means overflows of 11426 the 32-bit value can still occur. Therefore, the values returned 11427 by this intrinsic might be or become negative or numerically less 11428 than previous values during a single run of the compiled program. 11429 11430_Standard_: 11431 GNU extension 11432 11433_Class_: 11434 Function 11435 11436_Syntax_: 11437 'RESULT = MCLOCK8()' 11438 11439_Return value_: 11440 The return value is a scalar of type 'INTEGER(8)', equal to the 11441 number of clock ticks since the start of the process, or '-1' if 11442 the system does not support 'clock(3)'. 11443 11444_See also_: 11445 *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::, *note 11446 TIME8:: 11447 11448 11449File: gfortran.info, Node: MERGE, Next: MERGE_BITS, Prev: MCLOCK8, Up: Intrinsic Procedures 11450 114518.171 'MERGE' -- Merge variables 11452================================ 11453 11454_Description_: 11455 Select values from two arrays according to a logical mask. The 11456 result is equal to TSOURCE if MASK is '.TRUE.', or equal to FSOURCE 11457 if it is '.FALSE.'. 11458 11459_Standard_: 11460 Fortran 95 and later 11461 11462_Class_: 11463 Elemental function 11464 11465_Syntax_: 11466 'RESULT = MERGE(TSOURCE, FSOURCE, MASK)' 11467 11468_Arguments_: 11469 TSOURCE May be of any type. 11470 FSOURCE Shall be of the same type and type parameters as 11471 TSOURCE. 11472 MASK Shall be of type 'LOGICAL'. 11473 11474_Return value_: 11475 The result is of the same type and type parameters as TSOURCE. 11476 11477 11478File: gfortran.info, Node: MERGE_BITS, Next: MIN, Prev: MERGE, Up: Intrinsic Procedures 11479 114808.172 'MERGE_BITS' -- Merge of bits under mask 11481============================================== 11482 11483_Description_: 11484 'MERGE_BITS(I, J, MASK)' merges the bits of I and J as determined 11485 by the mask. The i-th bit of the result is equal to the i-th bit 11486 of I if the i-th bit of MASK is 1; it is equal to the i-th bit of J 11487 otherwise. 11488 11489_Standard_: 11490 Fortran 2008 and later 11491 11492_Class_: 11493 Elemental function 11494 11495_Syntax_: 11496 'RESULT = MERGE_BITS(I, J, MASK)' 11497 11498_Arguments_: 11499 I Shall be of type 'INTEGER'. 11500 J Shall be of type 'INTEGER' and of the same kind 11501 as I. 11502 MASK Shall be of type 'INTEGER' and of the same kind 11503 as I. 11504 11505_Return value_: 11506 The result is of the same type and kind as I. 11507 11508 11509File: gfortran.info, Node: MIN, Next: MINEXPONENT, Prev: MERGE_BITS, Up: Intrinsic Procedures 11510 115118.173 'MIN' -- Minimum value of an argument list 11512================================================ 11513 11514_Description_: 11515 Returns the argument with the smallest (most negative) value. 11516 11517_Standard_: 11518 Fortran 77 and later 11519 11520_Class_: 11521 Elemental function 11522 11523_Syntax_: 11524 'RESULT = MIN(A1, A2 [, A3, ...])' 11525 11526_Arguments_: 11527 A1 The type shall be 'INTEGER' or 'REAL'. 11528 A2, A3, An expression of the same type and kind as A1. 11529 ... (As a GNU extension, arguments of different 11530 kinds are permitted.) 11531 11532_Return value_: 11533 The return value corresponds to the maximum value among the 11534 arguments, and has the same type and kind as the first argument. 11535 11536_Specific names_: 11537 Name Argument Return type Standard 11538 'MIN0(A1)' 'INTEGER(4) 'INTEGER(4)' Fortran 77 and 11539 A1' later 11540 'AMIN0(A1)' 'INTEGER(4) 'REAL(4)' Fortran 77 and 11541 A1' later 11542 'MIN1(A1)' 'REAL A1' 'INTEGER(4)' Fortran 77 and 11543 later 11544 'AMIN1(A1)' 'REAL(4) A1' 'REAL(4)' Fortran 77 and 11545 later 11546 'DMIN1(A1)' 'REAL(8) A1' 'REAL(8)' Fortran 77 and 11547 later 11548 11549_See also_: 11550 *note MAX::, *note MINLOC::, *note MINVAL:: 11551 11552 11553File: gfortran.info, Node: MINEXPONENT, Next: MINLOC, Prev: MIN, Up: Intrinsic Procedures 11554 115558.174 'MINEXPONENT' -- Minimum exponent of a real kind 11556====================================================== 11557 11558_Description_: 11559 'MINEXPONENT(X)' returns the minimum exponent in the model of the 11560 type of 'X'. 11561 11562_Standard_: 11563 Fortran 95 and later 11564 11565_Class_: 11566 Inquiry function 11567 11568_Syntax_: 11569 'RESULT = MINEXPONENT(X)' 11570 11571_Arguments_: 11572 X Shall be of type 'REAL'. 11573 11574_Return value_: 11575 The return value is of type 'INTEGER' and of the default integer 11576 kind. 11577 11578_Example_: 11579 See 'MAXEXPONENT' for an example. 11580 11581 11582File: gfortran.info, Node: MINLOC, Next: MINVAL, Prev: MINEXPONENT, Up: Intrinsic Procedures 11583 115848.175 'MINLOC' -- Location of the minimum value within an array 11585=============================================================== 11586 11587_Description_: 11588 Determines the location of the element in the array with the 11589 minimum value, or, if the DIM argument is supplied, determines the 11590 locations of the minimum element along each row of the array in the 11591 DIM direction. If MASK is present, only the elements for which 11592 MASK is '.TRUE.' are considered. If more than one element in the 11593 array has the minimum value, the location returned is that of the 11594 first such element in array element order. If the array has zero 11595 size, or all of the elements of MASK are '.FALSE.', then the result 11596 is an array of zeroes. Similarly, if DIM is supplied and all of 11597 the elements of MASK along a given row are zero, the result value 11598 for that row is zero. 11599 11600_Standard_: 11601 Fortran 95 and later 11602 11603_Class_: 11604 Transformational function 11605 11606_Syntax_: 11607 'RESULT = MINLOC(ARRAY, DIM [, MASK])' 11608 'RESULT = MINLOC(ARRAY [, MASK])' 11609 11610_Arguments_: 11611 ARRAY Shall be an array of type 'INTEGER' or 'REAL'. 11612 DIM (Optional) Shall be a scalar of type 'INTEGER', 11613 with a value between one and the rank of ARRAY, 11614 inclusive. It may not be an optional dummy 11615 argument. 11616 MASK Shall be an array of type 'LOGICAL', and 11617 conformable with ARRAY. 11618 11619_Return value_: 11620 If DIM is absent, the result is a rank-one array with a length 11621 equal to the rank of ARRAY. If DIM is present, the result is an 11622 array with a rank one less than the rank of ARRAY, and a size 11623 corresponding to the size of ARRAY with the DIM dimension removed. 11624 If DIM is present and ARRAY has a rank of one, the result is a 11625 scalar. In all cases, the result is of default 'INTEGER' type. 11626 11627_See also_: 11628 *note MIN::, *note MINVAL:: 11629 11630 11631File: gfortran.info, Node: MINVAL, Next: MOD, Prev: MINLOC, Up: Intrinsic Procedures 11632 116338.176 'MINVAL' -- Minimum value of an array 11634=========================================== 11635 11636_Description_: 11637 Determines the minimum value of the elements in an array value, or, 11638 if the DIM argument is supplied, determines the minimum value along 11639 each row of the array in the DIM direction. If MASK is present, 11640 only the elements for which MASK is '.TRUE.' are considered. If 11641 the array has zero size, or all of the elements of MASK are 11642 '.FALSE.', then the result is 'HUGE(ARRAY)' if ARRAY is numeric, or 11643 a string of 'CHAR(255)' characters if ARRAY is of character type. 11644 11645_Standard_: 11646 Fortran 95 and later 11647 11648_Class_: 11649 Transformational function 11650 11651_Syntax_: 11652 'RESULT = MINVAL(ARRAY, DIM [, MASK])' 11653 'RESULT = MINVAL(ARRAY [, MASK])' 11654 11655_Arguments_: 11656 ARRAY Shall be an array of type 'INTEGER' or 'REAL'. 11657 DIM (Optional) Shall be a scalar of type 'INTEGER', 11658 with a value between one and the rank of ARRAY, 11659 inclusive. It may not be an optional dummy 11660 argument. 11661 MASK Shall be an array of type 'LOGICAL', and 11662 conformable with ARRAY. 11663 11664_Return value_: 11665 If DIM is absent, or if ARRAY has a rank of one, the result is a 11666 scalar. If DIM is present, the result is an array with a rank one 11667 less than the rank of ARRAY, and a size corresponding to the size 11668 of ARRAY with the DIM dimension removed. In all cases, the result 11669 is of the same type and kind as ARRAY. 11670 11671_See also_: 11672 *note MIN::, *note MINLOC:: 11673 11674 11675File: gfortran.info, Node: MOD, Next: MODULO, Prev: MINVAL, Up: Intrinsic Procedures 11676 116778.177 'MOD' -- Remainder function 11678================================= 11679 11680_Description_: 11681 'MOD(A,P)' computes the remainder of the division of A by P. 11682 11683_Standard_: 11684 Fortran 77 and later 11685 11686_Class_: 11687 Elemental function 11688 11689_Syntax_: 11690 'RESULT = MOD(A, P)' 11691 11692_Arguments_: 11693 A Shall be a scalar of type 'INTEGER' or 'REAL'. 11694 P Shall be a scalar of the same type and kind as A 11695 and not equal to zero. 11696 11697_Return value_: 11698 The return value is the result of 'A - (INT(A/P) * P)'. The type 11699 and kind of the return value is the same as that of the arguments. 11700 The returned value has the same sign as A and a magnitude less than 11701 the magnitude of P. 11702 11703_Example_: 11704 program test_mod 11705 print *, mod(17,3) 11706 print *, mod(17.5,5.5) 11707 print *, mod(17.5d0,5.5) 11708 print *, mod(17.5,5.5d0) 11709 11710 print *, mod(-17,3) 11711 print *, mod(-17.5,5.5) 11712 print *, mod(-17.5d0,5.5) 11713 print *, mod(-17.5,5.5d0) 11714 11715 print *, mod(17,-3) 11716 print *, mod(17.5,-5.5) 11717 print *, mod(17.5d0,-5.5) 11718 print *, mod(17.5,-5.5d0) 11719 end program test_mod 11720 11721_Specific names_: 11722 Name Arguments Return type Standard 11723 'MOD(A,P)' 'INTEGER 'INTEGER' Fortran 95 and 11724 A,P' later 11725 'AMOD(A,P)' 'REAL(4) 'REAL(4)' Fortran 95 and 11726 A,P' later 11727 'DMOD(A,P)' 'REAL(8) 'REAL(8)' Fortran 95 and 11728 A,P' later 11729 11730_See also_: 11731 *note MODULO:: 11732 11733 11734File: gfortran.info, Node: MODULO, Next: MOVE_ALLOC, Prev: MOD, Up: Intrinsic Procedures 11735 117368.178 'MODULO' -- Modulo function 11737================================= 11738 11739_Description_: 11740 'MODULO(A,P)' computes the A modulo P. 11741 11742_Standard_: 11743 Fortran 95 and later 11744 11745_Class_: 11746 Elemental function 11747 11748_Syntax_: 11749 'RESULT = MODULO(A, P)' 11750 11751_Arguments_: 11752 A Shall be a scalar of type 'INTEGER' or 'REAL'. 11753 P Shall be a scalar of the same type and kind as 11754 A. It shall not be zero. 11755 11756_Return value_: 11757 The type and kind of the result are those of the arguments. 11758 If A and P are of type 'INTEGER': 11759 'MODULO(A,P)' has the value R such that 'A=Q*P+R', where Q is 11760 an integer and R is between 0 (inclusive) and P (exclusive). 11761 If A and P are of type 'REAL': 11762 'MODULO(A,P)' has the value of 'A - FLOOR (A / P) * P'. 11763 The returned value has the same sign as P and a magnitude less than 11764 the magnitude of P. 11765 11766_Example_: 11767 program test_modulo 11768 print *, modulo(17,3) 11769 print *, modulo(17.5,5.5) 11770 11771 print *, modulo(-17,3) 11772 print *, modulo(-17.5,5.5) 11773 11774 print *, modulo(17,-3) 11775 print *, modulo(17.5,-5.5) 11776 end program 11777 11778_See also_: 11779 *note MOD:: 11780 11781 11782File: gfortran.info, Node: MOVE_ALLOC, Next: MVBITS, Prev: MODULO, Up: Intrinsic Procedures 11783 117848.179 'MOVE_ALLOC' -- Move allocation from one object to another 11785================================================================ 11786 11787_Description_: 11788 'MOVE_ALLOC(FROM, TO)' moves the allocation from FROM to TO. FROM 11789 will become deallocated in the process. 11790 11791_Standard_: 11792 Fortran 2003 and later 11793 11794_Class_: 11795 Pure subroutine 11796 11797_Syntax_: 11798 'CALL MOVE_ALLOC(FROM, TO)' 11799 11800_Arguments_: 11801 FROM 'ALLOCATABLE', 'INTENT(INOUT)', may be of any 11802 type and kind. 11803 TO 'ALLOCATABLE', 'INTENT(OUT)', shall be of the 11804 same type, kind and rank as FROM. 11805 11806_Return value_: 11807 None 11808 11809_Example_: 11810 program test_move_alloc 11811 integer, allocatable :: a(:), b(:) 11812 11813 allocate(a(3)) 11814 a = [ 1, 2, 3 ] 11815 call move_alloc(a, b) 11816 print *, allocated(a), allocated(b) 11817 print *, b 11818 end program test_move_alloc 11819 11820 11821File: gfortran.info, Node: MVBITS, Next: NEAREST, Prev: MOVE_ALLOC, Up: Intrinsic Procedures 11822 118238.180 'MVBITS' -- Move bits from one integer to another 11824======================================================= 11825 11826_Description_: 11827 Moves LEN bits from positions FROMPOS through 'FROMPOS+LEN-1' of 11828 FROM to positions TOPOS through 'TOPOS+LEN-1' of TO. The portion 11829 of argument TO not affected by the movement of bits is unchanged. 11830 The values of 'FROMPOS+LEN-1' and 'TOPOS+LEN-1' must be less than 11831 'BIT_SIZE(FROM)'. 11832 11833_Standard_: 11834 Fortran 95 and later 11835 11836_Class_: 11837 Elemental subroutine 11838 11839_Syntax_: 11840 'CALL MVBITS(FROM, FROMPOS, LEN, TO, TOPOS)' 11841 11842_Arguments_: 11843 FROM The type shall be 'INTEGER'. 11844 FROMPOS The type shall be 'INTEGER'. 11845 LEN The type shall be 'INTEGER'. 11846 TO The type shall be 'INTEGER', of the same kind as 11847 FROM. 11848 TOPOS The type shall be 'INTEGER'. 11849 11850_See also_: 11851 *note IBCLR::, *note IBSET::, *note IBITS::, *note IAND::, *note 11852 IOR::, *note IEOR:: 11853 11854 11855File: gfortran.info, Node: NEAREST, Next: NEW_LINE, Prev: MVBITS, Up: Intrinsic Procedures 11856 118578.181 'NEAREST' -- Nearest representable number 11858=============================================== 11859 11860_Description_: 11861 'NEAREST(X, S)' returns the processor-representable number nearest 11862 to 'X' in the direction indicated by the sign of 'S'. 11863 11864_Standard_: 11865 Fortran 95 and later 11866 11867_Class_: 11868 Elemental function 11869 11870_Syntax_: 11871 'RESULT = NEAREST(X, S)' 11872 11873_Arguments_: 11874 X Shall be of type 'REAL'. 11875 S Shall be of type 'REAL' and not equal to zero. 11876 11877_Return value_: 11878 The return value is of the same type as 'X'. If 'S' is positive, 11879 'NEAREST' returns the processor-representable number greater than 11880 'X' and nearest to it. If 'S' is negative, 'NEAREST' returns the 11881 processor-representable number smaller than 'X' and nearest to it. 11882 11883_Example_: 11884 program test_nearest 11885 real :: x, y 11886 x = nearest(42.0, 1.0) 11887 y = nearest(42.0, -1.0) 11888 write (*,"(3(G20.15))") x, y, x - y 11889 end program test_nearest 11890 11891 11892File: gfortran.info, Node: NEW_LINE, Next: NINT, Prev: NEAREST, Up: Intrinsic Procedures 11893 118948.182 'NEW_LINE' -- New line character 11895====================================== 11896 11897_Description_: 11898 'NEW_LINE(C)' returns the new-line character. 11899 11900_Standard_: 11901 Fortran 2003 and later 11902 11903_Class_: 11904 Inquiry function 11905 11906_Syntax_: 11907 'RESULT = NEW_LINE(C)' 11908 11909_Arguments_: 11910 C The argument shall be a scalar or array of the 11911 type 'CHARACTER'. 11912 11913_Return value_: 11914 Returns a CHARACTER scalar of length one with the new-line 11915 character of the same kind as parameter C. 11916 11917_Example_: 11918 program newline 11919 implicit none 11920 write(*,'(A)') 'This is record 1.'//NEW_LINE('A')//'This is record 2.' 11921 end program newline 11922 11923 11924File: gfortran.info, Node: NINT, Next: NORM2, Prev: NEW_LINE, Up: Intrinsic Procedures 11925 119268.183 'NINT' -- Nearest whole number 11927==================================== 11928 11929_Description_: 11930 'NINT(A)' rounds its argument to the nearest whole number. 11931 11932_Standard_: 11933 Fortran 77 and later, with KIND argument Fortran 90 and later 11934 11935_Class_: 11936 Elemental function 11937 11938_Syntax_: 11939 'RESULT = NINT(A [, KIND])' 11940 11941_Arguments_: 11942 A The type of the argument shall be 'REAL'. 11943 KIND (Optional) An 'INTEGER' initialization 11944 expression indicating the kind parameter of the 11945 result. 11946 11947_Return value_: 11948 Returns A with the fractional portion of its magnitude eliminated 11949 by rounding to the nearest whole number and with its sign 11950 preserved, converted to an 'INTEGER' of the default kind. 11951 11952_Example_: 11953 program test_nint 11954 real(4) x4 11955 real(8) x8 11956 x4 = 1.234E0_4 11957 x8 = 4.321_8 11958 print *, nint(x4), idnint(x8) 11959 end program test_nint 11960 11961_Specific names_: 11962 Name Argument Return Type Standard 11963 'NINT(A)' 'REAL(4) A' 'INTEGER' Fortran 95 and 11964 later 11965 'IDNINT(A)' 'REAL(8) A' 'INTEGER' Fortran 95 and 11966 later 11967 11968_See also_: 11969 *note CEILING::, *note FLOOR:: 11970 11971 11972File: gfortran.info, Node: NORM2, Next: NOT, Prev: NINT, Up: Intrinsic Procedures 11973 119748.184 'NORM2' -- Euclidean vector norms 11975======================================= 11976 11977_Description_: 11978 Calculates the Euclidean vector norm (L_2 norm) of of ARRAY along 11979 dimension DIM. 11980 11981_Standard_: 11982 Fortran 2008 and later 11983 11984_Class_: 11985 Transformational function 11986 11987_Syntax_: 11988 'RESULT = NORM2(ARRAY[, DIM])' 11989 11990_Arguments_: 11991 ARRAY Shall be an array of type 'REAL' 11992 DIM (Optional) shall be a scalar of type 'INTEGER' 11993 with a value in the range from 1 to n, where n 11994 equals the rank of ARRAY. 11995 11996_Return value_: 11997 The result is of the same type as ARRAY. 11998 11999 If DIM is absent, a scalar with the square root of the sum of all 12000 elements in ARRAY squared is returned. Otherwise, an array of rank 12001 n-1, where n equals the rank of ARRAY, and a shape similar to that 12002 of ARRAY with dimension DIM dropped is returned. 12003 12004_Example_: 12005 PROGRAM test_sum 12006 REAL :: x(5) = [ real :: 1, 2, 3, 4, 5 ] 12007 print *, NORM2(x) ! = sqrt(55.) ~ 7.416 12008 END PROGRAM 12009 12010 12011File: gfortran.info, Node: NOT, Next: NULL, Prev: NORM2, Up: Intrinsic Procedures 12012 120138.185 'NOT' -- Logical negation 12014=============================== 12015 12016_Description_: 12017 'NOT' returns the bitwise Boolean inverse of I. 12018 12019_Standard_: 12020 Fortran 95 and later 12021 12022_Class_: 12023 Elemental function 12024 12025_Syntax_: 12026 'RESULT = NOT(I)' 12027 12028_Arguments_: 12029 I The type shall be 'INTEGER'. 12030 12031_Return value_: 12032 The return type is 'INTEGER', of the same kind as the argument. 12033 12034_See also_: 12035 *note IAND::, *note IEOR::, *note IOR::, *note IBITS::, *note 12036 IBSET::, *note IBCLR:: 12037 12038 12039File: gfortran.info, Node: NULL, Next: NUM_IMAGES, Prev: NOT, Up: Intrinsic Procedures 12040 120418.186 'NULL' -- Function that returns an disassociated pointer 12042============================================================== 12043 12044_Description_: 12045 Returns a disassociated pointer. 12046 12047 If MOLD is present, a disassociated pointer of the same type is 12048 returned, otherwise the type is determined by context. 12049 12050 In Fortran 95, MOLD is optional. Please note that Fortran 2003 12051 includes cases where it is required. 12052 12053_Standard_: 12054 Fortran 95 and later 12055 12056_Class_: 12057 Transformational function 12058 12059_Syntax_: 12060 'PTR => NULL([MOLD])' 12061 12062_Arguments_: 12063 MOLD (Optional) shall be a pointer of any association 12064 status and of any type. 12065 12066_Return value_: 12067 A disassociated pointer. 12068 12069_Example_: 12070 REAL, POINTER, DIMENSION(:) :: VEC => NULL () 12071 12072_See also_: 12073 *note ASSOCIATED:: 12074 12075 12076File: gfortran.info, Node: NUM_IMAGES, Next: OR, Prev: NULL, Up: Intrinsic Procedures 12077 120788.187 'NUM_IMAGES' -- Function that returns the number of images 12079================================================================ 12080 12081_Description_: 12082 Returns the number of images. 12083 12084_Standard_: 12085 Fortran 2008 and later 12086 12087_Class_: 12088 Transformational function 12089 12090_Syntax_: 12091 'RESULT = NUM_IMAGES()' 12092 12093_Arguments_: None. 12094 12095_Return value_: 12096 Scalar default-kind integer. 12097 12098_Example_: 12099 INTEGER :: value[*] 12100 INTEGER :: i 12101 value = THIS_IMAGE() 12102 SYNC ALL 12103 IF (THIS_IMAGE() == 1) THEN 12104 DO i = 1, NUM_IMAGES() 12105 WRITE(*,'(2(a,i0))') 'value[', i, '] is ', value[i] 12106 END DO 12107 END IF 12108 12109_See also_: 12110 *note THIS_IMAGE::, *note IMAGE_INDEX:: 12111 12112 12113File: gfortran.info, Node: OR, Next: PACK, Prev: NUM_IMAGES, Up: Intrinsic Procedures 12114 121158.188 'OR' -- Bitwise logical OR 12116================================ 12117 12118_Description_: 12119 Bitwise logical 'OR'. 12120 12121 This intrinsic routine is provided for backwards compatibility with 12122 GNU Fortran 77. For integer arguments, programmers should consider 12123 the use of the *note IOR:: intrinsic defined by the Fortran 12124 standard. 12125 12126_Standard_: 12127 GNU extension 12128 12129_Class_: 12130 Function 12131 12132_Syntax_: 12133 'RESULT = OR(I, J)' 12134 12135_Arguments_: 12136 I The type shall be either a scalar 'INTEGER' type 12137 or a scalar 'LOGICAL' type. 12138 J The type shall be the same as the type of J. 12139 12140_Return value_: 12141 The return type is either a scalar 'INTEGER' or a scalar 'LOGICAL'. 12142 If the kind type parameters differ, then the smaller kind type is 12143 implicitly converted to larger kind, and the return has the larger 12144 kind. 12145 12146_Example_: 12147 PROGRAM test_or 12148 LOGICAL :: T = .TRUE., F = .FALSE. 12149 INTEGER :: a, b 12150 DATA a / Z'F' /, b / Z'3' / 12151 12152 WRITE (*,*) OR(T, T), OR(T, F), OR(F, T), OR(F, F) 12153 WRITE (*,*) OR(a, b) 12154 END PROGRAM 12155 12156_See also_: 12157 Fortran 95 elemental function: *note IOR:: 12158 12159 12160File: gfortran.info, Node: PACK, Next: PARITY, Prev: OR, Up: Intrinsic Procedures 12161 121628.189 'PACK' -- Pack an array into an array of rank one 12163======================================================= 12164 12165_Description_: 12166 Stores the elements of ARRAY in an array of rank one. 12167 12168 The beginning of the resulting array is made up of elements whose 12169 MASK equals 'TRUE'. Afterwards, positions are filled with elements 12170 taken from VECTOR. 12171 12172_Standard_: 12173 Fortran 95 and later 12174 12175_Class_: 12176 Transformational function 12177 12178_Syntax_: 12179 'RESULT = PACK(ARRAY, MASK[,VECTOR])' 12180 12181_Arguments_: 12182 ARRAY Shall be an array of any type. 12183 MASK Shall be an array of type 'LOGICAL' and of the 12184 same size as ARRAY. Alternatively, it may be a 12185 'LOGICAL' scalar. 12186 VECTOR (Optional) shall be an array of the same type as 12187 ARRAY and of rank one. If present, the number 12188 of elements in VECTOR shall be equal to or 12189 greater than the number of true elements in 12190 MASK. If MASK is scalar, the number of elements 12191 in VECTOR shall be equal to or greater than the 12192 number of elements in ARRAY. 12193 12194_Return value_: 12195 The result is an array of rank one and the same type as that of 12196 ARRAY. If VECTOR is present, the result size is that of VECTOR, 12197 the number of 'TRUE' values in MASK otherwise. 12198 12199_Example_: 12200 Gathering nonzero elements from an array: 12201 PROGRAM test_pack_1 12202 INTEGER :: m(6) 12203 m = (/ 1, 0, 0, 0, 5, 0 /) 12204 WRITE(*, FMT="(6(I0, ' '))") pack(m, m /= 0) ! "1 5" 12205 END PROGRAM 12206 12207 Gathering nonzero elements from an array and appending elements 12208 from VECTOR: 12209 PROGRAM test_pack_2 12210 INTEGER :: m(4) 12211 m = (/ 1, 0, 0, 2 /) 12212 WRITE(*, FMT="(4(I0, ' '))") pack(m, m /= 0, (/ 0, 0, 3, 4 /)) ! "1 2 3 4" 12213 END PROGRAM 12214 12215_See also_: 12216 *note UNPACK:: 12217 12218 12219File: gfortran.info, Node: PARITY, Next: PERROR, Prev: PACK, Up: Intrinsic Procedures 12220 122218.190 'PARITY' -- Reduction with exclusive OR 12222============================================= 12223 12224_Description_: 12225 Calculates the parity, i.e. the reduction using '.XOR.', of MASK 12226 along dimension DIM. 12227 12228_Standard_: 12229 Fortran 2008 and later 12230 12231_Class_: 12232 Transformational function 12233 12234_Syntax_: 12235 'RESULT = PARITY(MASK[, DIM])' 12236 12237_Arguments_: 12238 LOGICAL Shall be an array of type 'LOGICAL' 12239 DIM (Optional) shall be a scalar of type 'INTEGER' 12240 with a value in the range from 1 to n, where n 12241 equals the rank of MASK. 12242 12243_Return value_: 12244 The result is of the same type as MASK. 12245 12246 If DIM is absent, a scalar with the parity of all elements in MASK 12247 is returned, i.e. true if an odd number of elements is '.true.' 12248 and false otherwise. If DIM is present, an array of rank n-1, 12249 where n equals the rank of ARRAY, and a shape similar to that of 12250 MASK with dimension DIM dropped is returned. 12251 12252_Example_: 12253 PROGRAM test_sum 12254 LOGICAL :: x(2) = [ .true., .false. ] 12255 print *, PARITY(x) ! prints "T" (true). 12256 END PROGRAM 12257 12258 12259File: gfortran.info, Node: PERROR, Next: POPCNT, Prev: PARITY, Up: Intrinsic Procedures 12260 122618.191 'PERROR' -- Print system error message 12262============================================ 12263 12264_Description_: 12265 Prints (on the C 'stderr' stream) a newline-terminated error 12266 message corresponding to the last system error. This is prefixed 12267 by STRING, a colon and a space. See 'perror(3)'. 12268 12269_Standard_: 12270 GNU extension 12271 12272_Class_: 12273 Subroutine 12274 12275_Syntax_: 12276 'CALL PERROR(STRING)' 12277 12278_Arguments_: 12279 STRING A scalar of type 'CHARACTER' and of the default 12280 kind. 12281 12282_See also_: 12283 *note IERRNO:: 12284 12285 12286File: gfortran.info, Node: POPCNT, Next: POPPAR, Prev: PERROR, Up: Intrinsic Procedures 12287 122888.192 'POPCNT' -- Number of bits set 12289==================================== 12290 12291_Description_: 12292 'POPCNT(I)' returns the number of bits set ('1' bits) in the binary 12293 representation of 'I'. 12294 12295_Standard_: 12296 Fortran 2008 and later 12297 12298_Class_: 12299 Elemental function 12300 12301_Syntax_: 12302 'RESULT = POPCNT(I)' 12303 12304_Arguments_: 12305 I Shall be of type 'INTEGER'. 12306 12307_Return value_: 12308 The return value is of type 'INTEGER' and of the default integer 12309 kind. 12310 12311_See also_: 12312 *note POPPAR::, *note LEADZ::, *note TRAILZ:: 12313 12314_Example_: 12315 program test_population 12316 print *, popcnt(127), poppar(127) 12317 print *, popcnt(huge(0_4)), poppar(huge(0_4)) 12318 print *, popcnt(huge(0_8)), poppar(huge(0_8)) 12319 end program test_population 12320 12321 12322File: gfortran.info, Node: POPPAR, Next: PRECISION, Prev: POPCNT, Up: Intrinsic Procedures 12323 123248.193 'POPPAR' -- Parity of the number of bits set 12325================================================== 12326 12327_Description_: 12328 'POPPAR(I)' returns parity of the integer 'I', i.e. the parity of 12329 the number of bits set ('1' bits) in the binary representation of 12330 'I'. It is equal to 0 if 'I' has an even number of bits set, and 1 12331 for an odd number of '1' bits. 12332 12333_Standard_: 12334 Fortran 2008 and later 12335 12336_Class_: 12337 Elemental function 12338 12339_Syntax_: 12340 'RESULT = POPPAR(I)' 12341 12342_Arguments_: 12343 I Shall be of type 'INTEGER'. 12344 12345_Return value_: 12346 The return value is of type 'INTEGER' and of the default integer 12347 kind. 12348 12349_See also_: 12350 *note POPCNT::, *note LEADZ::, *note TRAILZ:: 12351 12352_Example_: 12353 program test_population 12354 print *, popcnt(127), poppar(127) 12355 print *, popcnt(huge(0_4)), poppar(huge(0_4)) 12356 print *, popcnt(huge(0_8)), poppar(huge(0_8)) 12357 end program test_population 12358 12359 12360File: gfortran.info, Node: PRECISION, Next: PRESENT, Prev: POPPAR, Up: Intrinsic Procedures 12361 123628.194 'PRECISION' -- Decimal precision of a real kind 12363===================================================== 12364 12365_Description_: 12366 'PRECISION(X)' returns the decimal precision in the model of the 12367 type of 'X'. 12368 12369_Standard_: 12370 Fortran 95 and later 12371 12372_Class_: 12373 Inquiry function 12374 12375_Syntax_: 12376 'RESULT = PRECISION(X)' 12377 12378_Arguments_: 12379 X Shall be of type 'REAL' or 'COMPLEX'. 12380 12381_Return value_: 12382 The return value is of type 'INTEGER' and of the default integer 12383 kind. 12384 12385_See also_: 12386 *note SELECTED_REAL_KIND::, *note RANGE:: 12387 12388_Example_: 12389 program prec_and_range 12390 real(kind=4) :: x(2) 12391 complex(kind=8) :: y 12392 12393 print *, precision(x), range(x) 12394 print *, precision(y), range(y) 12395 end program prec_and_range 12396 12397 12398File: gfortran.info, Node: PRESENT, Next: PRODUCT, Prev: PRECISION, Up: Intrinsic Procedures 12399 124008.195 'PRESENT' -- Determine whether an optional dummy argument is specified 12401============================================================================ 12402 12403_Description_: 12404 Determines whether an optional dummy argument is present. 12405 12406_Standard_: 12407 Fortran 95 and later 12408 12409_Class_: 12410 Inquiry function 12411 12412_Syntax_: 12413 'RESULT = PRESENT(A)' 12414 12415_Arguments_: 12416 A May be of any type and may be a pointer, scalar 12417 or array value, or a dummy procedure. It shall 12418 be the name of an optional dummy argument 12419 accessible within the current subroutine or 12420 function. 12421 12422_Return value_: 12423 Returns either 'TRUE' if the optional argument A is present, or 12424 'FALSE' otherwise. 12425 12426_Example_: 12427 PROGRAM test_present 12428 WRITE(*,*) f(), f(42) ! "F T" 12429 CONTAINS 12430 LOGICAL FUNCTION f(x) 12431 INTEGER, INTENT(IN), OPTIONAL :: x 12432 f = PRESENT(x) 12433 END FUNCTION 12434 END PROGRAM 12435 12436 12437File: gfortran.info, Node: PRODUCT, Next: RADIX, Prev: PRESENT, Up: Intrinsic Procedures 12438 124398.196 'PRODUCT' -- Product of array elements 12440============================================ 12441 12442_Description_: 12443 Multiplies the elements of ARRAY along dimension DIM if the 12444 corresponding element in MASK is 'TRUE'. 12445 12446_Standard_: 12447 Fortran 95 and later 12448 12449_Class_: 12450 Transformational function 12451 12452_Syntax_: 12453 'RESULT = PRODUCT(ARRAY[, MASK])' 12454 'RESULT = PRODUCT(ARRAY, DIM[, MASK])' 12455 12456_Arguments_: 12457 ARRAY Shall be an array of type 'INTEGER', 'REAL' or 12458 'COMPLEX'. 12459 DIM (Optional) shall be a scalar of type 'INTEGER' 12460 with a value in the range from 1 to n, where n 12461 equals the rank of ARRAY. 12462 MASK (Optional) shall be of type 'LOGICAL' and either 12463 be a scalar or an array of the same shape as 12464 ARRAY. 12465 12466_Return value_: 12467 The result is of the same type as ARRAY. 12468 12469 If DIM is absent, a scalar with the product of all elements in 12470 ARRAY is returned. Otherwise, an array of rank n-1, where n equals 12471 the rank of ARRAY, and a shape similar to that of ARRAY with 12472 dimension DIM dropped is returned. 12473 12474_Example_: 12475 PROGRAM test_product 12476 INTEGER :: x(5) = (/ 1, 2, 3, 4 ,5 /) 12477 print *, PRODUCT(x) ! all elements, product = 120 12478 print *, PRODUCT(x, MASK=MOD(x, 2)==1) ! odd elements, product = 15 12479 END PROGRAM 12480 12481_See also_: 12482 *note SUM:: 12483 12484 12485File: gfortran.info, Node: RADIX, Next: RAN, Prev: PRODUCT, Up: Intrinsic Procedures 12486 124878.197 'RADIX' -- Base of a model number 12488======================================= 12489 12490_Description_: 12491 'RADIX(X)' returns the base of the model representing the entity X. 12492 12493_Standard_: 12494 Fortran 95 and later 12495 12496_Class_: 12497 Inquiry function 12498 12499_Syntax_: 12500 'RESULT = RADIX(X)' 12501 12502_Arguments_: 12503 X Shall be of type 'INTEGER' or 'REAL' 12504 12505_Return value_: 12506 The return value is a scalar of type 'INTEGER' and of the default 12507 integer kind. 12508 12509_See also_: 12510 *note SELECTED_REAL_KIND:: 12511 12512_Example_: 12513 program test_radix 12514 print *, "The radix for the default integer kind is", radix(0) 12515 print *, "The radix for the default real kind is", radix(0.0) 12516 end program test_radix 12517 12518 12519File: gfortran.info, Node: RAN, Next: RAND, Prev: RADIX, Up: Intrinsic Procedures 12520 125218.198 'RAN' -- Real pseudo-random number 12522======================================== 12523 12524_Description_: 12525 For compatibility with HP FORTRAN 77/iX, the 'RAN' intrinsic is 12526 provided as an alias for 'RAND'. See *note RAND:: for complete 12527 documentation. 12528 12529_Standard_: 12530 GNU extension 12531 12532_Class_: 12533 Function 12534 12535_See also_: 12536 *note RAND::, *note RANDOM_NUMBER:: 12537 12538 12539File: gfortran.info, Node: RAND, Next: RANDOM_NUMBER, Prev: RAN, Up: Intrinsic Procedures 12540 125418.199 'RAND' -- Real pseudo-random number 12542========================================= 12543 12544_Description_: 12545 'RAND(FLAG)' returns a pseudo-random number from a uniform 12546 distribution between 0 and 1. If FLAG is 0, the next number in the 12547 current sequence is returned; if FLAG is 1, the generator is 12548 restarted by 'CALL SRAND(0)'; if FLAG has any other value, it is 12549 used as a new seed with 'SRAND'. 12550 12551 This intrinsic routine is provided for backwards compatibility with 12552 GNU Fortran 77. It implements a simple modulo generator as 12553 provided by 'g77'. For new code, one should consider the use of 12554 *note RANDOM_NUMBER:: as it implements a superior algorithm. 12555 12556_Standard_: 12557 GNU extension 12558 12559_Class_: 12560 Function 12561 12562_Syntax_: 12563 'RESULT = RAND(I)' 12564 12565_Arguments_: 12566 I Shall be a scalar 'INTEGER' of kind 4. 12567 12568_Return value_: 12569 The return value is of 'REAL' type and the default kind. 12570 12571_Example_: 12572 program test_rand 12573 integer,parameter :: seed = 86456 12574 12575 call srand(seed) 12576 print *, rand(), rand(), rand(), rand() 12577 print *, rand(seed), rand(), rand(), rand() 12578 end program test_rand 12579 12580_See also_: 12581 *note SRAND::, *note RANDOM_NUMBER:: 12582 12583 12584File: gfortran.info, Node: RANDOM_NUMBER, Next: RANDOM_SEED, Prev: RAND, Up: Intrinsic Procedures 12585 125868.200 'RANDOM_NUMBER' -- Pseudo-random number 12587============================================= 12588 12589_Description_: 12590 Returns a single pseudorandom number or an array of pseudorandom 12591 numbers from the uniform distribution over the range 0 \leq x < 1. 12592 12593 The runtime-library implements George Marsaglia's KISS (Keep It 12594 Simple Stupid) random number generator (RNG). This RNG combines: 12595 1. The congruential generator x(n) = 69069 \cdot x(n-1) + 12596 1327217885 with a period of 2^{32}, 12597 2. A 3-shift shift-register generator with a period of 2^{32} - 12598 1, 12599 3. Two 16-bit multiply-with-carry generators with a period of 12600 597273182964842497 > 2^{59}. 12601 The overall period exceeds 2^{123}. 12602 12603 Please note, this RNG is thread safe if used within OpenMP 12604 directives, i.e., its state will be consistent while called from 12605 multiple threads. However, the KISS generator does not create 12606 random numbers in parallel from multiple sources, but in sequence 12607 from a single source. If an OpenMP-enabled application heavily 12608 relies on random numbers, one should consider employing a dedicated 12609 parallel random number generator instead. 12610 12611_Standard_: 12612 Fortran 95 and later 12613 12614_Class_: 12615 Subroutine 12616 12617_Syntax_: 12618 'RANDOM_NUMBER(HARVEST)' 12619 12620_Arguments_: 12621 HARVEST Shall be a scalar or an array of type 'REAL'. 12622 12623_Example_: 12624 program test_random_number 12625 REAL :: r(5,5) 12626 CALL init_random_seed() ! see example of RANDOM_SEED 12627 CALL RANDOM_NUMBER(r) 12628 end program 12629 12630_See also_: 12631 *note RANDOM_SEED:: 12632 12633 12634File: gfortran.info, Node: RANDOM_SEED, Next: RANGE, Prev: RANDOM_NUMBER, Up: Intrinsic Procedures 12635 126368.201 'RANDOM_SEED' -- Initialize a pseudo-random number sequence 12637================================================================= 12638 12639_Description_: 12640 Restarts or queries the state of the pseudorandom number generator 12641 used by 'RANDOM_NUMBER'. 12642 12643 If 'RANDOM_SEED' is called without arguments, it is initialized to 12644 a default state. The example below shows how to initialize the 12645 random seed with a varying seed in order to ensure a different 12646 random number sequence for each invocation of the program. Note 12647 that setting any of the seed values to zero should be avoided as it 12648 can result in poor quality random numbers being generated. 12649 12650_Standard_: 12651 Fortran 95 and later 12652 12653_Class_: 12654 Subroutine 12655 12656_Syntax_: 12657 'CALL RANDOM_SEED([SIZE, PUT, GET])' 12658 12659_Arguments_: 12660 SIZE (Optional) Shall be a scalar and of type default 12661 'INTEGER', with 'INTENT(OUT)'. It specifies the 12662 minimum size of the arrays used with the PUT and 12663 GET arguments. 12664 PUT (Optional) Shall be an array of type default 12665 'INTEGER' and rank one. It is 'INTENT(IN)' and 12666 the size of the array must be larger than or 12667 equal to the number returned by the SIZE 12668 argument. 12669 GET (Optional) Shall be an array of type default 12670 'INTEGER' and rank one. It is 'INTENT(OUT)' and 12671 the size of the array must be larger than or 12672 equal to the number returned by the SIZE 12673 argument. 12674 12675_Example_: 12676 subroutine init_random_seed() 12677 use iso_fortran_env, only: int64 12678 implicit none 12679 integer, allocatable :: seed(:) 12680 integer :: i, n, un, istat, dt(8), pid 12681 integer(int64) :: t 12682 12683 call random_seed(size = n) 12684 allocate(seed(n)) 12685 ! First try if the OS provides a random number generator 12686 open(newunit=un, file="/dev/urandom", access="stream", & 12687 form="unformatted", action="read", status="old", iostat=istat) 12688 if (istat == 0) then 12689 read(un) seed 12690 close(un) 12691 else 12692 ! Fallback to XOR:ing the current time and pid. The PID is 12693 ! useful in case one launches multiple instances of the same 12694 ! program in parallel. 12695 call system_clock(t) 12696 if (t == 0) then 12697 call date_and_time(values=dt) 12698 t = (dt(1) - 1970) * 365_int64 * 24 * 60 * 60 * 1000 & 12699 + dt(2) * 31_int64 * 24 * 60 * 60 * 1000 & 12700 + dt(3) * 24_int64 * 60 * 60 * 1000 & 12701 + dt(5) * 60 * 60 * 1000 & 12702 + dt(6) * 60 * 1000 + dt(7) * 1000 & 12703 + dt(8) 12704 end if 12705 pid = getpid() 12706 t = ieor(t, int(pid, kind(t))) 12707 do i = 1, n 12708 seed(i) = lcg(t) 12709 end do 12710 end if 12711 call random_seed(put=seed) 12712 contains 12713 ! This simple PRNG might not be good enough for real work, but is 12714 ! sufficient for seeding a better PRNG. 12715 function lcg(s) 12716 integer :: lcg 12717 integer(int64) :: s 12718 if (s == 0) then 12719 s = 104729 12720 else 12721 s = mod(s, 4294967296_int64) 12722 end if 12723 s = mod(s * 279470273_int64, 4294967291_int64) 12724 lcg = int(mod(s, int(huge(0), int64)), kind(0)) 12725 end function lcg 12726 end subroutine init_random_seed 12727 12728_See also_: 12729 *note RANDOM_NUMBER:: 12730 12731 12732File: gfortran.info, Node: RANGE, Next: RANK, Prev: RANDOM_SEED, Up: Intrinsic Procedures 12733 127348.202 'RANGE' -- Decimal exponent range 12735======================================= 12736 12737_Description_: 12738 'RANGE(X)' returns the decimal exponent range in the model of the 12739 type of 'X'. 12740 12741_Standard_: 12742 Fortran 95 and later 12743 12744_Class_: 12745 Inquiry function 12746 12747_Syntax_: 12748 'RESULT = RANGE(X)' 12749 12750_Arguments_: 12751 X Shall be of type 'INTEGER', 'REAL' or 'COMPLEX'. 12752 12753_Return value_: 12754 The return value is of type 'INTEGER' and of the default integer 12755 kind. 12756 12757_See also_: 12758 *note SELECTED_REAL_KIND::, *note PRECISION:: 12759 12760_Example_: 12761 See 'PRECISION' for an example. 12762 12763 12764File: gfortran.info, Node: RANK, Next: REAL, Prev: RANGE, Up: Intrinsic Procedures 12765 127668.203 'RANK' -- Rank of a data object 12767===================================== 12768 12769_Description_: 12770 'RANK(A)' returns the rank of a scalar or array data object. 12771 12772_Standard_: 12773 Technical Specification (TS) 29113 12774 12775_Class_: 12776 Inquiry function 12777 12778_Syntax_: 12779 'RESULT = RANK(A)' 12780 12781_Arguments_: 12782 A can be of any type 12783 12784_Return value_: 12785 The return value is of type 'INTEGER' and of the default integer 12786 kind. For arrays, their rank is returned; for scalars zero is 12787 returned. 12788 12789_Example_: 12790 program test_rank 12791 integer :: a 12792 real, allocatable :: b(:,:) 12793 12794 print *, rank(a), rank(b) ! Prints: 0 2 12795 end program test_rank 12796 12797 12798File: gfortran.info, Node: REAL, Next: RENAME, Prev: RANK, Up: Intrinsic Procedures 12799 128008.204 'REAL' -- Convert to real type 12801==================================== 12802 12803_Description_: 12804 'REAL(A [, KIND])' converts its argument A to a real type. The 12805 'REALPART' function is provided for compatibility with 'g77', and 12806 its use is strongly discouraged. 12807 12808_Standard_: 12809 Fortran 77 and later 12810 12811_Class_: 12812 Elemental function 12813 12814_Syntax_: 12815 'RESULT = REAL(A [, KIND])' 12816 'RESULT = REALPART(Z)' 12817 12818_Arguments_: 12819 A Shall be 'INTEGER', 'REAL', or 'COMPLEX'. 12820 KIND (Optional) An 'INTEGER' initialization 12821 expression indicating the kind parameter of the 12822 result. 12823 12824_Return value_: 12825 These functions return a 'REAL' variable or array under the 12826 following rules: 12827 12828 (A) 12829 'REAL(A)' is converted to a default real type if A is an 12830 integer or real variable. 12831 (B) 12832 'REAL(A)' is converted to a real type with the kind type 12833 parameter of A if A is a complex variable. 12834 (C) 12835 'REAL(A, KIND)' is converted to a real type with kind type 12836 parameter KIND if A is a complex, integer, or real variable. 12837 12838_Example_: 12839 program test_real 12840 complex :: x = (1.0, 2.0) 12841 print *, real(x), real(x,8), realpart(x) 12842 end program test_real 12843 12844_Specific names_: 12845 Name Argument Return type Standard 12846 'FLOAT(A)' 'INTEGER(4)' 'REAL(4)' Fortran 77 and 12847 later 12848 'DFLOAT(A)' 'INTEGER(4)' 'REAL(8)' GNU extension 12849 'SNGL(A)' 'INTEGER(8)' 'REAL(4)' Fortran 77 and 12850 later 12851 12852_See also_: 12853 *note DBLE:: 12854 12855 12856File: gfortran.info, Node: RENAME, Next: REPEAT, Prev: REAL, Up: Intrinsic Procedures 12857 128588.205 'RENAME' -- Rename a file 12859=============================== 12860 12861_Description_: 12862 Renames a file from file PATH1 to PATH2. A null character 12863 ('CHAR(0)') can be used to mark the end of the names in PATH1 and 12864 PATH2; otherwise, trailing blanks in the file names are ignored. 12865 If the STATUS argument is supplied, it contains 0 on success or a 12866 nonzero error code upon return; see 'rename(2)'. 12867 12868 This intrinsic is provided in both subroutine and function forms; 12869 however, only one form can be used in any given program unit. 12870 12871_Standard_: 12872 GNU extension 12873 12874_Class_: 12875 Subroutine, function 12876 12877_Syntax_: 12878 'CALL RENAME(PATH1, PATH2 [, STATUS])' 12879 'STATUS = RENAME(PATH1, PATH2)' 12880 12881_Arguments_: 12882 PATH1 Shall be of default 'CHARACTER' type. 12883 PATH2 Shall be of default 'CHARACTER' type. 12884 STATUS (Optional) Shall be of default 'INTEGER' type. 12885 12886_See also_: 12887 *note LINK:: 12888 12889 12890File: gfortran.info, Node: REPEAT, Next: RESHAPE, Prev: RENAME, Up: Intrinsic Procedures 12891 128928.206 'REPEAT' -- Repeated string concatenation 12893=============================================== 12894 12895_Description_: 12896 Concatenates NCOPIES copies of a string. 12897 12898_Standard_: 12899 Fortran 95 and later 12900 12901_Class_: 12902 Transformational function 12903 12904_Syntax_: 12905 'RESULT = REPEAT(STRING, NCOPIES)' 12906 12907_Arguments_: 12908 STRING Shall be scalar and of type 'CHARACTER'. 12909 NCOPIES Shall be scalar and of type 'INTEGER'. 12910 12911_Return value_: 12912 A new scalar of type 'CHARACTER' built up from NCOPIES copies of 12913 STRING. 12914 12915_Example_: 12916 program test_repeat 12917 write(*,*) repeat("x", 5) ! "xxxxx" 12918 end program 12919 12920 12921File: gfortran.info, Node: RESHAPE, Next: RRSPACING, Prev: REPEAT, Up: Intrinsic Procedures 12922 129238.207 'RESHAPE' -- Function to reshape an array 12924=============================================== 12925 12926_Description_: 12927 Reshapes SOURCE to correspond to SHAPE. If necessary, the new 12928 array may be padded with elements from PAD or permuted as defined 12929 by ORDER. 12930 12931_Standard_: 12932 Fortran 95 and later 12933 12934_Class_: 12935 Transformational function 12936 12937_Syntax_: 12938 'RESULT = RESHAPE(SOURCE, SHAPE[, PAD, ORDER])' 12939 12940_Arguments_: 12941 SOURCE Shall be an array of any type. 12942 SHAPE Shall be of type 'INTEGER' and an array of rank 12943 one. Its values must be positive or zero. 12944 PAD (Optional) shall be an array of the same type as 12945 SOURCE. 12946 ORDER (Optional) shall be of type 'INTEGER' and an 12947 array of the same shape as SHAPE. Its values 12948 shall be a permutation of the numbers from 1 to 12949 n, where n is the size of SHAPE. If ORDER is 12950 absent, the natural ordering shall be assumed. 12951 12952_Return value_: 12953 The result is an array of shape SHAPE with the same type as SOURCE. 12954 12955_Example_: 12956 PROGRAM test_reshape 12957 INTEGER, DIMENSION(4) :: x 12958 WRITE(*,*) SHAPE(x) ! prints "4" 12959 WRITE(*,*) SHAPE(RESHAPE(x, (/2, 2/))) ! prints "2 2" 12960 END PROGRAM 12961 12962_See also_: 12963 *note SHAPE:: 12964 12965 12966File: gfortran.info, Node: RRSPACING, Next: RSHIFT, Prev: RESHAPE, Up: Intrinsic Procedures 12967 129688.208 'RRSPACING' -- Reciprocal of the relative spacing 12969======================================================= 12970 12971_Description_: 12972 'RRSPACING(X)' returns the reciprocal of the relative spacing of 12973 model numbers near X. 12974 12975_Standard_: 12976 Fortran 95 and later 12977 12978_Class_: 12979 Elemental function 12980 12981_Syntax_: 12982 'RESULT = RRSPACING(X)' 12983 12984_Arguments_: 12985 X Shall be of type 'REAL'. 12986 12987_Return value_: 12988 The return value is of the same type and kind as X. The value 12989 returned is equal to 'ABS(FRACTION(X)) * 12990 FLOAT(RADIX(X))**DIGITS(X)'. 12991 12992_See also_: 12993 *note SPACING:: 12994 12995 12996File: gfortran.info, Node: RSHIFT, Next: SAME_TYPE_AS, Prev: RRSPACING, Up: Intrinsic Procedures 12997 129988.209 'RSHIFT' -- Right shift bits 12999================================== 13000 13001_Description_: 13002 'RSHIFT' returns a value corresponding to I with all of the bits 13003 shifted right by SHIFT places. If the absolute value of SHIFT is 13004 greater than 'BIT_SIZE(I)', the value is undefined. Bits shifted 13005 out from the right end are lost. The fill is arithmetic: the bits 13006 shifted in from the left end are equal to the leftmost bit, which 13007 in two's complement representation is the sign bit. 13008 13009 This function has been superseded by the 'SHIFTA' intrinsic, which 13010 is standard in Fortran 2008 and later. 13011 13012_Standard_: 13013 GNU extension 13014 13015_Class_: 13016 Elemental function 13017 13018_Syntax_: 13019 'RESULT = RSHIFT(I, SHIFT)' 13020 13021_Arguments_: 13022 I The type shall be 'INTEGER'. 13023 SHIFT The type shall be 'INTEGER'. 13024 13025_Return value_: 13026 The return value is of type 'INTEGER' and of the same kind as I. 13027 13028_See also_: 13029 *note ISHFT::, *note ISHFTC::, *note LSHIFT::, *note SHIFTA::, 13030 *note SHIFTR::, *note SHIFTL:: 13031 13032 13033File: gfortran.info, Node: SAME_TYPE_AS, Next: SCALE, Prev: RSHIFT, Up: Intrinsic Procedures 13034 130358.210 'SAME_TYPE_AS' -- Query dynamic types for equality 13036======================================================== 13037 13038_Description_: 13039 Query dynamic types for equality. 13040 13041_Standard_: 13042 Fortran 2003 and later 13043 13044_Class_: 13045 Inquiry function 13046 13047_Syntax_: 13048 'RESULT = SAME_TYPE_AS(A, B)' 13049 13050_Arguments_: 13051 A Shall be an object of extensible declared type 13052 or unlimited polymorphic. 13053 B Shall be an object of extensible declared type 13054 or unlimited polymorphic. 13055 13056_Return value_: 13057 The return value is a scalar of type default logical. It is true 13058 if and only if the dynamic type of A is the same as the dynamic 13059 type of B. 13060 13061_See also_: 13062 *note EXTENDS_TYPE_OF:: 13063 13064 13065File: gfortran.info, Node: SCALE, Next: SCAN, Prev: SAME_TYPE_AS, Up: Intrinsic Procedures 13066 130678.211 'SCALE' -- Scale a real value 13068=================================== 13069 13070_Description_: 13071 'SCALE(X,I)' returns 'X * RADIX(X)**I'. 13072 13073_Standard_: 13074 Fortran 95 and later 13075 13076_Class_: 13077 Elemental function 13078 13079_Syntax_: 13080 'RESULT = SCALE(X, I)' 13081 13082_Arguments_: 13083 X The type of the argument shall be a 'REAL'. 13084 I The type of the argument shall be a 'INTEGER'. 13085 13086_Return value_: 13087 The return value is of the same type and kind as X. Its value is 13088 'X * RADIX(X)**I'. 13089 13090_Example_: 13091 program test_scale 13092 real :: x = 178.1387e-4 13093 integer :: i = 5 13094 print *, scale(x,i), x*radix(x)**i 13095 end program test_scale 13096 13097 13098File: gfortran.info, Node: SCAN, Next: SECNDS, Prev: SCALE, Up: Intrinsic Procedures 13099 131008.212 'SCAN' -- Scan a string for the presence of a set of characters 13101===================================================================== 13102 13103_Description_: 13104 Scans a STRING for any of the characters in a SET of characters. 13105 13106 If BACK is either absent or equals 'FALSE', this function returns 13107 the position of the leftmost character of STRING that is in SET. 13108 If BACK equals 'TRUE', the rightmost position is returned. If no 13109 character of SET is found in STRING, the result is zero. 13110 13111_Standard_: 13112 Fortran 95 and later, with KIND argument Fortran 2003 and later 13113 13114_Class_: 13115 Elemental function 13116 13117_Syntax_: 13118 'RESULT = SCAN(STRING, SET[, BACK [, KIND]])' 13119 13120_Arguments_: 13121 STRING Shall be of type 'CHARACTER'. 13122 SET Shall be of type 'CHARACTER'. 13123 BACK (Optional) shall be of type 'LOGICAL'. 13124 KIND (Optional) An 'INTEGER' initialization 13125 expression indicating the kind parameter of the 13126 result. 13127 13128_Return value_: 13129 The return value is of type 'INTEGER' and of kind KIND. If KIND is 13130 absent, the return value is of default integer kind. 13131 13132_Example_: 13133 PROGRAM test_scan 13134 WRITE(*,*) SCAN("FORTRAN", "AO") ! 2, found 'O' 13135 WRITE(*,*) SCAN("FORTRAN", "AO", .TRUE.) ! 6, found 'A' 13136 WRITE(*,*) SCAN("FORTRAN", "C++") ! 0, found none 13137 END PROGRAM 13138 13139_See also_: 13140 *note INDEX intrinsic::, *note VERIFY:: 13141 13142 13143File: gfortran.info, Node: SECNDS, Next: SECOND, Prev: SCAN, Up: Intrinsic Procedures 13144 131458.213 'SECNDS' -- Time function 13146=============================== 13147 13148_Description_: 13149 'SECNDS(X)' gets the time in seconds from the real-time system 13150 clock. X is a reference time, also in seconds. If this is zero, 13151 the time in seconds from midnight is returned. This function is 13152 non-standard and its use is discouraged. 13153 13154_Standard_: 13155 GNU extension 13156 13157_Class_: 13158 Function 13159 13160_Syntax_: 13161 'RESULT = SECNDS (X)' 13162 13163_Arguments_: 13164 T Shall be of type 'REAL(4)'. 13165 X Shall be of type 'REAL(4)'. 13166 13167_Return value_: 13168 None 13169 13170_Example_: 13171 program test_secnds 13172 integer :: i 13173 real(4) :: t1, t2 13174 print *, secnds (0.0) ! seconds since midnight 13175 t1 = secnds (0.0) ! reference time 13176 do i = 1, 10000000 ! do something 13177 end do 13178 t2 = secnds (t1) ! elapsed time 13179 print *, "Something took ", t2, " seconds." 13180 end program test_secnds 13181 13182 13183File: gfortran.info, Node: SECOND, Next: SELECTED_CHAR_KIND, Prev: SECNDS, Up: Intrinsic Procedures 13184 131858.214 'SECOND' -- CPU time function 13186=================================== 13187 13188_Description_: 13189 Returns a 'REAL(4)' value representing the elapsed CPU time in 13190 seconds. This provides the same functionality as the standard 13191 'CPU_TIME' intrinsic, and is only included for backwards 13192 compatibility. 13193 13194 This intrinsic is provided in both subroutine and function forms; 13195 however, only one form can be used in any given program unit. 13196 13197_Standard_: 13198 GNU extension 13199 13200_Class_: 13201 Subroutine, function 13202 13203_Syntax_: 13204 'CALL SECOND(TIME)' 13205 'TIME = SECOND()' 13206 13207_Arguments_: 13208 TIME Shall be of type 'REAL(4)'. 13209 13210_Return value_: 13211 In either syntax, TIME is set to the process's current runtime in 13212 seconds. 13213 13214_See also_: 13215 *note CPU_TIME:: 13216 13217 13218File: gfortran.info, Node: SELECTED_CHAR_KIND, Next: SELECTED_INT_KIND, Prev: SECOND, Up: Intrinsic Procedures 13219 132208.215 'SELECTED_CHAR_KIND' -- Choose character kind 13221=================================================== 13222 13223_Description_: 13224 13225 'SELECTED_CHAR_KIND(NAME)' returns the kind value for the character 13226 set named NAME, if a character set with such a name is supported, 13227 or -1 otherwise. Currently, supported character sets include 13228 "ASCII" and "DEFAULT", which are equivalent, and "ISO_10646" 13229 (Universal Character Set, UCS-4) which is commonly known as 13230 Unicode. 13231 13232_Standard_: 13233 Fortran 2003 and later 13234 13235_Class_: 13236 Transformational function 13237 13238_Syntax_: 13239 'RESULT = SELECTED_CHAR_KIND(NAME)' 13240 13241_Arguments_: 13242 NAME Shall be a scalar and of the default character 13243 type. 13244 13245_Example_: 13246 program character_kind 13247 use iso_fortran_env 13248 implicit none 13249 integer, parameter :: ascii = selected_char_kind ("ascii") 13250 integer, parameter :: ucs4 = selected_char_kind ('ISO_10646') 13251 13252 character(kind=ascii, len=26) :: alphabet 13253 character(kind=ucs4, len=30) :: hello_world 13254 13255 alphabet = ascii_"abcdefghijklmnopqrstuvwxyz" 13256 hello_world = ucs4_'Hello World and Ni Hao -- ' & 13257 // char (int (z'4F60'), ucs4) & 13258 // char (int (z'597D'), ucs4) 13259 13260 write (*,*) alphabet 13261 13262 open (output_unit, encoding='UTF-8') 13263 write (*,*) trim (hello_world) 13264 end program character_kind 13265 13266 13267File: gfortran.info, Node: SELECTED_INT_KIND, Next: SELECTED_REAL_KIND, Prev: SELECTED_CHAR_KIND, Up: Intrinsic Procedures 13268 132698.216 'SELECTED_INT_KIND' -- Choose integer kind 13270================================================ 13271 13272_Description_: 13273 'SELECTED_INT_KIND(R)' return the kind value of the smallest 13274 integer type that can represent all values ranging from -10^R 13275 (exclusive) to 10^R (exclusive). If there is no integer kind that 13276 accommodates this range, 'SELECTED_INT_KIND' returns -1. 13277 13278_Standard_: 13279 Fortran 95 and later 13280 13281_Class_: 13282 Transformational function 13283 13284_Syntax_: 13285 'RESULT = SELECTED_INT_KIND(R)' 13286 13287_Arguments_: 13288 R Shall be a scalar and of type 'INTEGER'. 13289 13290_Example_: 13291 program large_integers 13292 integer,parameter :: k5 = selected_int_kind(5) 13293 integer,parameter :: k15 = selected_int_kind(15) 13294 integer(kind=k5) :: i5 13295 integer(kind=k15) :: i15 13296 13297 print *, huge(i5), huge(i15) 13298 13299 ! The following inequalities are always true 13300 print *, huge(i5) >= 10_k5**5-1 13301 print *, huge(i15) >= 10_k15**15-1 13302 end program large_integers 13303 13304 13305File: gfortran.info, Node: SELECTED_REAL_KIND, Next: SET_EXPONENT, Prev: SELECTED_INT_KIND, Up: Intrinsic Procedures 13306 133078.217 'SELECTED_REAL_KIND' -- Choose real kind 13308============================================== 13309 13310_Description_: 13311 'SELECTED_REAL_KIND(P,R)' returns the kind value of a real data 13312 type with decimal precision of at least 'P' digits, exponent range 13313 of at least 'R', and with a radix of 'RADIX'. 13314 13315_Standard_: 13316 Fortran 95 and later, with 'RADIX' Fortran 2008 or later 13317 13318_Class_: 13319 Transformational function 13320 13321_Syntax_: 13322 'RESULT = SELECTED_REAL_KIND([P, R, RADIX])' 13323 13324_Arguments_: 13325 P (Optional) shall be a scalar and of type 13326 'INTEGER'. 13327 R (Optional) shall be a scalar and of type 13328 'INTEGER'. 13329 RADIX (Optional) shall be a scalar and of type 13330 'INTEGER'. 13331 Before Fortran 2008, at least one of the arguments R or P shall be 13332 present; since Fortran 2008, they are assumed to be zero if absent. 13333 13334_Return value_: 13335 13336 'SELECTED_REAL_KIND' returns the value of the kind type parameter 13337 of a real data type with decimal precision of at least 'P' digits, 13338 a decimal exponent range of at least 'R', and with the requested 13339 'RADIX'. If the 'RADIX' parameter is absent, real kinds with any 13340 radix can be returned. If more than one real data type meet the 13341 criteria, the kind of the data type with the smallest decimal 13342 precision is returned. If no real data type matches the criteria, 13343 the result is 13344 -1 if the processor does not support a real data type with a 13345 precision greater than or equal to 'P', but the 'R' and 13346 'RADIX' requirements can be fulfilled 13347 -2 if the processor does not support a real type with an exponent 13348 range greater than or equal to 'R', but 'P' and 'RADIX' are 13349 fulfillable 13350 -3 if 'RADIX' but not 'P' and 'R' requirements 13351 are fulfillable 13352 -4 if 'RADIX' and either 'P' or 'R' requirements 13353 are fulfillable 13354 -5 if there is no real type with the given 'RADIX' 13355 13356_See also_: 13357 *note PRECISION::, *note RANGE::, *note RADIX:: 13358 13359_Example_: 13360 program real_kinds 13361 integer,parameter :: p6 = selected_real_kind(6) 13362 integer,parameter :: p10r100 = selected_real_kind(10,100) 13363 integer,parameter :: r400 = selected_real_kind(r=400) 13364 real(kind=p6) :: x 13365 real(kind=p10r100) :: y 13366 real(kind=r400) :: z 13367 13368 print *, precision(x), range(x) 13369 print *, precision(y), range(y) 13370 print *, precision(z), range(z) 13371 end program real_kinds 13372 13373 13374File: gfortran.info, Node: SET_EXPONENT, Next: SHAPE, Prev: SELECTED_REAL_KIND, Up: Intrinsic Procedures 13375 133768.218 'SET_EXPONENT' -- Set the exponent of the model 13377===================================================== 13378 13379_Description_: 13380 'SET_EXPONENT(X, I)' returns the real number whose fractional part 13381 is that that of X and whose exponent part is I. 13382 13383_Standard_: 13384 Fortran 95 and later 13385 13386_Class_: 13387 Elemental function 13388 13389_Syntax_: 13390 'RESULT = SET_EXPONENT(X, I)' 13391 13392_Arguments_: 13393 X Shall be of type 'REAL'. 13394 I Shall be of type 'INTEGER'. 13395 13396_Return value_: 13397 The return value is of the same type and kind as X. The real 13398 number whose fractional part is that that of X and whose exponent 13399 part if I is returned; it is 'FRACTION(X) * RADIX(X)**I'. 13400 13401_Example_: 13402 PROGRAM test_setexp 13403 REAL :: x = 178.1387e-4 13404 INTEGER :: i = 17 13405 PRINT *, SET_EXPONENT(x, i), FRACTION(x) * RADIX(x)**i 13406 END PROGRAM 13407 13408 13409File: gfortran.info, Node: SHAPE, Next: SHIFTA, Prev: SET_EXPONENT, Up: Intrinsic Procedures 13410 134118.219 'SHAPE' -- Determine the shape of an array 13412================================================ 13413 13414_Description_: 13415 Determines the shape of an array. 13416 13417_Standard_: 13418 Fortran 95 and later, with KIND argument Fortran 2003 and later 13419 13420_Class_: 13421 Inquiry function 13422 13423_Syntax_: 13424 'RESULT = SHAPE(SOURCE [, KIND])' 13425 13426_Arguments_: 13427 SOURCE Shall be an array or scalar of any type. If 13428 SOURCE is a pointer it must be associated and 13429 allocatable arrays must be allocated. 13430 KIND (Optional) An 'INTEGER' initialization 13431 expression indicating the kind parameter of the 13432 result. 13433 13434_Return value_: 13435 An 'INTEGER' array of rank one with as many elements as SOURCE has 13436 dimensions. The elements of the resulting array correspond to the 13437 extend of SOURCE along the respective dimensions. If SOURCE is a 13438 scalar, the result is the rank one array of size zero. If KIND is 13439 absent, the return value has the default integer kind otherwise the 13440 specified kind. 13441 13442_Example_: 13443 PROGRAM test_shape 13444 INTEGER, DIMENSION(-1:1, -1:2) :: A 13445 WRITE(*,*) SHAPE(A) ! (/ 3, 4 /) 13446 WRITE(*,*) SIZE(SHAPE(42)) ! (/ /) 13447 END PROGRAM 13448 13449_See also_: 13450 *note RESHAPE::, *note SIZE:: 13451 13452 13453File: gfortran.info, Node: SHIFTA, Next: SHIFTL, Prev: SHAPE, Up: Intrinsic Procedures 13454 134558.220 'SHIFTA' -- Right shift with fill 13456======================================= 13457 13458_Description_: 13459 'SHIFTA' returns a value corresponding to I with all of the bits 13460 shifted right by SHIFT places. If the absolute value of SHIFT is 13461 greater than 'BIT_SIZE(I)', the value is undefined. Bits shifted 13462 out from the right end are lost. The fill is arithmetic: the bits 13463 shifted in from the left end are equal to the leftmost bit, which 13464 in two's complement representation is the sign bit. 13465 13466_Standard_: 13467 Fortran 2008 and later 13468 13469_Class_: 13470 Elemental function 13471 13472_Syntax_: 13473 'RESULT = SHIFTA(I, SHIFT)' 13474 13475_Arguments_: 13476 I The type shall be 'INTEGER'. 13477 SHIFT The type shall be 'INTEGER'. 13478 13479_Return value_: 13480 The return value is of type 'INTEGER' and of the same kind as I. 13481 13482_See also_: 13483 *note SHIFTL::, *note SHIFTR:: 13484 13485 13486File: gfortran.info, Node: SHIFTL, Next: SHIFTR, Prev: SHIFTA, Up: Intrinsic Procedures 13487 134888.221 'SHIFTL' -- Left shift 13489============================ 13490 13491_Description_: 13492 'SHIFTL' returns a value corresponding to I with all of the bits 13493 shifted left by SHIFT places. If the absolute value of SHIFT is 13494 greater than 'BIT_SIZE(I)', the value is undefined. Bits shifted 13495 out from the left end are lost, and bits shifted in from the right 13496 end are set to 0. 13497 13498_Standard_: 13499 Fortran 2008 and later 13500 13501_Class_: 13502 Elemental function 13503 13504_Syntax_: 13505 'RESULT = SHIFTL(I, SHIFT)' 13506 13507_Arguments_: 13508 I The type shall be 'INTEGER'. 13509 SHIFT The type shall be 'INTEGER'. 13510 13511_Return value_: 13512 The return value is of type 'INTEGER' and of the same kind as I. 13513 13514_See also_: 13515 *note SHIFTA::, *note SHIFTR:: 13516 13517 13518File: gfortran.info, Node: SHIFTR, Next: SIGN, Prev: SHIFTL, Up: Intrinsic Procedures 13519 135208.222 'SHIFTR' -- Right shift 13521============================= 13522 13523_Description_: 13524 'SHIFTR' returns a value corresponding to I with all of the bits 13525 shifted right by SHIFT places. If the absolute value of SHIFT is 13526 greater than 'BIT_SIZE(I)', the value is undefined. Bits shifted 13527 out from the right end are lost, and bits shifted in from the left 13528 end are set to 0. 13529 13530_Standard_: 13531 Fortran 2008 and later 13532 13533_Class_: 13534 Elemental function 13535 13536_Syntax_: 13537 'RESULT = SHIFTR(I, SHIFT)' 13538 13539_Arguments_: 13540 I The type shall be 'INTEGER'. 13541 SHIFT The type shall be 'INTEGER'. 13542 13543_Return value_: 13544 The return value is of type 'INTEGER' and of the same kind as I. 13545 13546_See also_: 13547 *note SHIFTA::, *note SHIFTL:: 13548 13549 13550File: gfortran.info, Node: SIGN, Next: SIGNAL, Prev: SHIFTR, Up: Intrinsic Procedures 13551 135528.223 'SIGN' -- Sign copying function 13553===================================== 13554 13555_Description_: 13556 'SIGN(A,B)' returns the value of A with the sign of B. 13557 13558_Standard_: 13559 Fortran 77 and later 13560 13561_Class_: 13562 Elemental function 13563 13564_Syntax_: 13565 'RESULT = SIGN(A, B)' 13566 13567_Arguments_: 13568 A Shall be of type 'INTEGER' or 'REAL' 13569 B Shall be of the same type and kind as A 13570 13571_Return value_: 13572 The kind of the return value is that of A and B. If B\ge 0 then 13573 the result is 'ABS(A)', else it is '-ABS(A)'. 13574 13575_Example_: 13576 program test_sign 13577 print *, sign(-12,1) 13578 print *, sign(-12,0) 13579 print *, sign(-12,-1) 13580 13581 print *, sign(-12.,1.) 13582 print *, sign(-12.,0.) 13583 print *, sign(-12.,-1.) 13584 end program test_sign 13585 13586_Specific names_: 13587 Name Arguments Return type Standard 13588 'SIGN(A,B)' 'REAL(4) A, 'REAL(4)' f77, gnu 13589 B' 13590 'ISIGN(A,B)' 'INTEGER(4) 'INTEGER(4)' f77, gnu 13591 A, B' 13592 'DSIGN(A,B)' 'REAL(8) A, 'REAL(8)' f77, gnu 13593 B' 13594 13595 13596File: gfortran.info, Node: SIGNAL, Next: SIN, Prev: SIGN, Up: Intrinsic Procedures 13597 135988.224 'SIGNAL' -- Signal handling subroutine (or function) 13599========================================================== 13600 13601_Description_: 13602 'SIGNAL(NUMBER, HANDLER [, STATUS])' causes external subroutine 13603 HANDLER to be executed with a single integer argument when signal 13604 NUMBER occurs. If HANDLER is an integer, it can be used to turn 13605 off handling of signal NUMBER or revert to its default action. See 13606 'signal(2)'. 13607 13608 If 'SIGNAL' is called as a subroutine and the STATUS argument is 13609 supplied, it is set to the value returned by 'signal(2)'. 13610 13611_Standard_: 13612 GNU extension 13613 13614_Class_: 13615 Subroutine, function 13616 13617_Syntax_: 13618 'CALL SIGNAL(NUMBER, HANDLER [, STATUS])' 13619 'STATUS = SIGNAL(NUMBER, HANDLER)' 13620 13621_Arguments_: 13622 NUMBER Shall be a scalar integer, with 'INTENT(IN)' 13623 HANDLER Signal handler ('INTEGER FUNCTION' or 13624 'SUBROUTINE') or dummy/global 'INTEGER' scalar. 13625 'INTEGER'. It is 'INTENT(IN)'. 13626 STATUS (Optional) STATUS shall be a scalar integer. It 13627 has 'INTENT(OUT)'. 13628 13629_Return value_: 13630 The 'SIGNAL' function returns the value returned by 'signal(2)'. 13631 13632_Example_: 13633 program test_signal 13634 intrinsic signal 13635 external handler_print 13636 13637 call signal (12, handler_print) 13638 call signal (10, 1) 13639 13640 call sleep (30) 13641 end program test_signal 13642 13643 13644File: gfortran.info, Node: SIN, Next: SINH, Prev: SIGNAL, Up: Intrinsic Procedures 13645 136468.225 'SIN' -- Sine function 13647============================ 13648 13649_Description_: 13650 'SIN(X)' computes the sine of X. 13651 13652_Standard_: 13653 Fortran 77 and later 13654 13655_Class_: 13656 Elemental function 13657 13658_Syntax_: 13659 'RESULT = SIN(X)' 13660 13661_Arguments_: 13662 X The type shall be 'REAL' or 'COMPLEX'. 13663 13664_Return value_: 13665 The return value has same type and kind as X. 13666 13667_Example_: 13668 program test_sin 13669 real :: x = 0.0 13670 x = sin(x) 13671 end program test_sin 13672 13673_Specific names_: 13674 Name Argument Return type Standard 13675 'SIN(X)' 'REAL(4) X' 'REAL(4)' f77, gnu 13676 'DSIN(X)' 'REAL(8) X' 'REAL(8)' f95, gnu 13677 'CSIN(X)' 'COMPLEX(4) 'COMPLEX(4)' f95, gnu 13678 X' 13679 'ZSIN(X)' 'COMPLEX(8) 'COMPLEX(8)' f95, gnu 13680 X' 13681 'CDSIN(X)' 'COMPLEX(8) 'COMPLEX(8)' f95, gnu 13682 X' 13683 13684_See also_: 13685 *note ASIN:: 13686 13687 13688File: gfortran.info, Node: SINH, Next: SIZE, Prev: SIN, Up: Intrinsic Procedures 13689 136908.226 'SINH' -- Hyperbolic sine function 13691======================================== 13692 13693_Description_: 13694 'SINH(X)' computes the hyperbolic sine of X. 13695 13696_Standard_: 13697 Fortran 95 and later, for a complex argument Fortran 2008 or later 13698 13699_Class_: 13700 Elemental function 13701 13702_Syntax_: 13703 'RESULT = SINH(X)' 13704 13705_Arguments_: 13706 X The type shall be 'REAL' or 'COMPLEX'. 13707 13708_Return value_: 13709 The return value has same type and kind as X. 13710 13711_Example_: 13712 program test_sinh 13713 real(8) :: x = - 1.0_8 13714 x = sinh(x) 13715 end program test_sinh 13716 13717_Specific names_: 13718 Name Argument Return type Standard 13719 'SINH(X)' 'REAL(4) X' 'REAL(4)' Fortran 95 and 13720 later 13721 'DSINH(X)' 'REAL(8) X' 'REAL(8)' Fortran 95 and 13722 later 13723 13724_See also_: 13725 *note ASINH:: 13726 13727 13728File: gfortran.info, Node: SIZE, Next: SIZEOF, Prev: SINH, Up: Intrinsic Procedures 13729 137308.227 'SIZE' -- Determine the size of an array 13731============================================== 13732 13733_Description_: 13734 Determine the extent of ARRAY along a specified dimension DIM, or 13735 the total number of elements in ARRAY if DIM is absent. 13736 13737_Standard_: 13738 Fortran 95 and later, with KIND argument Fortran 2003 and later 13739 13740_Class_: 13741 Inquiry function 13742 13743_Syntax_: 13744 'RESULT = SIZE(ARRAY[, DIM [, KIND]])' 13745 13746_Arguments_: 13747 ARRAY Shall be an array of any type. If ARRAY is a 13748 pointer it must be associated and allocatable 13749 arrays must be allocated. 13750 DIM (Optional) shall be a scalar of type 'INTEGER' 13751 and its value shall be in the range from 1 to n, 13752 where n equals the rank of ARRAY. 13753 KIND (Optional) An 'INTEGER' initialization 13754 expression indicating the kind parameter of the 13755 result. 13756 13757_Return value_: 13758 The return value is of type 'INTEGER' and of kind KIND. If KIND is 13759 absent, the return value is of default integer kind. 13760 13761_Example_: 13762 PROGRAM test_size 13763 WRITE(*,*) SIZE((/ 1, 2 /)) ! 2 13764 END PROGRAM 13765 13766_See also_: 13767 *note SHAPE::, *note RESHAPE:: 13768 13769 13770File: gfortran.info, Node: SIZEOF, Next: SLEEP, Prev: SIZE, Up: Intrinsic Procedures 13771 137728.228 'SIZEOF' -- Size in bytes of an expression 13773================================================ 13774 13775_Description_: 13776 'SIZEOF(X)' calculates the number of bytes of storage the 13777 expression 'X' occupies. 13778 13779_Standard_: 13780 GNU extension 13781 13782_Class_: 13783 Inquiry function 13784 13785_Syntax_: 13786 'N = SIZEOF(X)' 13787 13788_Arguments_: 13789 X The argument shall be of any type, rank or 13790 shape. 13791 13792_Return value_: 13793 The return value is of type integer and of the system-dependent 13794 kind C_SIZE_T (from the ISO_C_BINDING module). Its value is the 13795 number of bytes occupied by the argument. If the argument has the 13796 'POINTER' attribute, the number of bytes of the storage area 13797 pointed to is returned. If the argument is of a derived type with 13798 'POINTER' or 'ALLOCATABLE' components, the return value does not 13799 account for the sizes of the data pointed to by these components. 13800 If the argument is polymorphic, the size according to the declared 13801 type is returned. The argument may not be a procedure or procedure 13802 pointer. 13803 13804_Example_: 13805 integer :: i 13806 real :: r, s(5) 13807 print *, (sizeof(s)/sizeof(r) == 5) 13808 end 13809 The example will print '.TRUE.' unless you are using a platform 13810 where default 'REAL' variables are unusually padded. 13811 13812_See also_: 13813 *note C_SIZEOF::, *note STORAGE_SIZE:: 13814 13815 13816File: gfortran.info, Node: SLEEP, Next: SPACING, Prev: SIZEOF, Up: Intrinsic Procedures 13817 138188.229 'SLEEP' -- Sleep for the specified number of seconds 13819========================================================== 13820 13821_Description_: 13822 Calling this subroutine causes the process to pause for SECONDS 13823 seconds. 13824 13825_Standard_: 13826 GNU extension 13827 13828_Class_: 13829 Subroutine 13830 13831_Syntax_: 13832 'CALL SLEEP(SECONDS)' 13833 13834_Arguments_: 13835 SECONDS The type shall be of default 'INTEGER'. 13836 13837_Example_: 13838 program test_sleep 13839 call sleep(5) 13840 end 13841 13842 13843File: gfortran.info, Node: SPACING, Next: SPREAD, Prev: SLEEP, Up: Intrinsic Procedures 13844 138458.230 'SPACING' -- Smallest distance between two numbers of a given type 13846======================================================================== 13847 13848_Description_: 13849 Determines the distance between the argument X and the nearest 13850 adjacent number of the same type. 13851 13852_Standard_: 13853 Fortran 95 and later 13854 13855_Class_: 13856 Elemental function 13857 13858_Syntax_: 13859 'RESULT = SPACING(X)' 13860 13861_Arguments_: 13862 X Shall be of type 'REAL'. 13863 13864_Return value_: 13865 The result is of the same type as the input argument X. 13866 13867_Example_: 13868 PROGRAM test_spacing 13869 INTEGER, PARAMETER :: SGL = SELECTED_REAL_KIND(p=6, r=37) 13870 INTEGER, PARAMETER :: DBL = SELECTED_REAL_KIND(p=13, r=200) 13871 13872 WRITE(*,*) spacing(1.0_SGL) ! "1.1920929E-07" on i686 13873 WRITE(*,*) spacing(1.0_DBL) ! "2.220446049250313E-016" on i686 13874 END PROGRAM 13875 13876_See also_: 13877 *note RRSPACING:: 13878 13879 13880File: gfortran.info, Node: SPREAD, Next: SQRT, Prev: SPACING, Up: Intrinsic Procedures 13881 138828.231 'SPREAD' -- Add a dimension to an array 13883============================================= 13884 13885_Description_: 13886 Replicates a SOURCE array NCOPIES times along a specified dimension 13887 DIM. 13888 13889_Standard_: 13890 Fortran 95 and later 13891 13892_Class_: 13893 Transformational function 13894 13895_Syntax_: 13896 'RESULT = SPREAD(SOURCE, DIM, NCOPIES)' 13897 13898_Arguments_: 13899 SOURCE Shall be a scalar or an array of any type and a 13900 rank less than seven. 13901 DIM Shall be a scalar of type 'INTEGER' with a value 13902 in the range from 1 to n+1, where n equals the 13903 rank of SOURCE. 13904 NCOPIES Shall be a scalar of type 'INTEGER'. 13905 13906_Return value_: 13907 The result is an array of the same type as SOURCE and has rank n+1 13908 where n equals the rank of SOURCE. 13909 13910_Example_: 13911 PROGRAM test_spread 13912 INTEGER :: a = 1, b(2) = (/ 1, 2 /) 13913 WRITE(*,*) SPREAD(A, 1, 2) ! "1 1" 13914 WRITE(*,*) SPREAD(B, 1, 2) ! "1 1 2 2" 13915 END PROGRAM 13916 13917_See also_: 13918 *note UNPACK:: 13919 13920 13921File: gfortran.info, Node: SQRT, Next: SRAND, Prev: SPREAD, Up: Intrinsic Procedures 13922 139238.232 'SQRT' -- Square-root function 13924==================================== 13925 13926_Description_: 13927 'SQRT(X)' computes the square root of X. 13928 13929_Standard_: 13930 Fortran 77 and later 13931 13932_Class_: 13933 Elemental function 13934 13935_Syntax_: 13936 'RESULT = SQRT(X)' 13937 13938_Arguments_: 13939 X The type shall be 'REAL' or 'COMPLEX'. 13940 13941_Return value_: 13942 The return value is of type 'REAL' or 'COMPLEX'. The kind type 13943 parameter is the same as X. 13944 13945_Example_: 13946 program test_sqrt 13947 real(8) :: x = 2.0_8 13948 complex :: z = (1.0, 2.0) 13949 x = sqrt(x) 13950 z = sqrt(z) 13951 end program test_sqrt 13952 13953_Specific names_: 13954 Name Argument Return type Standard 13955 'SQRT(X)' 'REAL(4) X' 'REAL(4)' Fortran 95 and 13956 later 13957 'DSQRT(X)' 'REAL(8) X' 'REAL(8)' Fortran 95 and 13958 later 13959 'CSQRT(X)' 'COMPLEX(4) 'COMPLEX(4)' Fortran 95 and 13960 X' later 13961 'ZSQRT(X)' 'COMPLEX(8) 'COMPLEX(8)' GNU extension 13962 X' 13963 'CDSQRT(X)' 'COMPLEX(8) 'COMPLEX(8)' GNU extension 13964 X' 13965 13966 13967File: gfortran.info, Node: SRAND, Next: STAT, Prev: SQRT, Up: Intrinsic Procedures 13968 139698.233 'SRAND' -- Reinitialize the random number generator 13970========================================================= 13971 13972_Description_: 13973 'SRAND' reinitializes the pseudo-random number generator called by 13974 'RAND' and 'IRAND'. The new seed used by the generator is 13975 specified by the required argument SEED. 13976 13977_Standard_: 13978 GNU extension 13979 13980_Class_: 13981 Subroutine 13982 13983_Syntax_: 13984 'CALL SRAND(SEED)' 13985 13986_Arguments_: 13987 SEED Shall be a scalar 'INTEGER(kind=4)'. 13988 13989_Return value_: 13990 Does not return anything. 13991 13992_Example_: 13993 See 'RAND' and 'IRAND' for examples. 13994 13995_Notes_: 13996 The Fortran 2003 standard specifies the intrinsic 'RANDOM_SEED' to 13997 initialize the pseudo-random numbers generator and 'RANDOM_NUMBER' 13998 to generate pseudo-random numbers. Please note that in GNU 13999 Fortran, these two sets of intrinsics ('RAND', 'IRAND' and 'SRAND' 14000 on the one hand, 'RANDOM_NUMBER' and 'RANDOM_SEED' on the other 14001 hand) access two independent pseudo-random number generators. 14002 14003_See also_: 14004 *note RAND::, *note RANDOM_SEED::, *note RANDOM_NUMBER:: 14005 14006 14007File: gfortran.info, Node: STAT, Next: STORAGE_SIZE, Prev: SRAND, Up: Intrinsic Procedures 14008 140098.234 'STAT' -- Get file status 14010=============================== 14011 14012_Description_: 14013 This function returns information about a file. No permissions are 14014 required on the file itself, but execute (search) permission is 14015 required on all of the directories in path that lead to the file. 14016 14017 The elements that are obtained and stored in the array 'VALUES': 14018 'VALUES(1)' Device ID 14019 'VALUES(2)' Inode number 14020 'VALUES(3)' File mode 14021 'VALUES(4)' Number of links 14022 'VALUES(5)' Owner's uid 14023 'VALUES(6)' Owner's gid 14024 'VALUES(7)' ID of device containing directory entry for file 14025 (0 if not available) 14026 'VALUES(8)' File size (bytes) 14027 'VALUES(9)' Last access time 14028 'VALUES(10)'Last modification time 14029 'VALUES(11)'Last file status change time 14030 'VALUES(12)'Preferred I/O block size (-1 if not available) 14031 'VALUES(13)'Number of blocks allocated (-1 if not available) 14032 14033 Not all these elements are relevant on all systems. If an element 14034 is not relevant, it is returned as 0. 14035 14036 This intrinsic is provided in both subroutine and function forms; 14037 however, only one form can be used in any given program unit. 14038 14039_Standard_: 14040 GNU extension 14041 14042_Class_: 14043 Subroutine, function 14044 14045_Syntax_: 14046 'CALL STAT(NAME, VALUES [, STATUS])' 14047 'STATUS = STAT(NAME, VALUES)' 14048 14049_Arguments_: 14050 NAME The type shall be 'CHARACTER', of the default 14051 kind and a valid path within the file system. 14052 VALUES The type shall be 'INTEGER(4), DIMENSION(13)'. 14053 STATUS (Optional) status flag of type 'INTEGER(4)'. 14054 Returns 0 on success and a system specific error 14055 code otherwise. 14056 14057_Example_: 14058 PROGRAM test_stat 14059 INTEGER, DIMENSION(13) :: buff 14060 INTEGER :: status 14061 14062 CALL STAT("/etc/passwd", buff, status) 14063 14064 IF (status == 0) THEN 14065 WRITE (*, FMT="('Device ID:', T30, I19)") buff(1) 14066 WRITE (*, FMT="('Inode number:', T30, I19)") buff(2) 14067 WRITE (*, FMT="('File mode (octal):', T30, O19)") buff(3) 14068 WRITE (*, FMT="('Number of links:', T30, I19)") buff(4) 14069 WRITE (*, FMT="('Owner''s uid:', T30, I19)") buff(5) 14070 WRITE (*, FMT="('Owner''s gid:', T30, I19)") buff(6) 14071 WRITE (*, FMT="('Device where located:', T30, I19)") buff(7) 14072 WRITE (*, FMT="('File size:', T30, I19)") buff(8) 14073 WRITE (*, FMT="('Last access time:', T30, A19)") CTIME(buff(9)) 14074 WRITE (*, FMT="('Last modification time', T30, A19)") CTIME(buff(10)) 14075 WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11)) 14076 WRITE (*, FMT="('Preferred block size:', T30, I19)") buff(12) 14077 WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13) 14078 END IF 14079 END PROGRAM 14080 14081_See also_: 14082 To stat an open file: *note FSTAT::, to stat a link: *note LSTAT:: 14083 14084 14085File: gfortran.info, Node: STORAGE_SIZE, Next: SUM, Prev: STAT, Up: Intrinsic Procedures 14086 140878.235 'STORAGE_SIZE' -- Storage size in bits 14088============================================ 14089 14090_Description_: 14091 Returns the storage size of argument A in bits. 14092_Standard_: 14093 Fortran 2008 and later 14094_Class_: 14095 Inquiry function 14096_Syntax_: 14097 'RESULT = STORAGE_SIZE(A [, KIND])' 14098 14099_Arguments_: 14100 A Shall be a scalar or array of any type. 14101 KIND (Optional) shall be a scalar integer constant 14102 expression. 14103 14104_Return Value_: 14105 The result is a scalar integer with the kind type parameter 14106 specified by KIND (or default integer type if KIND is missing). 14107 The result value is the size expressed in bits for an element of an 14108 array that has the dynamic type and type parameters of A. 14109 14110_See also_: 14111 *note C_SIZEOF::, *note SIZEOF:: 14112 14113 14114File: gfortran.info, Node: SUM, Next: SYMLNK, Prev: STORAGE_SIZE, Up: Intrinsic Procedures 14115 141168.236 'SUM' -- Sum of array elements 14117==================================== 14118 14119_Description_: 14120 Adds the elements of ARRAY along dimension DIM if the corresponding 14121 element in MASK is 'TRUE'. 14122 14123_Standard_: 14124 Fortran 95 and later 14125 14126_Class_: 14127 Transformational function 14128 14129_Syntax_: 14130 'RESULT = SUM(ARRAY[, MASK])' 14131 'RESULT = SUM(ARRAY, DIM[, MASK])' 14132 14133_Arguments_: 14134 ARRAY Shall be an array of type 'INTEGER', 'REAL' or 14135 'COMPLEX'. 14136 DIM (Optional) shall be a scalar of type 'INTEGER' 14137 with a value in the range from 1 to n, where n 14138 equals the rank of ARRAY. 14139 MASK (Optional) shall be of type 'LOGICAL' and either 14140 be a scalar or an array of the same shape as 14141 ARRAY. 14142 14143_Return value_: 14144 The result is of the same type as ARRAY. 14145 14146 If DIM is absent, a scalar with the sum of all elements in ARRAY is 14147 returned. Otherwise, an array of rank n-1, where n equals the rank 14148 of ARRAY, and a shape similar to that of ARRAY with dimension DIM 14149 dropped is returned. 14150 14151_Example_: 14152 PROGRAM test_sum 14153 INTEGER :: x(5) = (/ 1, 2, 3, 4 ,5 /) 14154 print *, SUM(x) ! all elements, sum = 15 14155 print *, SUM(x, MASK=MOD(x, 2)==1) ! odd elements, sum = 9 14156 END PROGRAM 14157 14158_See also_: 14159 *note PRODUCT:: 14160 14161 14162File: gfortran.info, Node: SYMLNK, Next: SYSTEM, Prev: SUM, Up: Intrinsic Procedures 14163 141648.237 'SYMLNK' -- Create a symbolic link 14165======================================== 14166 14167_Description_: 14168 Makes a symbolic link from file PATH1 to PATH2. A null character 14169 ('CHAR(0)') can be used to mark the end of the names in PATH1 and 14170 PATH2; otherwise, trailing blanks in the file names are ignored. 14171 If the STATUS argument is supplied, it contains 0 on success or a 14172 nonzero error code upon return; see 'symlink(2)'. If the system 14173 does not supply 'symlink(2)', 'ENOSYS' is returned. 14174 14175 This intrinsic is provided in both subroutine and function forms; 14176 however, only one form can be used in any given program unit. 14177 14178_Standard_: 14179 GNU extension 14180 14181_Class_: 14182 Subroutine, function 14183 14184_Syntax_: 14185 'CALL SYMLNK(PATH1, PATH2 [, STATUS])' 14186 'STATUS = SYMLNK(PATH1, PATH2)' 14187 14188_Arguments_: 14189 PATH1 Shall be of default 'CHARACTER' type. 14190 PATH2 Shall be of default 'CHARACTER' type. 14191 STATUS (Optional) Shall be of default 'INTEGER' type. 14192 14193_See also_: 14194 *note LINK::, *note UNLINK:: 14195 14196 14197File: gfortran.info, Node: SYSTEM, Next: SYSTEM_CLOCK, Prev: SYMLNK, Up: Intrinsic Procedures 14198 141998.238 'SYSTEM' -- Execute a shell command 14200========================================= 14201 14202_Description_: 14203 Passes the command COMMAND to a shell (see 'system(3)'). If 14204 argument STATUS is present, it contains the value returned by 14205 'system(3)', which is presumably 0 if the shell command succeeded. 14206 Note that which shell is used to invoke the command is 14207 system-dependent and environment-dependent. 14208 14209 This intrinsic is provided in both subroutine and function forms; 14210 however, only one form can be used in any given program unit. 14211 14212 Note that the 'system' function need not be thread-safe. It is the 14213 responsibility of the user to ensure that 'system' is not called 14214 concurrently. 14215 14216_Standard_: 14217 GNU extension 14218 14219_Class_: 14220 Subroutine, function 14221 14222_Syntax_: 14223 'CALL SYSTEM(COMMAND [, STATUS])' 14224 'STATUS = SYSTEM(COMMAND)' 14225 14226_Arguments_: 14227 COMMAND Shall be of default 'CHARACTER' type. 14228 STATUS (Optional) Shall be of default 'INTEGER' type. 14229 14230_See also_: 14231 *note EXECUTE_COMMAND_LINE::, which is part of the Fortran 2008 14232 standard and should considered in new code for future portability. 14233 14234 14235File: gfortran.info, Node: SYSTEM_CLOCK, Next: TAN, Prev: SYSTEM, Up: Intrinsic Procedures 14236 142378.239 'SYSTEM_CLOCK' -- Time function 14238===================================== 14239 14240_Description_: 14241 Determines the COUNT of a processor clock since an unspecified time 14242 in the past modulo COUNT_MAX, COUNT_RATE determines the number of 14243 clock ticks per second. If the platform supports a monotonic 14244 clock, that clock is used and can, depending on the platform clock 14245 implementation, provide up to nanosecond resolution. If a 14246 monotonic clock is not available, the implementation falls back to 14247 a realtime clock. 14248 14249 COUNT_RATE is system dependent and can vary depending on the kind 14250 of the arguments. For KIND=4 arguments, COUNT represents 14251 milliseconds, while for KIND=8 arguments, COUNT typically 14252 represents micro- or nanoseconds depending on resolution of the 14253 underlying platform clock. COUNT_MAX usually equals 14254 'HUGE(COUNT_MAX)'. Note that the millisecond resolution of the 14255 KIND=4 version implies that the COUNT will wrap around in roughly 14256 25 days. In order to avoid issues with the wrap around and for 14257 more precise timing, please use the KIND=8 version. 14258 14259 If there is no clock, or querying the clock fails, COUNT is set to 14260 '-HUGE(COUNT)', and COUNT_RATE and COUNT_MAX are set to zero. 14261 14262 When running on a platform using the GNU C library (glibc) version 14263 2.16 or older, or a derivative thereof, the high resolution 14264 monotonic clock is available only when linking with the RT library. 14265 This can be done explicitly by adding the '-lrt' flag when linking 14266 the application, but is also done implicitly when using OpenMP. 14267 14268 On the Windows platform, the version with KIND=4 arguments uses the 14269 'GetTickCount' function, whereas the KIND=8 version uses 14270 'QueryPerformanceCounter' and 'QueryPerformanceCounterFrequency'. 14271 For more information, and potential caveats, please see the 14272 platform documentation. 14273 14274_Standard_: 14275 Fortran 95 and later 14276 14277_Class_: 14278 Subroutine 14279 14280_Syntax_: 14281 'CALL SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])' 14282 14283_Arguments_: 14284 COUNT (Optional) shall be a scalar of type 'INTEGER' 14285 with 'INTENT(OUT)'. 14286 COUNT_RATE (Optional) shall be a scalar of type 'INTEGER' 14287 with 'INTENT(OUT)'. 14288 COUNT_MAX (Optional) shall be a scalar of type 'INTEGER' 14289 with 'INTENT(OUT)'. 14290 14291_Example_: 14292 PROGRAM test_system_clock 14293 INTEGER :: count, count_rate, count_max 14294 CALL SYSTEM_CLOCK(count, count_rate, count_max) 14295 WRITE(*,*) count, count_rate, count_max 14296 END PROGRAM 14297 14298_See also_: 14299 *note DATE_AND_TIME::, *note CPU_TIME:: 14300 14301 14302File: gfortran.info, Node: TAN, Next: TANH, Prev: SYSTEM_CLOCK, Up: Intrinsic Procedures 14303 143048.240 'TAN' -- Tangent function 14305=============================== 14306 14307_Description_: 14308 'TAN(X)' computes the tangent of X. 14309 14310_Standard_: 14311 Fortran 77 and later, for a complex argument Fortran 2008 or later 14312 14313_Class_: 14314 Elemental function 14315 14316_Syntax_: 14317 'RESULT = TAN(X)' 14318 14319_Arguments_: 14320 X The type shall be 'REAL' or 'COMPLEX'. 14321 14322_Return value_: 14323 The return value has same type and kind as X. 14324 14325_Example_: 14326 program test_tan 14327 real(8) :: x = 0.165_8 14328 x = tan(x) 14329 end program test_tan 14330 14331_Specific names_: 14332 Name Argument Return type Standard 14333 'TAN(X)' 'REAL(4) X' 'REAL(4)' Fortran 95 and 14334 later 14335 'DTAN(X)' 'REAL(8) X' 'REAL(8)' Fortran 95 and 14336 later 14337 14338_See also_: 14339 *note ATAN:: 14340 14341 14342File: gfortran.info, Node: TANH, Next: THIS_IMAGE, Prev: TAN, Up: Intrinsic Procedures 14343 143448.241 'TANH' -- Hyperbolic tangent function 14345=========================================== 14346 14347_Description_: 14348 'TANH(X)' computes the hyperbolic tangent of X. 14349 14350_Standard_: 14351 Fortran 77 and later, for a complex argument Fortran 2008 or later 14352 14353_Class_: 14354 Elemental function 14355 14356_Syntax_: 14357 'X = TANH(X)' 14358 14359_Arguments_: 14360 X The type shall be 'REAL' or 'COMPLEX'. 14361 14362_Return value_: 14363 The return value has same type and kind as X. If X is complex, the 14364 imaginary part of the result is in radians. If X is 'REAL', the 14365 return value lies in the range - 1 \leq tanh(x) \leq 1 . 14366 14367_Example_: 14368 program test_tanh 14369 real(8) :: x = 2.1_8 14370 x = tanh(x) 14371 end program test_tanh 14372 14373_Specific names_: 14374 Name Argument Return type Standard 14375 'TANH(X)' 'REAL(4) X' 'REAL(4)' Fortran 95 and 14376 later 14377 'DTANH(X)' 'REAL(8) X' 'REAL(8)' Fortran 95 and 14378 later 14379 14380_See also_: 14381 *note ATANH:: 14382 14383 14384File: gfortran.info, Node: THIS_IMAGE, Next: TIME, Prev: TANH, Up: Intrinsic Procedures 14385 143868.242 'THIS_IMAGE' -- Function that returns the cosubscript index of this image 14387=============================================================================== 14388 14389_Description_: 14390 Returns the cosubscript for this image. 14391 14392_Standard_: 14393 Fortran 2008 and later 14394 14395_Class_: 14396 Transformational function 14397 14398_Syntax_: 14399 'RESULT = THIS_IMAGE()' 14400 'RESULT = THIS_IMAGE(COARRAY [, DIM])' 14401 14402_Arguments_: 14403 COARRAY Coarray of any type (optional; if DIM present, 14404 required). 14405 DIM default integer scalar (optional). If present, 14406 DIM shall be between one and the corank of 14407 COARRAY. 14408 14409_Return value_: 14410 Default integer. If COARRAY is not present, it is scalar and its 14411 value is the index of the invoking image. Otherwise, if DIM is not 14412 present, a rank-1 array with corank elements is returned, 14413 containing the cosubscripts for COARRAY specifying the invoking 14414 image. If DIM is present, a scalar is returned, with the value of 14415 the DIM element of 'THIS_IMAGE(COARRAY)'. 14416 14417_Example_: 14418 INTEGER :: value[*] 14419 INTEGER :: i 14420 value = THIS_IMAGE() 14421 SYNC ALL 14422 IF (THIS_IMAGE() == 1) THEN 14423 DO i = 1, NUM_IMAGES() 14424 WRITE(*,'(2(a,i0))') 'value[', i, '] is ', value[i] 14425 END DO 14426 END IF 14427 14428_See also_: 14429 *note NUM_IMAGES::, *note IMAGE_INDEX:: 14430 14431 14432File: gfortran.info, Node: TIME, Next: TIME8, Prev: THIS_IMAGE, Up: Intrinsic Procedures 14433 144348.243 'TIME' -- Time function 14435============================= 14436 14437_Description_: 14438 Returns the current time encoded as an integer (in the manner of 14439 the function 'time(3)' in the C standard library). This value is 14440 suitable for passing to 'CTIME', 'GMTIME', and 'LTIME'. 14441 14442 This intrinsic is not fully portable, such as to systems with 14443 32-bit 'INTEGER' types but supporting times wider than 32 bits. 14444 Therefore, the values returned by this intrinsic might be, or 14445 become, negative, or numerically less than previous values, during 14446 a single run of the compiled program. 14447 14448 See *note TIME8::, for information on a similar intrinsic that 14449 might be portable to more GNU Fortran implementations, though to 14450 fewer Fortran compilers. 14451 14452_Standard_: 14453 GNU extension 14454 14455_Class_: 14456 Function 14457 14458_Syntax_: 14459 'RESULT = TIME()' 14460 14461_Return value_: 14462 The return value is a scalar of type 'INTEGER(4)'. 14463 14464_See also_: 14465 *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK::, *note 14466 TIME8:: 14467 14468 14469File: gfortran.info, Node: TIME8, Next: TINY, Prev: TIME, Up: Intrinsic Procedures 14470 144718.244 'TIME8' -- Time function (64-bit) 14472======================================= 14473 14474_Description_: 14475 Returns the current time encoded as an integer (in the manner of 14476 the function 'time(3)' in the C standard library). This value is 14477 suitable for passing to 'CTIME', 'GMTIME', and 'LTIME'. 14478 14479 _Warning:_ this intrinsic does not increase the range of the timing 14480 values over that returned by 'time(3)'. On a system with a 32-bit 14481 'time(3)', 'TIME8' will return a 32-bit value, even though it is 14482 converted to a 64-bit 'INTEGER(8)' value. That means overflows of 14483 the 32-bit value can still occur. Therefore, the values returned 14484 by this intrinsic might be or become negative or numerically less 14485 than previous values during a single run of the compiled program. 14486 14487_Standard_: 14488 GNU extension 14489 14490_Class_: 14491 Function 14492 14493_Syntax_: 14494 'RESULT = TIME8()' 14495 14496_Return value_: 14497 The return value is a scalar of type 'INTEGER(8)'. 14498 14499_See also_: 14500 *note CTIME::, *note GMTIME::, *note LTIME::, *note MCLOCK8::, 14501 *note TIME:: 14502 14503 14504File: gfortran.info, Node: TINY, Next: TRAILZ, Prev: TIME8, Up: Intrinsic Procedures 14505 145068.245 'TINY' -- Smallest positive number of a real kind 14507======================================================= 14508 14509_Description_: 14510 'TINY(X)' returns the smallest positive (non zero) number in the 14511 model of the type of 'X'. 14512 14513_Standard_: 14514 Fortran 95 and later 14515 14516_Class_: 14517 Inquiry function 14518 14519_Syntax_: 14520 'RESULT = TINY(X)' 14521 14522_Arguments_: 14523 X Shall be of type 'REAL'. 14524 14525_Return value_: 14526 The return value is of the same type and kind as X 14527 14528_Example_: 14529 See 'HUGE' for an example. 14530 14531 14532File: gfortran.info, Node: TRAILZ, Next: TRANSFER, Prev: TINY, Up: Intrinsic Procedures 14533 145348.246 'TRAILZ' -- Number of trailing zero bits of an integer 14535============================================================ 14536 14537_Description_: 14538 'TRAILZ' returns the number of trailing zero bits of an integer. 14539 14540_Standard_: 14541 Fortran 2008 and later 14542 14543_Class_: 14544 Elemental function 14545 14546_Syntax_: 14547 'RESULT = TRAILZ(I)' 14548 14549_Arguments_: 14550 I Shall be of type 'INTEGER'. 14551 14552_Return value_: 14553 The type of the return value is the default 'INTEGER'. If all the 14554 bits of 'I' are zero, the result value is 'BIT_SIZE(I)'. 14555 14556_Example_: 14557 PROGRAM test_trailz 14558 WRITE (*,*) TRAILZ(8) ! prints 3 14559 END PROGRAM 14560 14561_See also_: 14562 *note BIT_SIZE::, *note LEADZ::, *note POPPAR::, *note POPCNT:: 14563 14564 14565File: gfortran.info, Node: TRANSFER, Next: TRANSPOSE, Prev: TRAILZ, Up: Intrinsic Procedures 14566 145678.247 'TRANSFER' -- Transfer bit patterns 14568========================================= 14569 14570_Description_: 14571 Interprets the bitwise representation of SOURCE in memory as if it 14572 is the representation of a variable or array of the same type and 14573 type parameters as MOLD. 14574 14575 This is approximately equivalent to the C concept of _casting_ one 14576 type to another. 14577 14578_Standard_: 14579 Fortran 95 and later 14580 14581_Class_: 14582 Transformational function 14583 14584_Syntax_: 14585 'RESULT = TRANSFER(SOURCE, MOLD[, SIZE])' 14586 14587_Arguments_: 14588 SOURCE Shall be a scalar or an array of any type. 14589 MOLD Shall be a scalar or an array of any type. 14590 SIZE (Optional) shall be a scalar of type 'INTEGER'. 14591 14592_Return value_: 14593 The result has the same type as MOLD, with the bit level 14594 representation of SOURCE. If SIZE is present, the result is a 14595 one-dimensional array of length SIZE. If SIZE is absent but MOLD 14596 is an array (of any size or shape), the result is a one- 14597 dimensional array of the minimum length needed to contain the 14598 entirety of the bitwise representation of SOURCE. If SIZE is 14599 absent and MOLD is a scalar, the result is a scalar. 14600 14601 If the bitwise representation of the result is longer than that of 14602 SOURCE, then the leading bits of the result correspond to those of 14603 SOURCE and any trailing bits are filled arbitrarily. 14604 14605 When the resulting bit representation does not correspond to a 14606 valid representation of a variable of the same type as MOLD, the 14607 results are undefined, and subsequent operations on the result 14608 cannot be guaranteed to produce sensible behavior. For example, it 14609 is possible to create 'LOGICAL' variables for which 'VAR' and 14610 '.NOT.VAR' both appear to be true. 14611 14612_Example_: 14613 PROGRAM test_transfer 14614 integer :: x = 2143289344 14615 print *, transfer(x, 1.0) ! prints "NaN" on i686 14616 END PROGRAM 14617 14618 14619File: gfortran.info, Node: TRANSPOSE, Next: TRIM, Prev: TRANSFER, Up: Intrinsic Procedures 14620 146218.248 'TRANSPOSE' -- Transpose an array of rank two 14622=================================================== 14623 14624_Description_: 14625 Transpose an array of rank two. Element (i, j) of the result has 14626 the value 'MATRIX(j, i)', for all i, j. 14627 14628_Standard_: 14629 Fortran 95 and later 14630 14631_Class_: 14632 Transformational function 14633 14634_Syntax_: 14635 'RESULT = TRANSPOSE(MATRIX)' 14636 14637_Arguments_: 14638 MATRIX Shall be an array of any type and have a rank of 14639 two. 14640 14641_Return value_: 14642 The result has the same type as MATRIX, and has shape '(/ m, n /)' 14643 if MATRIX has shape '(/ n, m /)'. 14644 14645 14646File: gfortran.info, Node: TRIM, Next: TTYNAM, Prev: TRANSPOSE, Up: Intrinsic Procedures 14647 146488.249 'TRIM' -- Remove trailing blank characters of a string 14649============================================================ 14650 14651_Description_: 14652 Removes trailing blank characters of a string. 14653 14654_Standard_: 14655 Fortran 95 and later 14656 14657_Class_: 14658 Transformational function 14659 14660_Syntax_: 14661 'RESULT = TRIM(STRING)' 14662 14663_Arguments_: 14664 STRING Shall be a scalar of type 'CHARACTER'. 14665 14666_Return value_: 14667 A scalar of type 'CHARACTER' which length is that of STRING less 14668 the number of trailing blanks. 14669 14670_Example_: 14671 PROGRAM test_trim 14672 CHARACTER(len=10), PARAMETER :: s = "GFORTRAN " 14673 WRITE(*,*) LEN(s), LEN(TRIM(s)) ! "10 8", with/without trailing blanks 14674 END PROGRAM 14675 14676_See also_: 14677 *note ADJUSTL::, *note ADJUSTR:: 14678 14679 14680File: gfortran.info, Node: TTYNAM, Next: UBOUND, Prev: TRIM, Up: Intrinsic Procedures 14681 146828.250 'TTYNAM' -- Get the name of a terminal device. 14683==================================================== 14684 14685_Description_: 14686 Get the name of a terminal device. For more information, see 14687 'ttyname(3)'. 14688 14689 This intrinsic is provided in both subroutine and function forms; 14690 however, only one form can be used in any given program unit. 14691 14692_Standard_: 14693 GNU extension 14694 14695_Class_: 14696 Subroutine, function 14697 14698_Syntax_: 14699 'CALL TTYNAM(UNIT, NAME)' 14700 'NAME = TTYNAM(UNIT)' 14701 14702_Arguments_: 14703 UNIT Shall be a scalar 'INTEGER'. 14704 NAME Shall be of type 'CHARACTER'. 14705 14706_Example_: 14707 PROGRAM test_ttynam 14708 INTEGER :: unit 14709 DO unit = 1, 10 14710 IF (isatty(unit=unit)) write(*,*) ttynam(unit) 14711 END DO 14712 END PROGRAM 14713 14714_See also_: 14715 *note ISATTY:: 14716 14717 14718File: gfortran.info, Node: UBOUND, Next: UCOBOUND, Prev: TTYNAM, Up: Intrinsic Procedures 14719 147208.251 'UBOUND' -- Upper dimension bounds of an array 14721==================================================== 14722 14723_Description_: 14724 Returns the upper bounds of an array, or a single upper bound along 14725 the DIM dimension. 14726_Standard_: 14727 Fortran 95 and later, with KIND argument Fortran 2003 and later 14728 14729_Class_: 14730 Inquiry function 14731 14732_Syntax_: 14733 'RESULT = UBOUND(ARRAY [, DIM [, KIND]])' 14734 14735_Arguments_: 14736 ARRAY Shall be an array, of any type. 14737 DIM (Optional) Shall be a scalar 'INTEGER'. 14738 KIND (Optional) An 'INTEGER' initialization 14739 expression indicating the kind parameter of the 14740 result. 14741 14742_Return value_: 14743 The return value is of type 'INTEGER' and of kind KIND. If KIND is 14744 absent, the return value is of default integer kind. If DIM is 14745 absent, the result is an array of the upper bounds of ARRAY. If 14746 DIM is present, the result is a scalar corresponding to the upper 14747 bound of the array along that dimension. If ARRAY is an expression 14748 rather than a whole array or array structure component, or if it 14749 has a zero extent along the relevant dimension, the upper bound is 14750 taken to be the number of elements along the relevant dimension. 14751 14752_See also_: 14753 *note LBOUND::, *note LCOBOUND:: 14754 14755 14756File: gfortran.info, Node: UCOBOUND, Next: UMASK, Prev: UBOUND, Up: Intrinsic Procedures 14757 147588.252 'UCOBOUND' -- Upper codimension bounds of an array 14759======================================================== 14760 14761_Description_: 14762 Returns the upper cobounds of a coarray, or a single upper cobound 14763 along the DIM codimension. 14764_Standard_: 14765 Fortran 2008 and later 14766 14767_Class_: 14768 Inquiry function 14769 14770_Syntax_: 14771 'RESULT = UCOBOUND(COARRAY [, DIM [, KIND]])' 14772 14773_Arguments_: 14774 ARRAY Shall be an coarray, of any type. 14775 DIM (Optional) Shall be a scalar 'INTEGER'. 14776 KIND (Optional) An 'INTEGER' initialization 14777 expression indicating the kind parameter of the 14778 result. 14779 14780_Return value_: 14781 The return value is of type 'INTEGER' and of kind KIND. If KIND is 14782 absent, the return value is of default integer kind. If DIM is 14783 absent, the result is an array of the lower cobounds of COARRAY. 14784 If DIM is present, the result is a scalar corresponding to the 14785 lower cobound of the array along that codimension. 14786 14787_See also_: 14788 *note LCOBOUND::, *note LBOUND:: 14789 14790 14791File: gfortran.info, Node: UMASK, Next: UNLINK, Prev: UCOBOUND, Up: Intrinsic Procedures 14792 147938.253 'UMASK' -- Set the file creation mask 14794=========================================== 14795 14796_Description_: 14797 Sets the file creation mask to MASK. If called as a function, it 14798 returns the old value. If called as a subroutine and argument OLD 14799 if it is supplied, it is set to the old value. See 'umask(2)'. 14800 14801_Standard_: 14802 GNU extension 14803 14804_Class_: 14805 Subroutine, function 14806 14807_Syntax_: 14808 'CALL UMASK(MASK [, OLD])' 14809 'OLD = UMASK(MASK)' 14810 14811_Arguments_: 14812 MASK Shall be a scalar of type 'INTEGER'. 14813 OLD (Optional) Shall be a scalar of type 'INTEGER'. 14814 14815 14816File: gfortran.info, Node: UNLINK, Next: UNPACK, Prev: UMASK, Up: Intrinsic Procedures 14817 148188.254 'UNLINK' -- Remove a file from the file system 14819==================================================== 14820 14821_Description_: 14822 Unlinks the file PATH. A null character ('CHAR(0)') can be used to 14823 mark the end of the name in PATH; otherwise, trailing blanks in the 14824 file name are ignored. If the STATUS argument is supplied, it 14825 contains 0 on success or a nonzero error code upon return; see 14826 'unlink(2)'. 14827 14828 This intrinsic is provided in both subroutine and function forms; 14829 however, only one form can be used in any given program unit. 14830 14831_Standard_: 14832 GNU extension 14833 14834_Class_: 14835 Subroutine, function 14836 14837_Syntax_: 14838 'CALL UNLINK(PATH [, STATUS])' 14839 'STATUS = UNLINK(PATH)' 14840 14841_Arguments_: 14842 PATH Shall be of default 'CHARACTER' type. 14843 STATUS (Optional) Shall be of default 'INTEGER' type. 14844 14845_See also_: 14846 *note LINK::, *note SYMLNK:: 14847 14848 14849File: gfortran.info, Node: UNPACK, Next: VERIFY, Prev: UNLINK, Up: Intrinsic Procedures 14850 148518.255 'UNPACK' -- Unpack an array of rank one into an array 14852=========================================================== 14853 14854_Description_: 14855 Store the elements of VECTOR in an array of higher rank. 14856 14857_Standard_: 14858 Fortran 95 and later 14859 14860_Class_: 14861 Transformational function 14862 14863_Syntax_: 14864 'RESULT = UNPACK(VECTOR, MASK, FIELD)' 14865 14866_Arguments_: 14867 VECTOR Shall be an array of any type and rank one. It 14868 shall have at least as many elements as MASK has 14869 'TRUE' values. 14870 MASK Shall be an array of type 'LOGICAL'. 14871 FIELD Shall be of the same type as VECTOR and have the 14872 same shape as MASK. 14873 14874_Return value_: 14875 The resulting array corresponds to FIELD with 'TRUE' elements of 14876 MASK replaced by values from VECTOR in array element order. 14877 14878_Example_: 14879 PROGRAM test_unpack 14880 integer :: vector(2) = (/1,1/) 14881 logical :: mask(4) = (/ .TRUE., .FALSE., .FALSE., .TRUE. /) 14882 integer :: field(2,2) = 0, unity(2,2) 14883 14884 ! result: unity matrix 14885 unity = unpack(vector, reshape(mask, (/2,2/)), field) 14886 END PROGRAM 14887 14888_See also_: 14889 *note PACK::, *note SPREAD:: 14890 14891 14892File: gfortran.info, Node: VERIFY, Next: XOR, Prev: UNPACK, Up: Intrinsic Procedures 14893 148948.256 'VERIFY' -- Scan a string for characters not a given set 14895============================================================== 14896 14897_Description_: 14898 Verifies that all the characters in STRING belong to the set of 14899 characters in SET. 14900 14901 If BACK is either absent or equals 'FALSE', this function returns 14902 the position of the leftmost character of STRING that is not in 14903 SET. If BACK equals 'TRUE', the rightmost position is returned. 14904 If all characters of STRING are found in SET, the result is zero. 14905 14906_Standard_: 14907 Fortran 95 and later, with KIND argument Fortran 2003 and later 14908 14909_Class_: 14910 Elemental function 14911 14912_Syntax_: 14913 'RESULT = VERIFY(STRING, SET[, BACK [, KIND]])' 14914 14915_Arguments_: 14916 STRING Shall be of type 'CHARACTER'. 14917 SET Shall be of type 'CHARACTER'. 14918 BACK (Optional) shall be of type 'LOGICAL'. 14919 KIND (Optional) An 'INTEGER' initialization 14920 expression indicating the kind parameter of the 14921 result. 14922 14923_Return value_: 14924 The return value is of type 'INTEGER' and of kind KIND. If KIND is 14925 absent, the return value is of default integer kind. 14926 14927_Example_: 14928 PROGRAM test_verify 14929 WRITE(*,*) VERIFY("FORTRAN", "AO") ! 1, found 'F' 14930 WRITE(*,*) VERIFY("FORTRAN", "FOO") ! 3, found 'R' 14931 WRITE(*,*) VERIFY("FORTRAN", "C++") ! 1, found 'F' 14932 WRITE(*,*) VERIFY("FORTRAN", "C++", .TRUE.) ! 7, found 'N' 14933 WRITE(*,*) VERIFY("FORTRAN", "FORTRAN") ! 0' found none 14934 END PROGRAM 14935 14936_See also_: 14937 *note SCAN::, *note INDEX intrinsic:: 14938 14939 14940File: gfortran.info, Node: XOR, Prev: VERIFY, Up: Intrinsic Procedures 14941 149428.257 'XOR' -- Bitwise logical exclusive OR 14943=========================================== 14944 14945_Description_: 14946 Bitwise logical exclusive or. 14947 14948 This intrinsic routine is provided for backwards compatibility with 14949 GNU Fortran 77. For integer arguments, programmers should consider 14950 the use of the *note IEOR:: intrinsic and for logical arguments the 14951 '.NEQV.' operator, which are both defined by the Fortran standard. 14952 14953_Standard_: 14954 GNU extension 14955 14956_Class_: 14957 Function 14958 14959_Syntax_: 14960 'RESULT = XOR(I, J)' 14961 14962_Arguments_: 14963 I The type shall be either a scalar 'INTEGER' type 14964 or a scalar 'LOGICAL' type. 14965 J The type shall be the same as the type of I. 14966 14967_Return value_: 14968 The return type is either a scalar 'INTEGER' or a scalar 'LOGICAL'. 14969 If the kind type parameters differ, then the smaller kind type is 14970 implicitly converted to larger kind, and the return has the larger 14971 kind. 14972 14973_Example_: 14974 PROGRAM test_xor 14975 LOGICAL :: T = .TRUE., F = .FALSE. 14976 INTEGER :: a, b 14977 DATA a / Z'F' /, b / Z'3' / 14978 14979 WRITE (*,*) XOR(T, T), XOR(T, F), XOR(F, T), XOR(F, F) 14980 WRITE (*,*) XOR(a, b) 14981 END PROGRAM 14982 14983_See also_: 14984 Fortran 95 elemental function: *note IEOR:: 14985 14986 14987File: gfortran.info, Node: Intrinsic Modules, Next: Contributing, Prev: Intrinsic Procedures, Up: Top 14988 149899 Intrinsic Modules 14990******************* 14991 14992* Menu: 14993 14994* ISO_FORTRAN_ENV:: 14995* ISO_C_BINDING:: 14996* OpenMP Modules OMP_LIB and OMP_LIB_KINDS:: 14997 14998 14999File: gfortran.info, Node: ISO_FORTRAN_ENV, Next: ISO_C_BINDING, Up: Intrinsic Modules 15000 150019.1 'ISO_FORTRAN_ENV' 15002===================== 15003 15004_Standard_: 15005 Fortran 2003 and later, except when otherwise noted 15006 15007 The 'ISO_FORTRAN_ENV' module provides the following scalar 15008default-integer named constants: 15009 15010'ATOMIC_INT_KIND': 15011 Default-kind integer constant to be used as kind parameter when 15012 defining integer variables used in atomic operations. (Fortran 15013 2008 or later.) 15014 15015'ATOMIC_LOGICAL_KIND': 15016 Default-kind integer constant to be used as kind parameter when 15017 defining logical variables used in atomic operations. (Fortran 15018 2008 or later.) 15019 15020'CHARACTER_KINDS': 15021 Default-kind integer constant array of rank one containing the 15022 supported kind parameters of the 'CHARACTER' type. (Fortran 2008 15023 or later.) 15024 15025'CHARACTER_STORAGE_SIZE': 15026 Size in bits of the character storage unit. 15027 15028'ERROR_UNIT': 15029 Identifies the preconnected unit used for error reporting. 15030 15031'FILE_STORAGE_SIZE': 15032 Size in bits of the file-storage unit. 15033 15034'INPUT_UNIT': 15035 Identifies the preconnected unit identified by the asterisk ('*') 15036 in 'READ' statement. 15037 15038'INT8', 'INT16', 'INT32', 'INT64': 15039 Kind type parameters to specify an INTEGER type with a storage size 15040 of 16, 32, and 64 bits. It is negative if a target platform does 15041 not support the particular kind. (Fortran 2008 or later.) 15042 15043'INTEGER_KINDS': 15044 Default-kind integer constant array of rank one containing the 15045 supported kind parameters of the 'INTEGER' type. (Fortran 2008 or 15046 later.) 15047 15048'IOSTAT_END': 15049 The value assigned to the variable passed to the 'IOSTAT=' 15050 specifier of an input/output statement if an end-of-file condition 15051 occurred. 15052 15053'IOSTAT_EOR': 15054 The value assigned to the variable passed to the 'IOSTAT=' 15055 specifier of an input/output statement if an end-of-record 15056 condition occurred. 15057 15058'IOSTAT_INQUIRE_INTERNAL_UNIT': 15059 Scalar default-integer constant, used by 'INQUIRE' for the 15060 'IOSTAT=' specifier to denote an that a unit number identifies an 15061 internal unit. (Fortran 2008 or later.) 15062 15063'NUMERIC_STORAGE_SIZE': 15064 The size in bits of the numeric storage unit. 15065 15066'LOGICAL_KINDS': 15067 Default-kind integer constant array of rank one containing the 15068 supported kind parameters of the 'LOGICAL' type. (Fortran 2008 or 15069 later.) 15070 15071'OUTPUT_UNIT': 15072 Identifies the preconnected unit identified by the asterisk ('*') 15073 in 'WRITE' statement. 15074 15075'REAL32', 'REAL64', 'REAL128': 15076 Kind type parameters to specify a REAL type with a storage size of 15077 32, 64, and 128 bits. It is negative if a target platform does not 15078 support the particular kind. (Fortran 2008 or later.) 15079 15080'REAL_KINDS': 15081 Default-kind integer constant array of rank one containing the 15082 supported kind parameters of the 'REAL' type. (Fortran 2008 or 15083 later.) 15084 15085'STAT_LOCKED': 15086 Scalar default-integer constant used as STAT= return value by 15087 'LOCK' to denote that the lock variable is locked by the executing 15088 image. (Fortran 2008 or later.) 15089 15090'STAT_LOCKED_OTHER_IMAGE': 15091 Scalar default-integer constant used as STAT= return value by 15092 'UNLOCK' to denote that the lock variable is locked by another 15093 image. (Fortran 2008 or later.) 15094 15095'STAT_STOPPED_IMAGE': 15096 Positive, scalar default-integer constant used as STAT= return 15097 value if the argument in the statement requires synchronisation 15098 with an image, which has initiated the termination of the 15099 execution. (Fortran 2008 or later.) 15100 15101'STAT_UNLOCKED': 15102 Scalar default-integer constant used as STAT= return value by 15103 'UNLOCK' to denote that the lock variable is unlocked. (Fortran 15104 2008 or later.) 15105 15106 The module provides the following derived type: 15107 15108'LOCK_TYPE': 15109 Derived type with private components to be use with the 'LOCK' and 15110 'UNLOCK' statement. A variable of its type has to be always 15111 declared as coarray and may not appear in a variable-definition 15112 context. (Fortran 2008 or later.) 15113 15114 The module also provides the following intrinsic procedures: *note 15115COMPILER_OPTIONS:: and *note COMPILER_VERSION::. 15116 15117 15118File: gfortran.info, Node: ISO_C_BINDING, Next: OpenMP Modules OMP_LIB and OMP_LIB_KINDS, Prev: ISO_FORTRAN_ENV, Up: Intrinsic Modules 15119 151209.2 'ISO_C_BINDING' 15121=================== 15122 15123_Standard_: 15124 Fortran 2003 and later, GNU extensions 15125 15126 The following intrinsic procedures are provided by the module; their 15127definition can be found in the section Intrinsic Procedures of this 15128manual. 15129 15130'C_ASSOCIATED' 15131'C_F_POINTER' 15132'C_F_PROCPOINTER' 15133'C_FUNLOC' 15134'C_LOC' 15135'C_SIZEOF' 15136 15137 The 'ISO_C_BINDING' module provides the following named constants of 15138type default integer, which can be used as KIND type parameters. 15139 15140 In addition to the integer named constants required by the Fortran 151412003 standard and 'C_PTRDIFF_T' of TS 29113, GNU Fortran provides as an 15142extension named constants for the 128-bit integer types supported by the 15143C compiler: 'C_INT128_T, C_INT_LEAST128_T, C_INT_FAST128_T'. 15144Furthermore, if '__float128' is supported in C, the named constants 15145'C_FLOAT128, C_FLOAT128_COMPLEX' are defined. 15146 15147Fortran Named constant C type Extension 15148Type 15149'INTEGER' 'C_INT' 'int' 15150'INTEGER' 'C_SHORT' 'short int' 15151'INTEGER' 'C_LONG' 'long int' 15152'INTEGER' 'C_LONG_LONG' 'long long int' 15153'INTEGER' 'C_SIGNED_CHAR' 'signed char'/'unsigned 15154 char' 15155'INTEGER' 'C_SIZE_T' 'size_t' 15156'INTEGER' 'C_INT8_T' 'int8_t' 15157'INTEGER' 'C_INT16_T' 'int16_t' 15158'INTEGER' 'C_INT32_T' 'int32_t' 15159'INTEGER' 'C_INT64_T' 'int64_t' 15160'INTEGER' 'C_INT128_T' 'int128_t' Ext. 15161'INTEGER' 'C_INT_LEAST8_T' 'int_least8_t' 15162'INTEGER' 'C_INT_LEAST16_T' 'int_least16_t' 15163'INTEGER' 'C_INT_LEAST32_T' 'int_least32_t' 15164'INTEGER' 'C_INT_LEAST64_T' 'int_least64_t' 15165'INTEGER' 'C_INT_LEAST128_T' 'int_least128_t' Ext. 15166'INTEGER' 'C_INT_FAST8_T' 'int_fast8_t' 15167'INTEGER' 'C_INT_FAST16_T' 'int_fast16_t' 15168'INTEGER' 'C_INT_FAST32_T' 'int_fast32_t' 15169'INTEGER' 'C_INT_FAST64_T' 'int_fast64_t' 15170'INTEGER' 'C_INT_FAST128_T' 'int_fast128_t' Ext. 15171'INTEGER' 'C_INTMAX_T' 'intmax_t' 15172'INTEGER' 'C_INTPTR_T' 'intptr_t' 15173'INTEGER' 'C_PTRDIFF_T' 'intptr_t' TS 29113 15174'REAL' 'C_FLOAT' 'float' 15175'REAL' 'C_DOUBLE' 'double' 15176'REAL' 'C_LONG_DOUBLE' 'long double' 15177'REAL' 'C_FLOAT128' '__float128' Ext. 15178'COMPLEX' 'C_FLOAT_COMPLEX' 'float _Complex' 15179'COMPLEX' 'C_DOUBLE_COMPLEX' 'double _Complex' 15180'COMPLEX' 'C_LONG_DOUBLE_COMPLEX' 'long double _Complex' 15181'REAL' 'C_FLOAT128_COMPLEX' '__float128 _Complex' Ext. 15182'LOGICAL' 'C_BOOL' '_Bool' 15183'CHARACTER' 'C_CHAR' 'char' 15184 15185 Additionally, the following parameters of type 15186'CHARACTER(KIND=C_CHAR)' are defined. 15187 15188Name C definition Value 15189'C_NULL_CHAR' null character ''\0'' 15190'C_ALERT' alert ''\a'' 15191'C_BACKSPACE' backspace ''\b'' 15192'C_FORM_FEED' form feed ''\f'' 15193'C_NEW_LINE' new line ''\n'' 15194'C_CARRIAGE_RETURN'carriage return ''\r'' 15195'C_HORIZONTAL_TAB'horizontal tab ''\t'' 15196'C_VERTICAL_TAB'vertical tab ''\v'' 15197 15198 Moreover, the following two named constants are defined: 15199 15200Name Type 15201'C_NULL_PTR' 'C_PTR' 15202'C_NULL_FUNPTR''C_FUNPTR' 15203 15204 Both are equivalent to the value 'NULL' in C. 15205 15206 15207File: gfortran.info, Node: OpenMP Modules OMP_LIB and OMP_LIB_KINDS, Prev: ISO_C_BINDING, Up: Intrinsic Modules 15208 152099.3 OpenMP Modules 'OMP_LIB' and 'OMP_LIB_KINDS' 15210================================================ 15211 15212_Standard_: 15213 OpenMP Application Program Interface v4.0 15214 15215 The OpenMP Fortran runtime library routines are provided both in a 15216form of two Fortran 90 modules, named 'OMP_LIB' and 'OMP_LIB_KINDS', and 15217in a form of a Fortran 'include' file named 'omp_lib.h'. The procedures 15218provided by 'OMP_LIB' can be found in the *note Introduction: 15219(libgomp)Top. manual, the named constants defined in the modules are 15220listed below. 15221 15222 For details refer to the actual OpenMP Application Program Interface 15223v4.0 (http://www.openmp.org/mp-documents/OpenMP4.0.0.pdf). 15224 15225 'OMP_LIB_KINDS' provides the following scalar default-integer named 15226constants: 15227 15228'omp_lock_kind' 15229'omp_nest_lock_kind' 15230'omp_proc_bind_kind' 15231'omp_sched_kind' 15232 15233 'OMP_LIB' provides the scalar default-integer named constant 15234'openmp_version' with a value of the form YYYYMM, where 'yyyy' is the 15235year and MM the month of the OpenMP version; for OpenMP v4.0 the value 15236is '201307'. 15237 15238 The following scalar integer named constants of the kind 15239'omp_sched_kind': 15240 15241'omp_sched_static' 15242'omp_sched_dynamic' 15243'omp_sched_guided' 15244'omp_sched_auto' 15245 15246 And the following scalar integer named constants of the kind 15247'omp_proc_bind_kind': 15248 15249'omp_proc_bind_false' 15250'omp_proc_bind_true' 15251'omp_proc_bind_master' 15252'omp_proc_bind_close' 15253'omp_proc_bind_spread' 15254 15255 15256File: gfortran.info, Node: Contributing, Next: Copying, Prev: Intrinsic Modules, Up: Top 15257 15258Contributing 15259************ 15260 15261Free software is only possible if people contribute to efforts to create 15262it. We're always in need of more people helping out with ideas and 15263comments, writing documentation and contributing code. 15264 15265 If you want to contribute to GNU Fortran, have a look at the long 15266lists of projects you can take on. Some of these projects are small, 15267some of them are large; some are completely orthogonal to the rest of 15268what is happening on GNU Fortran, but others are "mainstream" projects 15269in need of enthusiastic hackers. All of these projects are important! 15270We will eventually get around to the things here, but they are also 15271things doable by someone who is willing and able. 15272 15273* Menu: 15274 15275* Contributors:: 15276* Projects:: 15277* Proposed Extensions:: 15278 15279 15280File: gfortran.info, Node: Contributors, Next: Projects, Up: Contributing 15281 15282Contributors to GNU Fortran 15283=========================== 15284 15285Most of the parser was hand-crafted by _Andy Vaught_, who is also the 15286initiator of the whole project. Thanks Andy! Most of the interface 15287with GCC was written by _Paul Brook_. 15288 15289 The following individuals have contributed code and/or ideas and 15290significant help to the GNU Fortran project (in alphabetical order): 15291 15292 - Janne Blomqvist 15293 - Steven Bosscher 15294 - Paul Brook 15295 - Tobias Burnus 15296 - Franc,ois-Xavier Coudert 15297 - Bud Davis 15298 - Jerry DeLisle 15299 - Erik Edelmann 15300 - Bernhard Fischer 15301 - Daniel Franke 15302 - Richard Guenther 15303 - Richard Henderson 15304 - Katherine Holcomb 15305 - Jakub Jelinek 15306 - Niels Kristian Bech Jensen 15307 - Steven Johnson 15308 - Steven G. Kargl 15309 - Thomas Koenig 15310 - Asher Langton 15311 - H. J. Lu 15312 - Toon Moene 15313 - Brooks Moses 15314 - Andrew Pinski 15315 - Tim Prince 15316 - Christopher D. Rickett 15317 - Richard Sandiford 15318 - Tobias Schlu"ter 15319 - Roger Sayle 15320 - Paul Thomas 15321 - Andy Vaught 15322 - Feng Wang 15323 - Janus Weil 15324 - Daniel Kraft 15325 15326 The following people have contributed bug reports, smaller or larger 15327patches, and much needed feedback and encouragement for the GNU Fortran 15328project: 15329 15330 - Bill Clodius 15331 - Dominique d'Humie`res 15332 - Kate Hedstrom 15333 - Erik Schnetter 15334 - Joost VandeVondele 15335 15336 Many other individuals have helped debug, test and improve the GNU 15337Fortran compiler over the past few years, and we welcome you to do the 15338same! If you already have done so, and you would like to see your name 15339listed in the list above, please contact us. 15340 15341 15342File: gfortran.info, Node: Projects, Next: Proposed Extensions, Prev: Contributors, Up: Contributing 15343 15344Projects 15345======== 15346 15347_Help build the test suite_ 15348 Solicit more code for donation to the test suite: the more 15349 extensive the testsuite, the smaller the risk of breaking things in 15350 the future! We can keep code private on request. 15351 15352_Bug hunting/squishing_ 15353 Find bugs and write more test cases! Test cases are especially 15354 very welcome, because it allows us to concentrate on fixing bugs 15355 instead of isolating them. Going through the bugzilla database at 15356 <http://gcc.gnu.org/bugzilla/> to reduce testcases posted there and 15357 add more information (for example, for which version does the 15358 testcase work, for which versions does it fail?) is also very 15359 helpful. 15360 15361 15362File: gfortran.info, Node: Proposed Extensions, Prev: Projects, Up: Contributing 15363 15364Proposed Extensions 15365=================== 15366 15367Here's a list of proposed extensions for the GNU Fortran compiler, in no 15368particular order. Most of these are necessary to be fully compatible 15369with existing Fortran compilers, but they are not part of the official 15370J3 Fortran 95 standard. 15371 15372Compiler extensions: 15373-------------------- 15374 15375 * User-specified alignment rules for structures. 15376 15377 * Automatically extend single precision constants to double. 15378 15379 * Compile code that conserves memory by dynamically allocating common 15380 and module storage either on stack or heap. 15381 15382 * Compile flag to generate code for array conformance checking 15383 (suggest -CC). 15384 15385 * User control of symbol names (underscores, etc). 15386 15387 * Compile setting for maximum size of stack frame size before 15388 spilling parts to static or heap. 15389 15390 * Flag to force local variables into static space. 15391 15392 * Flag to force local variables onto stack. 15393 15394Environment Options 15395------------------- 15396 15397 * Pluggable library modules for random numbers, linear algebra. LA 15398 should use BLAS calling conventions. 15399 15400 * Environment variables controlling actions on arithmetic exceptions 15401 like overflow, underflow, precision loss--Generate NaN, abort, 15402 default. action. 15403 15404 * Set precision for fp units that support it (i387). 15405 15406 * Variable for setting fp rounding mode. 15407 15408 * Variable to fill uninitialized variables with a user-defined bit 15409 pattern. 15410 15411 * Environment variable controlling filename that is opened for that 15412 unit number. 15413 15414 * Environment variable to clear/trash memory being freed. 15415 15416 * Environment variable to control tracing of allocations and frees. 15417 15418 * Environment variable to display allocated memory at normal program 15419 end. 15420 15421 * Environment variable for filename for * IO-unit. 15422 15423 * Environment variable for temporary file directory. 15424 15425 * Environment variable forcing standard output to be line buffered 15426 (Unix). 15427 15428 15429File: gfortran.info, Node: Copying, Next: GNU Free Documentation License, Prev: Contributing, Up: Top 15430 15431GNU General Public License 15432************************** 15433 15434 Version 3, 29 June 2007 15435 15436 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> 15437 15438 Everyone is permitted to copy and distribute verbatim copies of this 15439 license document, but changing it is not allowed. 15440 15441Preamble 15442======== 15443 15444The GNU General Public License is a free, copyleft license for software 15445and other kinds of works. 15446 15447 The licenses for most software and other practical works are designed 15448to take away your freedom to share and change the works. By contrast, 15449the GNU General Public License is intended to guarantee your freedom to 15450share and change all versions of a program-to make sure it remains free 15451software for all its users. We, the Free Software Foundation, use the 15452GNU General Public License for most of our software; it applies also to 15453any other work released this way by its authors. You can apply it to 15454your programs, too. 15455 15456 When we speak of free software, we are referring to freedom, not 15457price. Our General Public Licenses are designed to make sure that you 15458have the freedom to distribute copies of free software (and charge for 15459them if you wish), that you receive source code or can get it if you 15460want it, that you can change the software or use pieces of it in new 15461free programs, and that you know you can do these things. 15462 15463 To protect your rights, we need to prevent others from denying you 15464these rights or asking you to surrender the rights. Therefore, you have 15465certain responsibilities if you distribute copies of the software, or if 15466you modify it: responsibilities to respect the freedom of others. 15467 15468 For example, if you distribute copies of such a program, whether 15469gratis or for a fee, you must pass on to the recipients the same 15470freedoms that you received. You must make sure that they, too, receive 15471or can get the source code. And you must show them these terms so they 15472know their rights. 15473 15474 Developers that use the GNU GPL protect your rights with two steps: 15475(1) assert copyright on the software, and (2) offer you this License 15476giving you legal permission to copy, distribute and/or modify it. 15477 15478 For the developers' and authors' protection, the GPL clearly explains 15479that there is no warranty for this free software. For both users' and 15480authors' sake, the GPL requires that modified versions be marked as 15481changed, so that their problems will not be attributed erroneously to 15482authors of previous versions. 15483 15484 Some devices are designed to deny users access to install or run 15485modified versions of the software inside them, although the manufacturer 15486can do so. This is fundamentally incompatible with the aim of 15487protecting users' freedom to change the software. The systematic 15488pattern of such abuse occurs in the area of products for individuals to 15489use, which is precisely where it is most unacceptable. Therefore, we 15490have designed this version of the GPL to prohibit the practice for those 15491products. If such problems arise substantially in other domains, we 15492stand ready to extend this provision to those domains in future versions 15493of the GPL, as needed to protect the freedom of users. 15494 15495 Finally, every program is threatened constantly by software patents. 15496States should not allow patents to restrict development and use of 15497software on general-purpose computers, but in those that do, we wish to 15498avoid the special danger that patents applied to a free program could 15499make it effectively proprietary. To prevent this, the GPL assures that 15500patents cannot be used to render the program non-free. 15501 15502 The precise terms and conditions for copying, distribution and 15503modification follow. 15504 15505TERMS AND CONDITIONS 15506==================== 15507 15508 0. Definitions. 15509 15510 "This License" refers to version 3 of the GNU General Public 15511 License. 15512 15513 "Copyright" also means copyright-like laws that apply to other 15514 kinds of works, such as semiconductor masks. 15515 15516 "The Program" refers to any copyrightable work licensed under this 15517 License. Each licensee is addressed as "you". "Licensees" and 15518 "recipients" may be individuals or organizations. 15519 15520 To "modify" a work means to copy from or adapt all or part of the 15521 work in a fashion requiring copyright permission, other than the 15522 making of an exact copy. The resulting work is called a "modified 15523 version" of the earlier work or a work "based on" the earlier work. 15524 15525 A "covered work" means either the unmodified Program or a work 15526 based on the Program. 15527 15528 To "propagate" a work means to do anything with it that, without 15529 permission, would make you directly or secondarily liable for 15530 infringement under applicable copyright law, except executing it on 15531 a computer or modifying a private copy. Propagation includes 15532 copying, distribution (with or without modification), making 15533 available to the public, and in some countries other activities as 15534 well. 15535 15536 To "convey" a work means any kind of propagation that enables other 15537 parties to make or receive copies. Mere interaction with a user 15538 through a computer network, with no transfer of a copy, is not 15539 conveying. 15540 15541 An interactive user interface displays "Appropriate Legal Notices" 15542 to the extent that it includes a convenient and prominently visible 15543 feature that (1) displays an appropriate copyright notice, and (2) 15544 tells the user that there is no warranty for the work (except to 15545 the extent that warranties are provided), that licensees may convey 15546 the work under this License, and how to view a copy of this 15547 License. If the interface presents a list of user commands or 15548 options, such as a menu, a prominent item in the list meets this 15549 criterion. 15550 15551 1. Source Code. 15552 15553 The "source code" for a work means the preferred form of the work 15554 for making modifications to it. "Object code" means any non-source 15555 form of a work. 15556 15557 A "Standard Interface" means an interface that either is an 15558 official standard defined by a recognized standards body, or, in 15559 the case of interfaces specified for a particular programming 15560 language, one that is widely used among developers working in that 15561 language. 15562 15563 The "System Libraries" of an executable work include anything, 15564 other than the work as a whole, that (a) is included in the normal 15565 form of packaging a Major Component, but which is not part of that 15566 Major Component, and (b) serves only to enable use of the work with 15567 that Major Component, or to implement a Standard Interface for 15568 which an implementation is available to the public in source code 15569 form. A "Major Component", in this context, means a major 15570 essential component (kernel, window system, and so on) of the 15571 specific operating system (if any) on which the executable work 15572 runs, or a compiler used to produce the work, or an object code 15573 interpreter used to run it. 15574 15575 The "Corresponding Source" for a work in object code form means all 15576 the source code needed to generate, install, and (for an executable 15577 work) run the object code and to modify the work, including scripts 15578 to control those activities. However, it does not include the 15579 work's System Libraries, or general-purpose tools or generally 15580 available free programs which are used unmodified in performing 15581 those activities but which are not part of the work. For example, 15582 Corresponding Source includes interface definition files associated 15583 with source files for the work, and the source code for shared 15584 libraries and dynamically linked subprograms that the work is 15585 specifically designed to require, such as by intimate data 15586 communication or control flow between those subprograms and other 15587 parts of the work. 15588 15589 The Corresponding Source need not include anything that users can 15590 regenerate automatically from other parts of the Corresponding 15591 Source. 15592 15593 The Corresponding Source for a work in source code form is that 15594 same work. 15595 15596 2. Basic Permissions. 15597 15598 All rights granted under this License are granted for the term of 15599 copyright on the Program, and are irrevocable provided the stated 15600 conditions are met. This License explicitly affirms your unlimited 15601 permission to run the unmodified Program. The output from running 15602 a covered work is covered by this License only if the output, given 15603 its content, constitutes a covered work. This License acknowledges 15604 your rights of fair use or other equivalent, as provided by 15605 copyright law. 15606 15607 You may make, run and propagate covered works that you do not 15608 convey, without conditions so long as your license otherwise 15609 remains in force. You may convey covered works to others for the 15610 sole purpose of having them make modifications exclusively for you, 15611 or provide you with facilities for running those works, provided 15612 that you comply with the terms of this License in conveying all 15613 material for which you do not control copyright. Those thus making 15614 or running the covered works for you must do so exclusively on your 15615 behalf, under your direction and control, on terms that prohibit 15616 them from making any copies of your copyrighted material outside 15617 their relationship with you. 15618 15619 Conveying under any other circumstances is permitted solely under 15620 the conditions stated below. Sublicensing is not allowed; section 15621 10 makes it unnecessary. 15622 15623 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 15624 15625 No covered work shall be deemed part of an effective technological 15626 measure under any applicable law fulfilling obligations under 15627 article 11 of the WIPO copyright treaty adopted on 20 December 15628 1996, or similar laws prohibiting or restricting circumvention of 15629 such measures. 15630 15631 When you convey a covered work, you waive any legal power to forbid 15632 circumvention of technological measures to the extent such 15633 circumvention is effected by exercising rights under this License 15634 with respect to the covered work, and you disclaim any intention to 15635 limit operation or modification of the work as a means of 15636 enforcing, against the work's users, your or third parties' legal 15637 rights to forbid circumvention of technological measures. 15638 15639 4. Conveying Verbatim Copies. 15640 15641 You may convey verbatim copies of the Program's source code as you 15642 receive it, in any medium, provided that you conspicuously and 15643 appropriately publish on each copy an appropriate copyright notice; 15644 keep intact all notices stating that this License and any 15645 non-permissive terms added in accord with section 7 apply to the 15646 code; keep intact all notices of the absence of any warranty; and 15647 give all recipients a copy of this License along with the Program. 15648 15649 You may charge any price or no price for each copy that you convey, 15650 and you may offer support or warranty protection for a fee. 15651 15652 5. Conveying Modified Source Versions. 15653 15654 You may convey a work based on the Program, or the modifications to 15655 produce it from the Program, in the form of source code under the 15656 terms of section 4, provided that you also meet all of these 15657 conditions: 15658 15659 a. The work must carry prominent notices stating that you 15660 modified it, and giving a relevant date. 15661 15662 b. The work must carry prominent notices stating that it is 15663 released under this License and any conditions added under 15664 section 7. This requirement modifies the requirement in 15665 section 4 to "keep intact all notices". 15666 15667 c. You must license the entire work, as a whole, under this 15668 License to anyone who comes into possession of a copy. This 15669 License will therefore apply, along with any applicable 15670 section 7 additional terms, to the whole of the work, and all 15671 its parts, regardless of how they are packaged. This License 15672 gives no permission to license the work in any other way, but 15673 it does not invalidate such permission if you have separately 15674 received it. 15675 15676 d. If the work has interactive user interfaces, each must display 15677 Appropriate Legal Notices; however, if the Program has 15678 interactive interfaces that do not display Appropriate Legal 15679 Notices, your work need not make them do so. 15680 15681 A compilation of a covered work with other separate and independent 15682 works, which are not by their nature extensions of the covered 15683 work, and which are not combined with it such as to form a larger 15684 program, in or on a volume of a storage or distribution medium, is 15685 called an "aggregate" if the compilation and its resulting 15686 copyright are not used to limit the access or legal rights of the 15687 compilation's users beyond what the individual works permit. 15688 Inclusion of a covered work in an aggregate does not cause this 15689 License to apply to the other parts of the aggregate. 15690 15691 6. Conveying Non-Source Forms. 15692 15693 You may convey a covered work in object code form under the terms 15694 of sections 4 and 5, provided that you also convey the 15695 machine-readable Corresponding Source under the terms of this 15696 License, in one of these ways: 15697 15698 a. Convey the object code in, or embodied in, a physical product 15699 (including a physical distribution medium), accompanied by the 15700 Corresponding Source fixed on a durable physical medium 15701 customarily used for software interchange. 15702 15703 b. Convey the object code in, or embodied in, a physical product 15704 (including a physical distribution medium), accompanied by a 15705 written offer, valid for at least three years and valid for as 15706 long as you offer spare parts or customer support for that 15707 product model, to give anyone who possesses the object code 15708 either (1) a copy of the Corresponding Source for all the 15709 software in the product that is covered by this License, on a 15710 durable physical medium customarily used for software 15711 interchange, for a price no more than your reasonable cost of 15712 physically performing this conveying of source, or (2) access 15713 to copy the Corresponding Source from a network server at no 15714 charge. 15715 15716 c. Convey individual copies of the object code with a copy of the 15717 written offer to provide the Corresponding Source. This 15718 alternative is allowed only occasionally and noncommercially, 15719 and only if you received the object code with such an offer, 15720 in accord with subsection 6b. 15721 15722 d. Convey the object code by offering access from a designated 15723 place (gratis or for a charge), and offer equivalent access to 15724 the Corresponding Source in the same way through the same 15725 place at no further charge. You need not require recipients 15726 to copy the Corresponding Source along with the object code. 15727 If the place to copy the object code is a network server, the 15728 Corresponding Source may be on a different server (operated by 15729 you or a third party) that supports equivalent copying 15730 facilities, provided you maintain clear directions next to the 15731 object code saying where to find the Corresponding Source. 15732 Regardless of what server hosts the Corresponding Source, you 15733 remain obligated to ensure that it is available for as long as 15734 needed to satisfy these requirements. 15735 15736 e. Convey the object code using peer-to-peer transmission, 15737 provided you inform other peers where the object code and 15738 Corresponding Source of the work are being offered to the 15739 general public at no charge under subsection 6d. 15740 15741 A separable portion of the object code, whose source code is 15742 excluded from the Corresponding Source as a System Library, need 15743 not be included in conveying the object code work. 15744 15745 A "User Product" is either (1) a "consumer product", which means 15746 any tangible personal property which is normally used for personal, 15747 family, or household purposes, or (2) anything designed or sold for 15748 incorporation into a dwelling. In determining whether a product is 15749 a consumer product, doubtful cases shall be resolved in favor of 15750 coverage. For a particular product received by a particular user, 15751 "normally used" refers to a typical or common use of that class of 15752 product, regardless of the status of the particular user or of the 15753 way in which the particular user actually uses, or expects or is 15754 expected to use, the product. A product is a consumer product 15755 regardless of whether the product has substantial commercial, 15756 industrial or non-consumer uses, unless such uses represent the 15757 only significant mode of use of the product. 15758 15759 "Installation Information" for a User Product means any methods, 15760 procedures, authorization keys, or other information required to 15761 install and execute modified versions of a covered work in that 15762 User Product from a modified version of its Corresponding Source. 15763 The information must suffice to ensure that the continued 15764 functioning of the modified object code is in no case prevented or 15765 interfered with solely because modification has been made. 15766 15767 If you convey an object code work under this section in, or with, 15768 or specifically for use in, a User Product, and the conveying 15769 occurs as part of a transaction in which the right of possession 15770 and use of the User Product is transferred to the recipient in 15771 perpetuity or for a fixed term (regardless of how the transaction 15772 is characterized), the Corresponding Source conveyed under this 15773 section must be accompanied by the Installation Information. But 15774 this requirement does not apply if neither you nor any third party 15775 retains the ability to install modified object code on the User 15776 Product (for example, the work has been installed in ROM). 15777 15778 The requirement to provide Installation Information does not 15779 include a requirement to continue to provide support service, 15780 warranty, or updates for a work that has been modified or installed 15781 by the recipient, or for the User Product in which it has been 15782 modified or installed. Access to a network may be denied when the 15783 modification itself materially and adversely affects the operation 15784 of the network or violates the rules and protocols for 15785 communication across the network. 15786 15787 Corresponding Source conveyed, and Installation Information 15788 provided, in accord with this section must be in a format that is 15789 publicly documented (and with an implementation available to the 15790 public in source code form), and must require no special password 15791 or key for unpacking, reading or copying. 15792 15793 7. Additional Terms. 15794 15795 "Additional permissions" are terms that supplement the terms of 15796 this License by making exceptions from one or more of its 15797 conditions. Additional permissions that are applicable to the 15798 entire Program shall be treated as though they were included in 15799 this License, to the extent that they are valid under applicable 15800 law. If additional permissions apply only to part of the Program, 15801 that part may be used separately under those permissions, but the 15802 entire Program remains governed by this License without regard to 15803 the additional permissions. 15804 15805 When you convey a copy of a covered work, you may at your option 15806 remove any additional permissions from that copy, or from any part 15807 of it. (Additional permissions may be written to require their own 15808 removal in certain cases when you modify the work.) You may place 15809 additional permissions on material, added by you to a covered work, 15810 for which you have or can give appropriate copyright permission. 15811 15812 Notwithstanding any other provision of this License, for material 15813 you add to a covered work, you may (if authorized by the copyright 15814 holders of that material) supplement the terms of this License with 15815 terms: 15816 15817 a. Disclaiming warranty or limiting liability differently from 15818 the terms of sections 15 and 16 of this License; or 15819 15820 b. Requiring preservation of specified reasonable legal notices 15821 or author attributions in that material or in the Appropriate 15822 Legal Notices displayed by works containing it; or 15823 15824 c. Prohibiting misrepresentation of the origin of that material, 15825 or requiring that modified versions of such material be marked 15826 in reasonable ways as different from the original version; or 15827 15828 d. Limiting the use for publicity purposes of names of licensors 15829 or authors of the material; or 15830 15831 e. Declining to grant rights under trademark law for use of some 15832 trade names, trademarks, or service marks; or 15833 15834 f. Requiring indemnification of licensors and authors of that 15835 material by anyone who conveys the material (or modified 15836 versions of it) with contractual assumptions of liability to 15837 the recipient, for any liability that these contractual 15838 assumptions directly impose on those licensors and authors. 15839 15840 All other non-permissive additional terms are considered "further 15841 restrictions" within the meaning of section 10. If the Program as 15842 you received it, or any part of it, contains a notice stating that 15843 it is governed by this License along with a term that is a further 15844 restriction, you may remove that term. If a license document 15845 contains a further restriction but permits relicensing or conveying 15846 under this License, you may add to a covered work material governed 15847 by the terms of that license document, provided that the further 15848 restriction does not survive such relicensing or conveying. 15849 15850 If you add terms to a covered work in accord with this section, you 15851 must place, in the relevant source files, a statement of the 15852 additional terms that apply to those files, or a notice indicating 15853 where to find the applicable terms. 15854 15855 Additional terms, permissive or non-permissive, may be stated in 15856 the form of a separately written license, or stated as exceptions; 15857 the above requirements apply either way. 15858 15859 8. Termination. 15860 15861 You may not propagate or modify a covered work except as expressly 15862 provided under this License. Any attempt otherwise to propagate or 15863 modify it is void, and will automatically terminate your rights 15864 under this License (including any patent licenses granted under the 15865 third paragraph of section 11). 15866 15867 However, if you cease all violation of this License, then your 15868 license from a particular copyright holder is reinstated (a) 15869 provisionally, unless and until the copyright holder explicitly and 15870 finally terminates your license, and (b) permanently, if the 15871 copyright holder fails to notify you of the violation by some 15872 reasonable means prior to 60 days after the cessation. 15873 15874 Moreover, your license from a particular copyright holder is 15875 reinstated permanently if the copyright holder notifies you of the 15876 violation by some reasonable means, this is the first time you have 15877 received notice of violation of this License (for any work) from 15878 that copyright holder, and you cure the violation prior to 30 days 15879 after your receipt of the notice. 15880 15881 Termination of your rights under this section does not terminate 15882 the licenses of parties who have received copies or rights from you 15883 under this License. If your rights have been terminated and not 15884 permanently reinstated, you do not qualify to receive new licenses 15885 for the same material under section 10. 15886 15887 9. Acceptance Not Required for Having Copies. 15888 15889 You are not required to accept this License in order to receive or 15890 run a copy of the Program. Ancillary propagation of a covered work 15891 occurring solely as a consequence of using peer-to-peer 15892 transmission to receive a copy likewise does not require 15893 acceptance. However, nothing other than this License grants you 15894 permission to propagate or modify any covered work. These actions 15895 infringe copyright if you do not accept this License. Therefore, 15896 by modifying or propagating a covered work, you indicate your 15897 acceptance of this License to do so. 15898 15899 10. Automatic Licensing of Downstream Recipients. 15900 15901 Each time you convey a covered work, the recipient automatically 15902 receives a license from the original licensors, to run, modify and 15903 propagate that work, subject to this License. You are not 15904 responsible for enforcing compliance by third parties with this 15905 License. 15906 15907 An "entity transaction" is a transaction transferring control of an 15908 organization, or substantially all assets of one, or subdividing an 15909 organization, or merging organizations. If propagation of a 15910 covered work results from an entity transaction, each party to that 15911 transaction who receives a copy of the work also receives whatever 15912 licenses to the work the party's predecessor in interest had or 15913 could give under the previous paragraph, plus a right to possession 15914 of the Corresponding Source of the work from the predecessor in 15915 interest, if the predecessor has it or can get it with reasonable 15916 efforts. 15917 15918 You may not impose any further restrictions on the exercise of the 15919 rights granted or affirmed under this License. For example, you 15920 may not impose a license fee, royalty, or other charge for exercise 15921 of rights granted under this License, and you may not initiate 15922 litigation (including a cross-claim or counterclaim in a lawsuit) 15923 alleging that any patent claim is infringed by making, using, 15924 selling, offering for sale, or importing the Program or any portion 15925 of it. 15926 15927 11. Patents. 15928 15929 A "contributor" is a copyright holder who authorizes use under this 15930 License of the Program or a work on which the Program is based. 15931 The work thus licensed is called the contributor's "contributor 15932 version". 15933 15934 A contributor's "essential patent claims" are all patent claims 15935 owned or controlled by the contributor, whether already acquired or 15936 hereafter acquired, that would be infringed by some manner, 15937 permitted by this License, of making, using, or selling its 15938 contributor version, but do not include claims that would be 15939 infringed only as a consequence of further modification of the 15940 contributor version. For purposes of this definition, "control" 15941 includes the right to grant patent sublicenses in a manner 15942 consistent with the requirements of this License. 15943 15944 Each contributor grants you a non-exclusive, worldwide, 15945 royalty-free patent license under the contributor's essential 15946 patent claims, to make, use, sell, offer for sale, import and 15947 otherwise run, modify and propagate the contents of its contributor 15948 version. 15949 15950 In the following three paragraphs, a "patent license" is any 15951 express agreement or commitment, however denominated, not to 15952 enforce a patent (such as an express permission to practice a 15953 patent or covenant not to sue for patent infringement). To "grant" 15954 such a patent license to a party means to make such an agreement or 15955 commitment not to enforce a patent against the party. 15956 15957 If you convey a covered work, knowingly relying on a patent 15958 license, and the Corresponding Source of the work is not available 15959 for anyone to copy, free of charge and under the terms of this 15960 License, through a publicly available network server or other 15961 readily accessible means, then you must either (1) cause the 15962 Corresponding Source to be so available, or (2) arrange to deprive 15963 yourself of the benefit of the patent license for this particular 15964 work, or (3) arrange, in a manner consistent with the requirements 15965 of this License, to extend the patent license to downstream 15966 recipients. "Knowingly relying" means you have actual knowledge 15967 that, but for the patent license, your conveying the covered work 15968 in a country, or your recipient's use of the covered work in a 15969 country, would infringe one or more identifiable patents in that 15970 country that you have reason to believe are valid. 15971 15972 If, pursuant to or in connection with a single transaction or 15973 arrangement, you convey, or propagate by procuring conveyance of, a 15974 covered work, and grant a patent license to some of the parties 15975 receiving the covered work authorizing them to use, propagate, 15976 modify or convey a specific copy of the covered work, then the 15977 patent license you grant is automatically extended to all 15978 recipients of the covered work and works based on it. 15979 15980 A patent license is "discriminatory" if it does not include within 15981 the scope of its coverage, prohibits the exercise of, or is 15982 conditioned on the non-exercise of one or more of the rights that 15983 are specifically granted under this License. You may not convey a 15984 covered work if you are a party to an arrangement with a third 15985 party that is in the business of distributing software, under which 15986 you make payment to the third party based on the extent of your 15987 activity of conveying the work, and under which the third party 15988 grants, to any of the parties who would receive the covered work 15989 from you, a discriminatory patent license (a) in connection with 15990 copies of the covered work conveyed by you (or copies made from 15991 those copies), or (b) primarily for and in connection with specific 15992 products or compilations that contain the covered work, unless you 15993 entered into that arrangement, or that patent license was granted, 15994 prior to 28 March 2007. 15995 15996 Nothing in this License shall be construed as excluding or limiting 15997 any implied license or other defenses to infringement that may 15998 otherwise be available to you under applicable patent law. 15999 16000 12. No Surrender of Others' Freedom. 16001 16002 If conditions are imposed on you (whether by court order, agreement 16003 or otherwise) that contradict the conditions of this License, they 16004 do not excuse you from the conditions of this License. If you 16005 cannot convey a covered work so as to satisfy simultaneously your 16006 obligations under this License and any other pertinent obligations, 16007 then as a consequence you may not convey it at all. For example, 16008 if you agree to terms that obligate you to collect a royalty for 16009 further conveying from those to whom you convey the Program, the 16010 only way you could satisfy both those terms and this License would 16011 be to refrain entirely from conveying the Program. 16012 16013 13. Use with the GNU Affero General Public License. 16014 16015 Notwithstanding any other provision of this License, you have 16016 permission to link or combine any covered work with a work licensed 16017 under version 3 of the GNU Affero General Public License into a 16018 single combined work, and to convey the resulting work. The terms 16019 of this License will continue to apply to the part which is the 16020 covered work, but the special requirements of the GNU Affero 16021 General Public License, section 13, concerning interaction through 16022 a network will apply to the combination as such. 16023 16024 14. Revised Versions of this License. 16025 16026 The Free Software Foundation may publish revised and/or new 16027 versions of the GNU General Public License from time to time. Such 16028 new versions will be similar in spirit to the present version, but 16029 may differ in detail to address new problems or concerns. 16030 16031 Each version is given a distinguishing version number. If the 16032 Program specifies that a certain numbered version of the GNU 16033 General Public License "or any later version" applies to it, you 16034 have the option of following the terms and conditions either of 16035 that numbered version or of any later version published by the Free 16036 Software Foundation. If the Program does not specify a version 16037 number of the GNU General Public License, you may choose any 16038 version ever published by the Free Software Foundation. 16039 16040 If the Program specifies that a proxy can decide which future 16041 versions of the GNU General Public License can be used, that 16042 proxy's public statement of acceptance of a version permanently 16043 authorizes you to choose that version for the Program. 16044 16045 Later license versions may give you additional or different 16046 permissions. However, no additional obligations are imposed on any 16047 author or copyright holder as a result of your choosing to follow a 16048 later version. 16049 16050 15. Disclaimer of Warranty. 16051 16052 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 16053 APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE 16054 COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" 16055 WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 16056 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16057 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE 16058 RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. 16059 SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL 16060 NECESSARY SERVICING, REPAIR OR CORRECTION. 16061 16062 16. Limitation of Liability. 16063 16064 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 16065 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES 16066 AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR 16067 DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 16068 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE 16069 THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA 16070 BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 16071 PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 16072 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF 16073 THE POSSIBILITY OF SUCH DAMAGES. 16074 16075 17. Interpretation of Sections 15 and 16. 16076 16077 If the disclaimer of warranty and limitation of liability provided 16078 above cannot be given local legal effect according to their terms, 16079 reviewing courts shall apply local law that most closely 16080 approximates an absolute waiver of all civil liability in 16081 connection with the Program, unless a warranty or assumption of 16082 liability accompanies a copy of the Program in return for a fee. 16083 16084END OF TERMS AND CONDITIONS 16085=========================== 16086 16087How to Apply These Terms to Your New Programs 16088============================================= 16089 16090If you develop a new program, and you want it to be of the greatest 16091possible use to the public, the best way to achieve this is to make it 16092free software which everyone can redistribute and change under these 16093terms. 16094 16095 To do so, attach the following notices to the program. It is safest 16096to attach them to the start of each source file to most effectively 16097state the exclusion of warranty; and each file should have at least the 16098"copyright" line and a pointer to where the full notice is found. 16099 16100 ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. 16101 Copyright (C) YEAR NAME OF AUTHOR 16102 16103 This program is free software: you can redistribute it and/or modify 16104 it under the terms of the GNU General Public License as published by 16105 the Free Software Foundation, either version 3 of the License, or (at 16106 your option) any later version. 16107 16108 This program is distributed in the hope that it will be useful, but 16109 WITHOUT ANY WARRANTY; without even the implied warranty of 16110 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16111 General Public License for more details. 16112 16113 You should have received a copy of the GNU General Public License 16114 along with this program. If not, see <http://www.gnu.org/licenses/>. 16115 16116 Also add information on how to contact you by electronic and paper 16117mail. 16118 16119 If the program does terminal interaction, make it output a short 16120notice like this when it starts in an interactive mode: 16121 16122 PROGRAM Copyright (C) YEAR NAME OF AUTHOR 16123 This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. 16124 This is free software, and you are welcome to redistribute it 16125 under certain conditions; type 'show c' for details. 16126 16127 The hypothetical commands 'show w' and 'show c' should show the 16128appropriate parts of the General Public License. Of course, your 16129program's commands might be different; for a GUI interface, you would 16130use an "about box". 16131 16132 You should also get your employer (if you work as a programmer) or 16133school, if any, to sign a "copyright disclaimer" for the program, if 16134necessary. For more information on this, and how to apply and follow 16135the GNU GPL, see <http://www.gnu.org/licenses/>. 16136 16137 The GNU General Public License does not permit incorporating your 16138program into proprietary programs. If your program is a subroutine 16139library, you may consider it more useful to permit linking proprietary 16140applications with the library. If this is what you want to do, use the 16141GNU Lesser General Public License instead of this License. But first, 16142please read <http://www.gnu.org/philosophy/why-not-lgpl.html>. 16143 16144 16145File: gfortran.info, Node: GNU Free Documentation License, Next: Funding, Prev: Copying, Up: Top 16146 16147GNU Free Documentation License 16148****************************** 16149 16150 Version 1.3, 3 November 2008 16151 16152 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. 16153 <http://fsf.org/> 16154 16155 Everyone is permitted to copy and distribute verbatim copies 16156 of this license document, but changing it is not allowed. 16157 16158 0. PREAMBLE 16159 16160 The purpose of this License is to make a manual, textbook, or other 16161 functional and useful document "free" in the sense of freedom: to 16162 assure everyone the effective freedom to copy and redistribute it, 16163 with or without modifying it, either commercially or 16164 noncommercially. Secondarily, this License preserves for the 16165 author and publisher a way to get credit for their work, while not 16166 being considered responsible for modifications made by others. 16167 16168 This License is a kind of "copyleft", which means that derivative 16169 works of the document must themselves be free in the same sense. 16170 It complements the GNU General Public License, which is a copyleft 16171 license designed for free software. 16172 16173 We have designed this License in order to use it for manuals for 16174 free software, because free software needs free documentation: a 16175 free program should come with manuals providing the same freedoms 16176 that the software does. But this License is not limited to 16177 software manuals; it can be used for any textual work, regardless 16178 of subject matter or whether it is published as a printed book. We 16179 recommend this License principally for works whose purpose is 16180 instruction or reference. 16181 16182 1. APPLICABILITY AND DEFINITIONS 16183 16184 This License applies to any manual or other work, in any medium, 16185 that contains a notice placed by the copyright holder saying it can 16186 be distributed under the terms of this License. Such a notice 16187 grants a world-wide, royalty-free license, unlimited in duration, 16188 to use that work under the conditions stated herein. The 16189 "Document", below, refers to any such manual or work. Any member 16190 of the public is a licensee, and is addressed as "you". You accept 16191 the license if you copy, modify or distribute the work in a way 16192 requiring permission under copyright law. 16193 16194 A "Modified Version" of the Document means any work containing the 16195 Document or a portion of it, either copied verbatim, or with 16196 modifications and/or translated into another language. 16197 16198 A "Secondary Section" is a named appendix or a front-matter section 16199 of the Document that deals exclusively with the relationship of the 16200 publishers or authors of the Document to the Document's overall 16201 subject (or to related matters) and contains nothing that could 16202 fall directly within that overall subject. (Thus, if the Document 16203 is in part a textbook of mathematics, a Secondary Section may not 16204 explain any mathematics.) The relationship could be a matter of 16205 historical connection with the subject or with related matters, or 16206 of legal, commercial, philosophical, ethical or political position 16207 regarding them. 16208 16209 The "Invariant Sections" are certain Secondary Sections whose 16210 titles are designated, as being those of Invariant Sections, in the 16211 notice that says that the Document is released under this License. 16212 If a section does not fit the above definition of Secondary then it 16213 is not allowed to be designated as Invariant. The Document may 16214 contain zero Invariant Sections. If the Document does not identify 16215 any Invariant Sections then there are none. 16216 16217 The "Cover Texts" are certain short passages of text that are 16218 listed, as Front-Cover Texts or Back-Cover Texts, in the notice 16219 that says that the Document is released under this License. A 16220 Front-Cover Text may be at most 5 words, and a Back-Cover Text may 16221 be at most 25 words. 16222 16223 A "Transparent" copy of the Document means a machine-readable copy, 16224 represented in a format whose specification is available to the 16225 general public, that is suitable for revising the document 16226 straightforwardly with generic text editors or (for images composed 16227 of pixels) generic paint programs or (for drawings) some widely 16228 available drawing editor, and that is suitable for input to text 16229 formatters or for automatic translation to a variety of formats 16230 suitable for input to text formatters. A copy made in an otherwise 16231 Transparent file format whose markup, or absence of markup, has 16232 been arranged to thwart or discourage subsequent modification by 16233 readers is not Transparent. An image format is not Transparent if 16234 used for any substantial amount of text. A copy that is not 16235 "Transparent" is called "Opaque". 16236 16237 Examples of suitable formats for Transparent copies include plain 16238 ASCII without markup, Texinfo input format, LaTeX input format, 16239 SGML or XML using a publicly available DTD, and standard-conforming 16240 simple HTML, PostScript or PDF designed for human modification. 16241 Examples of transparent image formats include PNG, XCF and JPG. 16242 Opaque formats include proprietary formats that can be read and 16243 edited only by proprietary word processors, SGML or XML for which 16244 the DTD and/or processing tools are not generally available, and 16245 the machine-generated HTML, PostScript or PDF produced by some word 16246 processors for output purposes only. 16247 16248 The "Title Page" means, for a printed book, the title page itself, 16249 plus such following pages as are needed to hold, legibly, the 16250 material this License requires to appear in the title page. For 16251 works in formats which do not have any title page as such, "Title 16252 Page" means the text near the most prominent appearance of the 16253 work's title, preceding the beginning of the body of the text. 16254 16255 The "publisher" means any person or entity that distributes copies 16256 of the Document to the public. 16257 16258 A section "Entitled XYZ" means a named subunit of the Document 16259 whose title either is precisely XYZ or contains XYZ in parentheses 16260 following text that translates XYZ in another language. (Here XYZ 16261 stands for a specific section name mentioned below, such as 16262 "Acknowledgements", "Dedications", "Endorsements", or "History".) 16263 To "Preserve the Title" of such a section when you modify the 16264 Document means that it remains a section "Entitled XYZ" according 16265 to this definition. 16266 16267 The Document may include Warranty Disclaimers next to the notice 16268 which states that this License applies to the Document. These 16269 Warranty Disclaimers are considered to be included by reference in 16270 this License, but only as regards disclaiming warranties: any other 16271 implication that these Warranty Disclaimers may have is void and 16272 has no effect on the meaning of this License. 16273 16274 2. VERBATIM COPYING 16275 16276 You may copy and distribute the Document in any medium, either 16277 commercially or noncommercially, provided that this License, the 16278 copyright notices, and the license notice saying this License 16279 applies to the Document are reproduced in all copies, and that you 16280 add no other conditions whatsoever to those of this License. You 16281 may not use technical measures to obstruct or control the reading 16282 or further copying of the copies you make or distribute. However, 16283 you may accept compensation in exchange for copies. If you 16284 distribute a large enough number of copies you must also follow the 16285 conditions in section 3. 16286 16287 You may also lend copies, under the same conditions stated above, 16288 and you may publicly display copies. 16289 16290 3. COPYING IN QUANTITY 16291 16292 If you publish printed copies (or copies in media that commonly 16293 have printed covers) of the Document, numbering more than 100, and 16294 the Document's license notice requires Cover Texts, you must 16295 enclose the copies in covers that carry, clearly and legibly, all 16296 these Cover Texts: Front-Cover Texts on the front cover, and 16297 Back-Cover Texts on the back cover. Both covers must also clearly 16298 and legibly identify you as the publisher of these copies. The 16299 front cover must present the full title with all words of the title 16300 equally prominent and visible. You may add other material on the 16301 covers in addition. Copying with changes limited to the covers, as 16302 long as they preserve the title of the Document and satisfy these 16303 conditions, can be treated as verbatim copying in other respects. 16304 16305 If the required texts for either cover are too voluminous to fit 16306 legibly, you should put the first ones listed (as many as fit 16307 reasonably) on the actual cover, and continue the rest onto 16308 adjacent pages. 16309 16310 If you publish or distribute Opaque copies of the Document 16311 numbering more than 100, you must either include a machine-readable 16312 Transparent copy along with each Opaque copy, or state in or with 16313 each Opaque copy a computer-network location from which the general 16314 network-using public has access to download using public-standard 16315 network protocols a complete Transparent copy of the Document, free 16316 of added material. If you use the latter option, you must take 16317 reasonably prudent steps, when you begin distribution of Opaque 16318 copies in quantity, to ensure that this Transparent copy will 16319 remain thus accessible at the stated location until at least one 16320 year after the last time you distribute an Opaque copy (directly or 16321 through your agents or retailers) of that edition to the public. 16322 16323 It is requested, but not required, that you contact the authors of 16324 the Document well before redistributing any large number of copies, 16325 to give them a chance to provide you with an updated version of the 16326 Document. 16327 16328 4. MODIFICATIONS 16329 16330 You may copy and distribute a Modified Version of the Document 16331 under the conditions of sections 2 and 3 above, provided that you 16332 release the Modified Version under precisely this License, with the 16333 Modified Version filling the role of the Document, thus licensing 16334 distribution and modification of the Modified Version to whoever 16335 possesses a copy of it. In addition, you must do these things in 16336 the Modified Version: 16337 16338 A. Use in the Title Page (and on the covers, if any) a title 16339 distinct from that of the Document, and from those of previous 16340 versions (which should, if there were any, be listed in the 16341 History section of the Document). You may use the same title 16342 as a previous version if the original publisher of that 16343 version gives permission. 16344 16345 B. List on the Title Page, as authors, one or more persons or 16346 entities responsible for authorship of the modifications in 16347 the Modified Version, together with at least five of the 16348 principal authors of the Document (all of its principal 16349 authors, if it has fewer than five), unless they release you 16350 from this requirement. 16351 16352 C. State on the Title page the name of the publisher of the 16353 Modified Version, as the publisher. 16354 16355 D. Preserve all the copyright notices of the Document. 16356 16357 E. Add an appropriate copyright notice for your modifications 16358 adjacent to the other copyright notices. 16359 16360 F. Include, immediately after the copyright notices, a license 16361 notice giving the public permission to use the Modified 16362 Version under the terms of this License, in the form shown in 16363 the Addendum below. 16364 16365 G. Preserve in that license notice the full lists of Invariant 16366 Sections and required Cover Texts given in the Document's 16367 license notice. 16368 16369 H. Include an unaltered copy of this License. 16370 16371 I. Preserve the section Entitled "History", Preserve its Title, 16372 and add to it an item stating at least the title, year, new 16373 authors, and publisher of the Modified Version as given on the 16374 Title Page. If there is no section Entitled "History" in the 16375 Document, create one stating the title, year, authors, and 16376 publisher of the Document as given on its Title Page, then add 16377 an item describing the Modified Version as stated in the 16378 previous sentence. 16379 16380 J. Preserve the network location, if any, given in the Document 16381 for public access to a Transparent copy of the Document, and 16382 likewise the network locations given in the Document for 16383 previous versions it was based on. These may be placed in the 16384 "History" section. You may omit a network location for a work 16385 that was published at least four years before the Document 16386 itself, or if the original publisher of the version it refers 16387 to gives permission. 16388 16389 K. For any section Entitled "Acknowledgements" or "Dedications", 16390 Preserve the Title of the section, and preserve in the section 16391 all the substance and tone of each of the contributor 16392 acknowledgements and/or dedications given therein. 16393 16394 L. Preserve all the Invariant Sections of the Document, unaltered 16395 in their text and in their titles. Section numbers or the 16396 equivalent are not considered part of the section titles. 16397 16398 M. Delete any section Entitled "Endorsements". Such a section 16399 may not be included in the Modified Version. 16400 16401 N. Do not retitle any existing section to be Entitled 16402 "Endorsements" or to conflict in title with any Invariant 16403 Section. 16404 16405 O. Preserve any Warranty Disclaimers. 16406 16407 If the Modified Version includes new front-matter sections or 16408 appendices that qualify as Secondary Sections and contain no 16409 material copied from the Document, you may at your option designate 16410 some or all of these sections as invariant. To do this, add their 16411 titles to the list of Invariant Sections in the Modified Version's 16412 license notice. These titles must be distinct from any other 16413 section titles. 16414 16415 You may add a section Entitled "Endorsements", provided it contains 16416 nothing but endorsements of your Modified Version by various 16417 parties--for example, statements of peer review or that the text 16418 has been approved by an organization as the authoritative 16419 definition of a standard. 16420 16421 You may add a passage of up to five words as a Front-Cover Text, 16422 and a passage of up to 25 words as a Back-Cover Text, to the end of 16423 the list of Cover Texts in the Modified Version. Only one passage 16424 of Front-Cover Text and one of Back-Cover Text may be added by (or 16425 through arrangements made by) any one entity. If the Document 16426 already includes a cover text for the same cover, previously added 16427 by you or by arrangement made by the same entity you are acting on 16428 behalf of, you may not add another; but you may replace the old 16429 one, on explicit permission from the previous publisher that added 16430 the old one. 16431 16432 The author(s) and publisher(s) of the Document do not by this 16433 License give permission to use their names for publicity for or to 16434 assert or imply endorsement of any Modified Version. 16435 16436 5. COMBINING DOCUMENTS 16437 16438 You may combine the Document with other documents released under 16439 this License, under the terms defined in section 4 above for 16440 modified versions, provided that you include in the combination all 16441 of the Invariant Sections of all of the original documents, 16442 unmodified, and list them all as Invariant Sections of your 16443 combined work in its license notice, and that you preserve all 16444 their Warranty Disclaimers. 16445 16446 The combined work need only contain one copy of this License, and 16447 multiple identical Invariant Sections may be replaced with a single 16448 copy. If there are multiple Invariant Sections with the same name 16449 but different contents, make the title of each such section unique 16450 by adding at the end of it, in parentheses, the name of the 16451 original author or publisher of that section if known, or else a 16452 unique number. Make the same adjustment to the section titles in 16453 the list of Invariant Sections in the license notice of the 16454 combined work. 16455 16456 In the combination, you must combine any sections Entitled 16457 "History" in the various original documents, forming one section 16458 Entitled "History"; likewise combine any sections Entitled 16459 "Acknowledgements", and any sections Entitled "Dedications". You 16460 must delete all sections Entitled "Endorsements." 16461 16462 6. COLLECTIONS OF DOCUMENTS 16463 16464 You may make a collection consisting of the Document and other 16465 documents released under this License, and replace the individual 16466 copies of this License in the various documents with a single copy 16467 that is included in the collection, provided that you follow the 16468 rules of this License for verbatim copying of each of the documents 16469 in all other respects. 16470 16471 You may extract a single document from such a collection, and 16472 distribute it individually under this License, provided you insert 16473 a copy of this License into the extracted document, and follow this 16474 License in all other respects regarding verbatim copying of that 16475 document. 16476 16477 7. AGGREGATION WITH INDEPENDENT WORKS 16478 16479 A compilation of the Document or its derivatives with other 16480 separate and independent documents or works, in or on a volume of a 16481 storage or distribution medium, is called an "aggregate" if the 16482 copyright resulting from the compilation is not used to limit the 16483 legal rights of the compilation's users beyond what the individual 16484 works permit. When the Document is included in an aggregate, this 16485 License does not apply to the other works in the aggregate which 16486 are not themselves derivative works of the Document. 16487 16488 If the Cover Text requirement of section 3 is applicable to these 16489 copies of the Document, then if the Document is less than one half 16490 of the entire aggregate, the Document's Cover Texts may be placed 16491 on covers that bracket the Document within the aggregate, or the 16492 electronic equivalent of covers if the Document is in electronic 16493 form. Otherwise they must appear on printed covers that bracket 16494 the whole aggregate. 16495 16496 8. TRANSLATION 16497 16498 Translation is considered a kind of modification, so you may 16499 distribute translations of the Document under the terms of section 16500 4. Replacing Invariant Sections with translations requires special 16501 permission from their copyright holders, but you may include 16502 translations of some or all Invariant Sections in addition to the 16503 original versions of these Invariant Sections. You may include a 16504 translation of this License, and all the license notices in the 16505 Document, and any Warranty Disclaimers, provided that you also 16506 include the original English version of this License and the 16507 original versions of those notices and disclaimers. In case of a 16508 disagreement between the translation and the original version of 16509 this License or a notice or disclaimer, the original version will 16510 prevail. 16511 16512 If a section in the Document is Entitled "Acknowledgements", 16513 "Dedications", or "History", the requirement (section 4) to 16514 Preserve its Title (section 1) will typically require changing the 16515 actual title. 16516 16517 9. TERMINATION 16518 16519 You may not copy, modify, sublicense, or distribute the Document 16520 except as expressly provided under this License. Any attempt 16521 otherwise to copy, modify, sublicense, or distribute it is void, 16522 and will automatically terminate your rights under this License. 16523 16524 However, if you cease all violation of this License, then your 16525 license from a particular copyright holder is reinstated (a) 16526 provisionally, unless and until the copyright holder explicitly and 16527 finally terminates your license, and (b) permanently, if the 16528 copyright holder fails to notify you of the violation by some 16529 reasonable means prior to 60 days after the cessation. 16530 16531 Moreover, your license from a particular copyright holder is 16532 reinstated permanently if the copyright holder notifies you of the 16533 violation by some reasonable means, this is the first time you have 16534 received notice of violation of this License (for any work) from 16535 that copyright holder, and you cure the violation prior to 30 days 16536 after your receipt of the notice. 16537 16538 Termination of your rights under this section does not terminate 16539 the licenses of parties who have received copies or rights from you 16540 under this License. If your rights have been terminated and not 16541 permanently reinstated, receipt of a copy of some or all of the 16542 same material does not give you any rights to use it. 16543 16544 10. FUTURE REVISIONS OF THIS LICENSE 16545 16546 The Free Software Foundation may publish new, revised versions of 16547 the GNU Free Documentation License from time to time. Such new 16548 versions will be similar in spirit to the present version, but may 16549 differ in detail to address new problems or concerns. See 16550 <http://www.gnu.org/copyleft/>. 16551 16552 Each version of the License is given a distinguishing version 16553 number. If the Document specifies that a particular numbered 16554 version of this License "or any later version" applies to it, you 16555 have the option of following the terms and conditions either of 16556 that specified version or of any later version that has been 16557 published (not as a draft) by the Free Software Foundation. If the 16558 Document does not specify a version number of this License, you may 16559 choose any version ever published (not as a draft) by the Free 16560 Software Foundation. If the Document specifies that a proxy can 16561 decide which future versions of this License can be used, that 16562 proxy's public statement of acceptance of a version permanently 16563 authorizes you to choose that version for the Document. 16564 16565 11. RELICENSING 16566 16567 "Massive Multiauthor Collaboration Site" (or "MMC Site") means any 16568 World Wide Web server that publishes copyrightable works and also 16569 provides prominent facilities for anybody to edit those works. A 16570 public wiki that anybody can edit is an example of such a server. 16571 A "Massive Multiauthor Collaboration" (or "MMC") contained in the 16572 site means any set of copyrightable works thus published on the MMC 16573 site. 16574 16575 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 16576 license published by Creative Commons Corporation, a not-for-profit 16577 corporation with a principal place of business in San Francisco, 16578 California, as well as future copyleft versions of that license 16579 published by that same organization. 16580 16581 "Incorporate" means to publish or republish a Document, in whole or 16582 in part, as part of another Document. 16583 16584 An MMC is "eligible for relicensing" if it is licensed under this 16585 License, and if all works that were first published under this 16586 License somewhere other than this MMC, and subsequently 16587 incorporated in whole or in part into the MMC, (1) had no cover 16588 texts or invariant sections, and (2) were thus incorporated prior 16589 to November 1, 2008. 16590 16591 The operator of an MMC Site may republish an MMC contained in the 16592 site under CC-BY-SA on the same site at any time before August 1, 16593 2009, provided the MMC is eligible for relicensing. 16594 16595ADDENDUM: How to use this License for your documents 16596==================================================== 16597 16598To use this License in a document you have written, include a copy of 16599the License in the document and put the following copyright and license 16600notices just after the title page: 16601 16602 Copyright (C) YEAR YOUR NAME. 16603 Permission is granted to copy, distribute and/or modify this document 16604 under the terms of the GNU Free Documentation License, Version 1.3 16605 or any later version published by the Free Software Foundation; 16606 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover 16607 Texts. A copy of the license is included in the section entitled ``GNU 16608 Free Documentation License''. 16609 16610 If you have Invariant Sections, Front-Cover Texts and Back-Cover 16611Texts, replace the "with...Texts." line with this: 16612 16613 with the Invariant Sections being LIST THEIR TITLES, with 16614 the Front-Cover Texts being LIST, and with the Back-Cover Texts 16615 being LIST. 16616 16617 If you have Invariant Sections without Cover Texts, or some other 16618combination of the three, merge those two alternatives to suit the 16619situation. 16620 16621 If your document contains nontrivial examples of program code, we 16622recommend releasing these examples in parallel under your choice of free 16623software license, such as the GNU General Public License, to permit 16624their use in free software. 16625 16626 16627File: gfortran.info, Node: Funding, Next: Option Index, Prev: GNU Free Documentation License, Up: Top 16628 16629Funding Free Software 16630********************* 16631 16632If you want to have more free software a few years from now, it makes 16633sense for you to help encourage people to contribute funds for its 16634development. The most effective approach known is to encourage 16635commercial redistributors to donate. 16636 16637 Users of free software systems can boost the pace of development by 16638encouraging for-a-fee distributors to donate part of their selling price 16639to free software developers--the Free Software Foundation, and others. 16640 16641 The way to convince distributors to do this is to demand it and 16642expect it from them. So when you compare distributors, judge them 16643partly by how much they give to free software development. Show 16644distributors they must compete to be the one who gives the most. 16645 16646 To make this approach work, you must insist on numbers that you can 16647compare, such as, "We will donate ten dollars to the Frobnitz project 16648for each disk sold." Don't be satisfied with a vague promise, such as 16649"A portion of the profits are donated," since it doesn't give a basis 16650for comparison. 16651 16652 Even a precise fraction "of the profits from this disk" is not very 16653meaningful, since creative accounting and unrelated business decisions 16654can greatly alter what fraction of the sales price counts as profit. If 16655the price you pay is $50, ten percent of the profit is probably less 16656than a dollar; it might be a few cents, or nothing at all. 16657 16658 Some redistributors do development work themselves. This is useful 16659too; but to keep everyone honest, you need to inquire how much they do, 16660and what kind. Some kinds of development make much more long-term 16661difference than others. For example, maintaining a separate version of 16662a program contributes very little; maintaining the standard version of a 16663program for the whole community contributes much. Easy new ports 16664contribute little, since someone else would surely do them; difficult 16665ports such as adding a new CPU to the GNU Compiler Collection contribute 16666more; major new features or packages contribute the most. 16667 16668 By establishing the idea that supporting further development is "the 16669proper thing to do" when distributing free software for a fee, we can 16670assure a steady flow of resources into making more free software. 16671 16672 Copyright (C) 1994 Free Software Foundation, Inc. 16673 Verbatim copying and redistribution of this section is permitted 16674 without royalty; alteration is not permitted. 16675 16676 16677File: gfortran.info, Node: Option Index, Next: Keyword Index, Prev: Funding, Up: Top 16678 16679Option Index 16680************ 16681 16682'gfortran''s command line options are indexed here without any initial 16683'-' or '--'. Where an option has both positive and negative forms (such 16684as -foption and -fno-option), relevant entries in the manual are indexed 16685under the most appropriate form; it may sometimes be useful to look up 16686both forms. 16687 16688[index] 16689* Menu: 16690 16691* 'A-PREDICATE=ANSWER': Preprocessing Options. 16692 (line 119) 16693* 'APREDICATE=ANSWER': Preprocessing Options. 16694 (line 113) 16695* 'backslash': Fortran Dialect Options. 16696 (line 40) 16697* 'C': Preprocessing Options. 16698 (line 122) 16699* 'CC': Preprocessing Options. 16700 (line 137) 16701* 'cpp': Preprocessing Options. 16702 (line 12) 16703* 'dD': Preprocessing Options. 16704 (line 35) 16705* 'dI': Preprocessing Options. 16706 (line 51) 16707* 'dM': Preprocessing Options. 16708 (line 26) 16709* 'dN': Preprocessing Options. 16710 (line 41) 16711* 'DNAME': Preprocessing Options. 16712 (line 151) 16713* 'DNAME=DEFINITION': Preprocessing Options. 16714 (line 154) 16715* 'dU': Preprocessing Options. 16716 (line 44) 16717* 'faggressive-function-elimination': Code Gen Options. (line 340) 16718* 'falign-commons': Code Gen Options. (line 313) 16719* 'fall-intrinsics': Fortran Dialect Options. 16720 (line 17) 16721* 'fblas-matmul-limit': Code Gen Options. (line 268) 16722* 'fbounds-check': Code Gen Options. (line 192) 16723* 'fcheck': Code Gen Options. (line 142) 16724* 'fcheck-array-temporaries': Code Gen Options. (line 195) 16725* 'fcoarray': Code Gen Options. (line 128) 16726* 'fconvert='CONVERSION: Runtime Options. (line 10) 16727* 'fcray-pointer': Fortran Dialect Options. 16728 (line 86) 16729* 'fd-lines-as-code': Fortran Dialect Options. 16730 (line 27) 16731* 'fd-lines-as-comments': Fortran Dialect Options. 16732 (line 27) 16733* 'fdefault-double-8': Fortran Dialect Options. 16734 (line 124) 16735* 'fdefault-integer-8': Fortran Dialect Options. 16736 (line 110) 16737* 'fdefault-real-8': Fortran Dialect Options. 16738 (line 116) 16739* 'fdollar-ok': Fortran Dialect Options. 16740 (line 34) 16741* 'fdump-fortran-optimized': Debugging Options. (line 15) 16742* 'fdump-fortran-original': Debugging Options. (line 10) 16743* 'fdump-parse-tree': Debugging Options. (line 19) 16744* 'fexternal-blas': Code Gen Options. (line 260) 16745* ff2c: Code Gen Options. (line 25) 16746* 'ffixed-line-length-'N: Fortran Dialect Options. 16747 (line 57) 16748* 'ffpe-summary='LIST: Debugging Options. (line 51) 16749* 'ffpe-trap='LIST: Debugging Options. (line 25) 16750* 'ffree-form': Fortran Dialect Options. 16751 (line 11) 16752* 'ffree-line-length-'N: Fortran Dialect Options. 16753 (line 70) 16754* 'fimplicit-none': Fortran Dialect Options. 16755 (line 81) 16756* 'finit-character': Code Gen Options. (line 288) 16757* 'finit-integer': Code Gen Options. (line 288) 16758* 'finit-local-zero': Code Gen Options. (line 288) 16759* 'finit-logical': Code Gen Options. (line 288) 16760* 'finit-real': Code Gen Options. (line 288) 16761* 'finteger-4-integer-8': Fortran Dialect Options. 16762 (line 133) 16763* 'fintrinsic-modules-path' DIR: Directory Options. (line 36) 16764* 'fmax-array-constructor': Code Gen Options. (line 198) 16765* 'fmax-errors='N: Error and Warning Options. 16766 (line 27) 16767* 'fmax-identifier-length='N: Fortran Dialect Options. 16768 (line 77) 16769* 'fmax-stack-var-size': Code Gen Options. (line 216) 16770* 'fmax-subrecord-length='LENGTH: Runtime Options. (line 29) 16771* 'fmodule-private': Fortran Dialect Options. 16772 (line 52) 16773* 'fno-automatic': Code Gen Options. (line 15) 16774* 'fno-backtrace': Debugging Options. (line 61) 16775* 'fno-fixed-form': Fortran Dialect Options. 16776 (line 11) 16777* 'fno-protect-parens': Code Gen Options. (line 325) 16778* 'fno-underscoring': Code Gen Options. (line 54) 16779* 'fopenmp': Fortran Dialect Options. 16780 (line 90) 16781* 'fpack-derived': Code Gen Options. (line 238) 16782* 'fpp': Preprocessing Options. 16783 (line 12) 16784* 'frange-check': Fortran Dialect Options. 16785 (line 98) 16786* 'freal-4-real-10': Fortran Dialect Options. 16787 (line 148) 16788* 'freal-4-real-16': Fortran Dialect Options. 16789 (line 148) 16790* 'freal-4-real-8': Fortran Dialect Options. 16791 (line 148) 16792* 'freal-8-real-10': Fortran Dialect Options. 16793 (line 148) 16794* 'freal-8-real-16': Fortran Dialect Options. 16795 (line 148) 16796* 'freal-8-real-4': Fortran Dialect Options. 16797 (line 148) 16798* 'frealloc-lhs': Code Gen Options. (line 334) 16799* 'frecord-marker='LENGTH: Runtime Options. (line 21) 16800* 'frecursive': Code Gen Options. (line 279) 16801* 'frepack-arrays': Code Gen Options. (line 244) 16802* 'frontend-optimize': Code Gen Options. (line 348) 16803* 'fsecond-underscore': Code Gen Options. (line 111) 16804* 'fshort-enums': Code Gen Options. (line 254) 16805* 'fshort-enums' <1>: Fortran 2003 status. (line 93) 16806* 'fsign-zero': Runtime Options. (line 34) 16807* 'fstack-arrays': Code Gen Options. (line 230) 16808* 'fsyntax-only': Error and Warning Options. 16809 (line 33) 16810* 'fworking-directory': Preprocessing Options. 16811 (line 55) 16812* 'H': Preprocessing Options. 16813 (line 174) 16814* 'I'DIR: Directory Options. (line 14) 16815* 'idirafter DIR': Preprocessing Options. 16816 (line 69) 16817* 'imultilib DIR': Preprocessing Options. 16818 (line 76) 16819* 'iprefix PREFIX': Preprocessing Options. 16820 (line 80) 16821* 'iquote DIR': Preprocessing Options. 16822 (line 89) 16823* 'isysroot DIR': Preprocessing Options. 16824 (line 85) 16825* 'isystem DIR': Preprocessing Options. 16826 (line 96) 16827* 'J'DIR: Directory Options. (line 29) 16828* 'M'DIR: Directory Options. (line 29) 16829* 'nostdinc': Preprocessing Options. 16830 (line 104) 16831* 'P': Preprocessing Options. 16832 (line 179) 16833* 'pedantic': Error and Warning Options. 16834 (line 38) 16835* 'pedantic-errors': Error and Warning Options. 16836 (line 57) 16837* 'static-libgfortran': Link Options. (line 11) 16838* 'std='STD option: Fortran Dialect Options. 16839 (line 159) 16840* 'UNAME': Preprocessing Options. 16841 (line 185) 16842* 'undef': Preprocessing Options. 16843 (line 109) 16844* 'Waliasing': Error and Warning Options. 16845 (line 69) 16846* 'Walign-commons': Error and Warning Options. 16847 (line 198) 16848* 'Wall': Error and Warning Options. 16849 (line 61) 16850* 'Wampersand': Error and Warning Options. 16851 (line 86) 16852* 'Warray-temporaries': Error and Warning Options. 16853 (line 94) 16854* 'Wc-binding-type': Error and Warning Options. 16855 (line 99) 16856* 'Wcharacter-truncation': Error and Warning Options. 16857 (line 106) 16858* 'Wcompare-reals': Error and Warning Options. 16859 (line 225) 16860* 'Wconversion': Error and Warning Options. 16861 (line 113) 16862* 'Wconversion-extra': Error and Warning Options. 16863 (line 117) 16864* 'Werror': Error and Warning Options. 16865 (line 237) 16866* 'Wextra': Error and Warning Options. 16867 (line 120) 16868* 'Wfunction-elimination': Error and Warning Options. 16869 (line 204) 16870* 'Wimplicit-interface': Error and Warning Options. 16871 (line 125) 16872* 'Wimplicit-procedure': Error and Warning Options. 16873 (line 131) 16874* 'Wintrinsic-shadow': Error and Warning Options. 16875 (line 180) 16876* 'Wintrinsics-std': Error and Warning Options. 16877 (line 135) 16878* 'Wline-truncation': Error and Warning Options. 16879 (line 109) 16880* 'Wreal-q-constant': Error and Warning Options. 16881 (line 142) 16882* 'Wrealloc-lhs': Error and Warning Options. 16883 (line 208) 16884* 'Wrealloc-lhs-all': Error and Warning Options. 16885 (line 220) 16886* 'Wsurprising': Error and Warning Options. 16887 (line 146) 16888* 'Wtabs': Error and Warning Options. 16889 (line 168) 16890* 'Wtargt-lifetime': Error and Warning Options. 16891 (line 229) 16892* 'Wunderflow': Error and Warning Options. 16893 (line 176) 16894* 'Wunused-dummy-argument': Error and Warning Options. 16895 (line 187) 16896* 'Wunused-parameter': Error and Warning Options. 16897 (line 191) 16898* 'Wzerotrip': Error and Warning Options. 16899 (line 233) 16900 16901 16902File: gfortran.info, Node: Keyword Index, Prev: Option Index, Up: Top 16903 16904Keyword Index 16905************* 16906 16907[index] 16908* Menu: 16909 16910* '$': Fortran Dialect Options. 16911 (line 34) 16912* '%LOC': Argument list functions. 16913 (line 6) 16914* '%REF': Argument list functions. 16915 (line 6) 16916* '%VAL': Argument list functions. 16917 (line 6) 16918* '&': Error and Warning Options. 16919 (line 86) 16920* '[...]': Fortran 2003 status. (line 78) 16921* _gfortran_set_args: _gfortran_set_args. (line 6) 16922* _gfortran_set_convert: _gfortran_set_convert. 16923 (line 6) 16924* _gfortran_set_fpe: _gfortran_set_fpe. (line 6) 16925* _gfortran_set_max_subrecord_length: _gfortran_set_max_subrecord_length. 16926 (line 6) 16927* _gfortran_set_options: _gfortran_set_options. 16928 (line 6) 16929* _gfortran_set_record_marker: _gfortran_set_record_marker. 16930 (line 6) 16931* ABORT: ABORT. (line 6) 16932* ABS: ABS. (line 6) 16933* absolute value: ABS. (line 6) 16934* ACCESS: ACCESS. (line 6) 16935* 'ACCESS='STREAM'' I/O: Fortran 2003 status. (line 103) 16936* ACHAR: ACHAR. (line 6) 16937* ACOS: ACOS. (line 6) 16938* ACOSH: ACOSH. (line 6) 16939* adjust string: ADJUSTL. (line 6) 16940* adjust string <1>: ADJUSTR. (line 6) 16941* ADJUSTL: ADJUSTL. (line 6) 16942* ADJUSTR: ADJUSTR. (line 6) 16943* AIMAG: AIMAG. (line 6) 16944* AINT: AINT. (line 6) 16945* ALARM: ALARM. (line 6) 16946* ALGAMA: LOG_GAMMA. (line 6) 16947* aliasing: Error and Warning Options. 16948 (line 69) 16949* alignment of 'COMMON' blocks: Error and Warning Options. 16950 (line 198) 16951* alignment of 'COMMON' blocks <1>: Code Gen Options. (line 313) 16952* ALL: ALL. (line 6) 16953* all warnings: Error and Warning Options. 16954 (line 61) 16955* 'ALLOCATABLE' components of derived types: Fortran 2003 status. 16956 (line 101) 16957* 'ALLOCATABLE' dummy arguments: Fortran 2003 status. (line 99) 16958* 'ALLOCATABLE' function results: Fortran 2003 status. (line 100) 16959* ALLOCATED: ALLOCATED. (line 6) 16960* allocation, moving: MOVE_ALLOC. (line 6) 16961* allocation, status: ALLOCATED. (line 6) 16962* ALOG: LOG. (line 6) 16963* ALOG10: LOG10. (line 6) 16964* AMAX0: MAX. (line 6) 16965* AMAX1: MAX. (line 6) 16966* AMIN0: MIN. (line 6) 16967* AMIN1: MIN. (line 6) 16968* AMOD: MOD. (line 6) 16969* AND: AND. (line 6) 16970* ANINT: ANINT. (line 6) 16971* ANY: ANY. (line 6) 16972* area hyperbolic cosine: ACOSH. (line 6) 16973* area hyperbolic sine: ASINH. (line 6) 16974* area hyperbolic tangent: ATANH. (line 6) 16975* argument list functions: Argument list functions. 16976 (line 6) 16977* arguments, to program: COMMAND_ARGUMENT_COUNT. 16978 (line 6) 16979* arguments, to program <1>: GETARG. (line 6) 16980* arguments, to program <2>: GET_COMMAND. (line 6) 16981* arguments, to program <3>: GET_COMMAND_ARGUMENT. 16982 (line 6) 16983* arguments, to program <4>: IARGC. (line 6) 16984* array, add elements: SUM. (line 6) 16985* array, AND: IALL. (line 6) 16986* array, apply condition: ALL. (line 6) 16987* array, apply condition <1>: ANY. (line 6) 16988* array, bounds checking: Code Gen Options. (line 142) 16989* array, change dimensions: RESHAPE. (line 6) 16990* array, combine arrays: MERGE. (line 6) 16991* array, condition testing: ALL. (line 6) 16992* array, condition testing <1>: ANY. (line 6) 16993* array, conditionally add elements: SUM. (line 6) 16994* array, conditionally count elements: COUNT. (line 6) 16995* array, conditionally multiply elements: PRODUCT. (line 6) 16996* array, constructors: Fortran 2003 status. (line 78) 16997* array, count elements: SIZE. (line 6) 16998* array, duplicate dimensions: SPREAD. (line 6) 16999* array, duplicate elements: SPREAD. (line 6) 17000* array, element counting: COUNT. (line 6) 17001* array, gather elements: PACK. (line 6) 17002* array, increase dimension: SPREAD. (line 6) 17003* array, increase dimension <1>: UNPACK. (line 6) 17004* array, indices of type real: Real array indices. (line 6) 17005* array, location of maximum element: MAXLOC. (line 6) 17006* array, location of minimum element: MINLOC. (line 6) 17007* array, lower bound: LBOUND. (line 6) 17008* array, maximum value: MAXVAL. (line 6) 17009* array, merge arrays: MERGE. (line 6) 17010* array, minimum value: MINVAL. (line 6) 17011* array, multiply elements: PRODUCT. (line 6) 17012* array, number of elements: COUNT. (line 6) 17013* array, number of elements <1>: SIZE. (line 6) 17014* array, OR: IANY. (line 6) 17015* array, packing: PACK. (line 6) 17016* array, parity: IPARITY. (line 6) 17017* array, permutation: CSHIFT. (line 6) 17018* array, product: PRODUCT. (line 6) 17019* array, reduce dimension: PACK. (line 6) 17020* array, rotate: CSHIFT. (line 6) 17021* array, scatter elements: UNPACK. (line 6) 17022* array, shape: SHAPE. (line 6) 17023* array, shift: EOSHIFT. (line 6) 17024* array, shift circularly: CSHIFT. (line 6) 17025* array, size: SIZE. (line 6) 17026* array, sum: SUM. (line 6) 17027* array, transmogrify: RESHAPE. (line 6) 17028* array, transpose: TRANSPOSE. (line 6) 17029* array, unpacking: UNPACK. (line 6) 17030* array, upper bound: UBOUND. (line 6) 17031* array, XOR: IPARITY. (line 6) 17032* ASCII collating sequence: ACHAR. (line 6) 17033* ASCII collating sequence <1>: IACHAR. (line 6) 17034* ASIN: ASIN. (line 6) 17035* ASINH: ASINH. (line 6) 17036* ASSOCIATED: ASSOCIATED. (line 6) 17037* association status: ASSOCIATED. (line 6) 17038* association status, C pointer: C_ASSOCIATED. (line 6) 17039* ATAN: ATAN. (line 6) 17040* ATAN2: ATAN2. (line 6) 17041* ATANH: ATANH. (line 6) 17042* Atomic subroutine, define: ATOMIC_DEFINE. (line 6) 17043* Atomic subroutine, reference: ATOMIC_REF. (line 6) 17044* ATOMIC_DEFINE: ATOMIC_DEFINE. (line 6) 17045* ATOMIC_REF: ATOMIC_REF. (line 6) 17046* Authors: Contributors. (line 6) 17047* backslash: Fortran Dialect Options. 17048 (line 40) 17049* BACKTRACE: BACKTRACE. (line 6) 17050* backtrace: Debugging Options. (line 61) 17051* backtrace <1>: BACKTRACE. (line 6) 17052* base 10 logarithm function: LOG10. (line 6) 17053* BESJ0: BESSEL_J0. (line 6) 17054* BESJ1: BESSEL_J1. (line 6) 17055* BESJN: BESSEL_JN. (line 6) 17056* Bessel function, first kind: BESSEL_J0. (line 6) 17057* Bessel function, first kind <1>: BESSEL_J1. (line 6) 17058* Bessel function, first kind <2>: BESSEL_JN. (line 6) 17059* Bessel function, second kind: BESSEL_Y0. (line 6) 17060* Bessel function, second kind <1>: BESSEL_Y1. (line 6) 17061* Bessel function, second kind <2>: BESSEL_YN. (line 6) 17062* BESSEL_J0: BESSEL_J0. (line 6) 17063* BESSEL_J1: BESSEL_J1. (line 6) 17064* BESSEL_JN: BESSEL_JN. (line 6) 17065* BESSEL_Y0: BESSEL_Y0. (line 6) 17066* BESSEL_Y1: BESSEL_Y1. (line 6) 17067* BESSEL_YN: BESSEL_YN. (line 6) 17068* BESY0: BESSEL_Y0. (line 6) 17069* BESY1: BESSEL_Y1. (line 6) 17070* BESYN: BESSEL_YN. (line 6) 17071* BGE: BGE. (line 6) 17072* BGT: BGT. (line 6) 17073* binary representation: POPCNT. (line 6) 17074* binary representation <1>: POPPAR. (line 6) 17075* bits set: POPCNT. (line 6) 17076* bits, AND of array elements: IALL. (line 6) 17077* bits, clear: IBCLR. (line 6) 17078* bits, extract: IBITS. (line 6) 17079* bits, get: IBITS. (line 6) 17080* bits, merge: MERGE_BITS. (line 6) 17081* bits, move: MVBITS. (line 6) 17082* bits, move <1>: TRANSFER. (line 6) 17083* bits, negate: NOT. (line 6) 17084* bits, number of: BIT_SIZE. (line 6) 17085* bits, OR of array elements: IANY. (line 6) 17086* bits, set: IBSET. (line 6) 17087* bits, shift: ISHFT. (line 6) 17088* bits, shift circular: ISHFTC. (line 6) 17089* bits, shift left: LSHIFT. (line 6) 17090* bits, shift left <1>: SHIFTL. (line 6) 17091* bits, shift right: RSHIFT. (line 6) 17092* bits, shift right <1>: SHIFTA. (line 6) 17093* bits, shift right <2>: SHIFTR. (line 6) 17094* bits, testing: BTEST. (line 6) 17095* bits, unset: IBCLR. (line 6) 17096* bits, XOR of array elements: IPARITY. (line 6) 17097* bitwise comparison: BGE. (line 6) 17098* bitwise comparison <1>: BGT. (line 6) 17099* bitwise comparison <2>: BLE. (line 6) 17100* bitwise comparison <3>: BLT. (line 6) 17101* bitwise logical and: AND. (line 6) 17102* bitwise logical and <1>: IAND. (line 6) 17103* bitwise logical exclusive or: IEOR. (line 6) 17104* bitwise logical exclusive or <1>: XOR. (line 6) 17105* bitwise logical not: NOT. (line 6) 17106* bitwise logical or: IOR. (line 6) 17107* bitwise logical or <1>: OR. (line 6) 17108* BIT_SIZE: BIT_SIZE. (line 6) 17109* BLE: BLE. (line 6) 17110* BLT: BLT. (line 6) 17111* bounds checking: Code Gen Options. (line 142) 17112* BOZ literal constants: BOZ literal constants. 17113 (line 6) 17114* BTEST: BTEST. (line 6) 17115* CABS: ABS. (line 6) 17116* calling convention: Code Gen Options. (line 25) 17117* CCOS: COS. (line 6) 17118* CDABS: ABS. (line 6) 17119* CDCOS: COS. (line 6) 17120* CDEXP: EXP. (line 6) 17121* CDLOG: LOG. (line 6) 17122* CDSIN: SIN. (line 6) 17123* CDSQRT: SQRT. (line 6) 17124* CEILING: CEILING. (line 6) 17125* ceiling: ANINT. (line 6) 17126* ceiling <1>: CEILING. (line 6) 17127* CEXP: EXP. (line 6) 17128* CHAR: CHAR. (line 6) 17129* character kind: SELECTED_CHAR_KIND. (line 6) 17130* character set: Fortran Dialect Options. 17131 (line 34) 17132* CHDIR: CHDIR. (line 6) 17133* checking array temporaries: Code Gen Options. (line 142) 17134* checking subscripts: Code Gen Options. (line 142) 17135* CHMOD: CHMOD. (line 6) 17136* clock ticks: MCLOCK. (line 6) 17137* clock ticks <1>: MCLOCK8. (line 6) 17138* clock ticks <2>: SYSTEM_CLOCK. (line 6) 17139* CLOG: LOG. (line 6) 17140* CMPLX: CMPLX. (line 6) 17141* coarray, 'IMAGE_INDEX': IMAGE_INDEX. (line 6) 17142* coarray, lower bound: LCOBOUND. (line 6) 17143* coarray, 'NUM_IMAGES': NUM_IMAGES. (line 6) 17144* coarray, 'THIS_IMAGE': THIS_IMAGE. (line 6) 17145* coarray, upper bound: UCOBOUND. (line 6) 17146* coarrays: Code Gen Options. (line 128) 17147* code generation, conventions: Code Gen Options. (line 6) 17148* collating sequence, ASCII: ACHAR. (line 6) 17149* collating sequence, ASCII <1>: IACHAR. (line 6) 17150* command line: EXECUTE_COMMAND_LINE. 17151 (line 6) 17152* command options: Invoking GNU Fortran. 17153 (line 6) 17154* command-line arguments: COMMAND_ARGUMENT_COUNT. 17155 (line 6) 17156* command-line arguments <1>: GETARG. (line 6) 17157* command-line arguments <2>: GET_COMMAND. (line 6) 17158* command-line arguments <3>: GET_COMMAND_ARGUMENT. 17159 (line 6) 17160* command-line arguments <4>: IARGC. (line 6) 17161* command-line arguments, number of: COMMAND_ARGUMENT_COUNT. 17162 (line 6) 17163* command-line arguments, number of <1>: IARGC. (line 6) 17164* COMMAND_ARGUMENT_COUNT: COMMAND_ARGUMENT_COUNT. 17165 (line 6) 17166* 'COMMON': Volatile COMMON blocks. 17167 (line 6) 17168* compiler flags inquiry function: COMPILER_OPTIONS. (line 6) 17169* compiler, name and version: COMPILER_VERSION. (line 6) 17170* COMPILER_OPTIONS: COMPILER_OPTIONS. (line 6) 17171* COMPILER_VERSION: COMPILER_VERSION. (line 6) 17172* COMPLEX: COMPLEX. (line 6) 17173* complex conjugate: CONJG. (line 6) 17174* Complex function: Alternate complex function syntax. 17175 (line 6) 17176* complex numbers, conversion to: CMPLX. (line 6) 17177* complex numbers, conversion to <1>: COMPLEX. (line 6) 17178* complex numbers, conversion to <2>: DCMPLX. (line 6) 17179* complex numbers, imaginary part: AIMAG. (line 6) 17180* complex numbers, real part: DREAL. (line 6) 17181* complex numbers, real part <1>: REAL. (line 6) 17182* Conditional compilation: Preprocessing and conditional compilation. 17183 (line 6) 17184* CONJG: CONJG. (line 6) 17185* consistency, durability: Data consistency and durability. 17186 (line 6) 17187* Contributing: Contributing. (line 6) 17188* Contributors: Contributors. (line 6) 17189* conversion: Error and Warning Options. 17190 (line 113) 17191* conversion <1>: Error and Warning Options. 17192 (line 117) 17193* conversion, to character: CHAR. (line 6) 17194* conversion, to complex: CMPLX. (line 6) 17195* conversion, to complex <1>: COMPLEX. (line 6) 17196* conversion, to complex <2>: DCMPLX. (line 6) 17197* conversion, to integer: Implicitly convert LOGICAL and INTEGER values. 17198 (line 6) 17199* conversion, to integer <1>: IACHAR. (line 6) 17200* conversion, to integer <2>: ICHAR. (line 6) 17201* conversion, to integer <3>: INT. (line 6) 17202* conversion, to integer <4>: INT2. (line 6) 17203* conversion, to integer <5>: INT8. (line 6) 17204* conversion, to integer <6>: LONG. (line 6) 17205* conversion, to logical: Implicitly convert LOGICAL and INTEGER values. 17206 (line 6) 17207* conversion, to logical <1>: LOGICAL. (line 6) 17208* conversion, to real: DBLE. (line 6) 17209* conversion, to real <1>: REAL. (line 6) 17210* conversion, to string: CTIME. (line 6) 17211* 'CONVERT' specifier: CONVERT specifier. (line 6) 17212* core, dump: ABORT. (line 6) 17213* COS: COS. (line 6) 17214* COSH: COSH. (line 6) 17215* cosine: COS. (line 6) 17216* cosine, hyperbolic: COSH. (line 6) 17217* cosine, hyperbolic, inverse: ACOSH. (line 6) 17218* cosine, inverse: ACOS. (line 6) 17219* COUNT: COUNT. (line 6) 17220* CPP: Preprocessing and conditional compilation. 17221 (line 6) 17222* CPP <1>: Preprocessing Options. 17223 (line 6) 17224* CPU_TIME: CPU_TIME. (line 6) 17225* Credits: Contributors. (line 6) 17226* CSHIFT: CSHIFT. (line 6) 17227* CSIN: SIN. (line 6) 17228* CSQRT: SQRT. (line 6) 17229* CTIME: CTIME. (line 6) 17230* current date: DATE_AND_TIME. (line 6) 17231* current date <1>: FDATE. (line 6) 17232* current date <2>: IDATE. (line 6) 17233* current time: DATE_AND_TIME. (line 6) 17234* current time <1>: FDATE. (line 6) 17235* current time <2>: ITIME. (line 6) 17236* current time <3>: TIME. (line 6) 17237* current time <4>: TIME8. (line 6) 17238* C_ASSOCIATED: C_ASSOCIATED. (line 6) 17239* C_FUNLOC: C_FUNLOC. (line 6) 17240* C_F_POINTER: C_F_POINTER. (line 6) 17241* C_F_PROCPOINTER: C_F_PROCPOINTER. (line 6) 17242* C_LOC: C_LOC. (line 6) 17243* C_SIZEOF: C_SIZEOF. (line 6) 17244* DABS: ABS. (line 6) 17245* DACOS: ACOS. (line 6) 17246* DACOSH: ACOSH. (line 6) 17247* DASIN: ASIN. (line 6) 17248* DASINH: ASINH. (line 6) 17249* DATAN: ATAN. (line 6) 17250* DATAN2: ATAN2. (line 6) 17251* DATANH: ATANH. (line 6) 17252* date, current: DATE_AND_TIME. (line 6) 17253* date, current <1>: FDATE. (line 6) 17254* date, current <2>: IDATE. (line 6) 17255* DATE_AND_TIME: DATE_AND_TIME. (line 6) 17256* DBESJ0: BESSEL_J0. (line 6) 17257* DBESJ1: BESSEL_J1. (line 6) 17258* DBESJN: BESSEL_JN. (line 6) 17259* DBESY0: BESSEL_Y0. (line 6) 17260* DBESY1: BESSEL_Y1. (line 6) 17261* DBESYN: BESSEL_YN. (line 6) 17262* DBLE: DBLE. (line 6) 17263* DCMPLX: DCMPLX. (line 6) 17264* DCONJG: CONJG. (line 6) 17265* DCOS: COS. (line 6) 17266* DCOSH: COSH. (line 6) 17267* DDIM: DIM. (line 6) 17268* debugging information options: Debugging Options. (line 6) 17269* debugging, preprocessor: Preprocessing Options. 17270 (line 26) 17271* debugging, preprocessor <1>: Preprocessing Options. 17272 (line 35) 17273* debugging, preprocessor <2>: Preprocessing Options. 17274 (line 41) 17275* debugging, preprocessor <3>: Preprocessing Options. 17276 (line 44) 17277* debugging, preprocessor <4>: Preprocessing Options. 17278 (line 51) 17279* 'DECODE': ENCODE and DECODE statements. 17280 (line 6) 17281* delayed execution: ALARM. (line 6) 17282* delayed execution <1>: SLEEP. (line 6) 17283* DEXP: EXP. (line 6) 17284* DFLOAT: REAL. (line 6) 17285* DGAMMA: GAMMA. (line 6) 17286* dialect options: Fortran Dialect Options. 17287 (line 6) 17288* DIGITS: DIGITS. (line 6) 17289* DIM: DIM. (line 6) 17290* DIMAG: AIMAG. (line 6) 17291* DINT: AINT. (line 6) 17292* directive, 'INCLUDE': Directory Options. (line 6) 17293* directory, options: Directory Options. (line 6) 17294* directory, search paths for inclusion: Directory Options. (line 14) 17295* division, modulo: MODULO. (line 6) 17296* division, remainder: MOD. (line 6) 17297* DLGAMA: LOG_GAMMA. (line 6) 17298* DLOG: LOG. (line 6) 17299* DLOG10: LOG10. (line 6) 17300* DMAX1: MAX. (line 6) 17301* DMIN1: MIN. (line 6) 17302* DMOD: MOD. (line 6) 17303* DNINT: ANINT. (line 6) 17304* dot product: DOT_PRODUCT. (line 6) 17305* DOT_PRODUCT: DOT_PRODUCT. (line 6) 17306* DPROD: DPROD. (line 6) 17307* DREAL: DREAL. (line 6) 17308* DSHIFTL: DSHIFTL. (line 6) 17309* DSHIFTR: DSHIFTR. (line 6) 17310* DSIGN: SIGN. (line 6) 17311* DSIN: SIN. (line 6) 17312* DSINH: SINH. (line 6) 17313* DSQRT: SQRT. (line 6) 17314* DTAN: TAN. (line 6) 17315* DTANH: TANH. (line 6) 17316* DTIME: DTIME. (line 6) 17317* dummy argument, unused: Error and Warning Options. 17318 (line 187) 17319* elapsed time: DTIME. (line 6) 17320* elapsed time <1>: SECNDS. (line 6) 17321* elapsed time <2>: SECOND. (line 6) 17322* Elimination of functions with identical argument lists: Code Gen Options. 17323 (line 340) 17324* 'ENCODE': ENCODE and DECODE statements. 17325 (line 6) 17326* 'ENUM' statement: Fortran 2003 status. (line 93) 17327* 'ENUMERATOR' statement: Fortran 2003 status. (line 93) 17328* environment variable: Environment Variables. 17329 (line 6) 17330* environment variable <1>: Runtime. (line 6) 17331* environment variable <2>: GETENV. (line 6) 17332* environment variable <3>: GET_ENVIRONMENT_VARIABLE. 17333 (line 6) 17334* EOSHIFT: EOSHIFT. (line 6) 17335* EPSILON: EPSILON. (line 6) 17336* ERF: ERF. (line 6) 17337* ERFC: ERFC. (line 6) 17338* ERFC_SCALED: ERFC_SCALED. (line 6) 17339* error function: ERF. (line 6) 17340* error function, complementary: ERFC. (line 6) 17341* error function, complementary, exponentially-scaled: ERFC_SCALED. 17342 (line 6) 17343* errors, limiting: Error and Warning Options. 17344 (line 27) 17345* escape characters: Fortran Dialect Options. 17346 (line 40) 17347* ETIME: ETIME. (line 6) 17348* Euclidean distance: HYPOT. (line 6) 17349* Euclidean vector norm: NORM2. (line 6) 17350* EXECUTE_COMMAND_LINE: EXECUTE_COMMAND_LINE. 17351 (line 6) 17352* EXIT: EXIT. (line 6) 17353* EXP: EXP. (line 6) 17354* EXPONENT: EXPONENT. (line 6) 17355* exponential function: EXP. (line 6) 17356* exponential function, inverse: LOG. (line 6) 17357* exponential function, inverse <1>: LOG10. (line 6) 17358* expression size: C_SIZEOF. (line 6) 17359* expression size <1>: SIZEOF. (line 6) 17360* EXTENDS_TYPE_OF: EXTENDS_TYPE_OF. (line 6) 17361* extensions: Extensions. (line 6) 17362* extensions, implemented: Extensions implemented in GNU Fortran. 17363 (line 6) 17364* extensions, not implemented: Extensions not implemented in GNU Fortran. 17365 (line 6) 17366* extra warnings: Error and Warning Options. 17367 (line 120) 17368* 'f2c' calling convention: Code Gen Options. (line 25) 17369* 'f2c' calling convention <1>: Code Gen Options. (line 111) 17370* Factorial function: GAMMA. (line 6) 17371* FDATE: FDATE. (line 6) 17372* FDL, GNU Free Documentation License: GNU Free Documentation License. 17373 (line 6) 17374* FGET: FGET. (line 6) 17375* FGETC: FGETC. (line 6) 17376* file format, fixed: Fortran Dialect Options. 17377 (line 11) 17378* file format, fixed <1>: Fortran Dialect Options. 17379 (line 57) 17380* file format, free: Fortran Dialect Options. 17381 (line 11) 17382* file format, free <1>: Fortran Dialect Options. 17383 (line 70) 17384* file operation, file number: FNUM. (line 6) 17385* file operation, flush: FLUSH. (line 6) 17386* file operation, position: FSEEK. (line 6) 17387* file operation, position <1>: FTELL. (line 6) 17388* file operation, read character: FGET. (line 6) 17389* file operation, read character <1>: FGETC. (line 6) 17390* file operation, seek: FSEEK. (line 6) 17391* file operation, write character: FPUT. (line 6) 17392* file operation, write character <1>: FPUTC. (line 6) 17393* file system, access mode: ACCESS. (line 6) 17394* file system, change access mode: CHMOD. (line 6) 17395* file system, create link: LINK. (line 6) 17396* file system, create link <1>: SYMLNK. (line 6) 17397* file system, file creation mask: UMASK. (line 6) 17398* file system, file status: FSTAT. (line 6) 17399* file system, file status <1>: LSTAT. (line 6) 17400* file system, file status <2>: STAT. (line 6) 17401* file system, hard link: LINK. (line 6) 17402* file system, remove file: UNLINK. (line 6) 17403* file system, rename file: RENAME. (line 6) 17404* file system, soft link: SYMLNK. (line 6) 17405* flags inquiry function: COMPILER_OPTIONS. (line 6) 17406* FLOAT: REAL. (line 6) 17407* floating point, exponent: EXPONENT. (line 6) 17408* floating point, fraction: FRACTION. (line 6) 17409* floating point, nearest different: NEAREST. (line 6) 17410* floating point, relative spacing: RRSPACING. (line 6) 17411* floating point, relative spacing <1>: SPACING. (line 6) 17412* floating point, scale: SCALE. (line 6) 17413* floating point, set exponent: SET_EXPONENT. (line 6) 17414* FLOOR: FLOOR. (line 6) 17415* floor: AINT. (line 6) 17416* floor <1>: FLOOR. (line 6) 17417* FLUSH: FLUSH. (line 6) 17418* 'FLUSH' statement: Fortran 2003 status. (line 89) 17419* FNUM: FNUM. (line 6) 17420* 'FORMAT': Variable FORMAT expressions. 17421 (line 6) 17422* Fortran 77: GNU Fortran and G77. (line 6) 17423* FPP: Preprocessing and conditional compilation. 17424 (line 6) 17425* FPUT: FPUT. (line 6) 17426* FPUTC: FPUTC. (line 6) 17427* FRACTION: FRACTION. (line 6) 17428* FREE: FREE. (line 6) 17429* Front-end optimization: Code Gen Options. (line 348) 17430* FSEEK: FSEEK. (line 6) 17431* FSTAT: FSTAT. (line 6) 17432* FTELL: FTELL. (line 6) 17433* function elimination: Error and Warning Options. 17434 (line 204) 17435* 'g77': GNU Fortran and G77. (line 6) 17436* 'g77' calling convention: Code Gen Options. (line 25) 17437* 'g77' calling convention <1>: Code Gen Options. (line 111) 17438* GAMMA: GAMMA. (line 6) 17439* Gamma function: GAMMA. (line 6) 17440* Gamma function, logarithm of: LOG_GAMMA. (line 6) 17441* GCC: GNU Fortran and GCC. (line 6) 17442* GERROR: GERROR. (line 6) 17443* GETARG: GETARG. (line 6) 17444* GETCWD: GETCWD. (line 6) 17445* GETENV: GETENV. (line 6) 17446* GETGID: GETGID. (line 6) 17447* GETLOG: GETLOG. (line 6) 17448* GETPID: GETPID. (line 6) 17449* GETUID: GETUID. (line 6) 17450* GET_COMMAND: GET_COMMAND. (line 6) 17451* GET_COMMAND_ARGUMENT: GET_COMMAND_ARGUMENT. 17452 (line 6) 17453* GET_ENVIRONMENT_VARIABLE: GET_ENVIRONMENT_VARIABLE. 17454 (line 6) 17455* GMTIME: GMTIME. (line 6) 17456* GNU Compiler Collection: GNU Fortran and GCC. (line 6) 17457* GNU Fortran command options: Invoking GNU Fortran. 17458 (line 6) 17459* Hollerith constants: Hollerith constants support. 17460 (line 6) 17461* HOSTNM: HOSTNM. (line 6) 17462* HUGE: HUGE. (line 6) 17463* hyperbolic cosine: COSH. (line 6) 17464* hyperbolic function, cosine: COSH. (line 6) 17465* hyperbolic function, cosine, inverse: ACOSH. (line 6) 17466* hyperbolic function, sine: SINH. (line 6) 17467* hyperbolic function, sine, inverse: ASINH. (line 6) 17468* hyperbolic function, tangent: TANH. (line 6) 17469* hyperbolic function, tangent, inverse: ATANH. (line 6) 17470* hyperbolic sine: SINH. (line 6) 17471* hyperbolic tangent: TANH. (line 6) 17472* HYPOT: HYPOT. (line 6) 17473* I/O item lists: I/O item lists. (line 6) 17474* IABS: ABS. (line 6) 17475* IACHAR: IACHAR. (line 6) 17476* IALL: IALL. (line 6) 17477* IAND: IAND. (line 6) 17478* IANY: IANY. (line 6) 17479* IARGC: IARGC. (line 6) 17480* IBCLR: IBCLR. (line 6) 17481* IBITS: IBITS. (line 6) 17482* IBSET: IBSET. (line 6) 17483* ICHAR: ICHAR. (line 6) 17484* IDATE: IDATE. (line 6) 17485* IDIM: DIM. (line 6) 17486* IDINT: INT. (line 6) 17487* IDNINT: NINT. (line 6) 17488* IEEE, ISNAN: ISNAN. (line 6) 17489* IEOR: IEOR. (line 6) 17490* IERRNO: IERRNO. (line 6) 17491* IFIX: INT. (line 6) 17492* IMAG: AIMAG. (line 6) 17493* images, cosubscript to image index conversion: IMAGE_INDEX. (line 6) 17494* images, index of this image: THIS_IMAGE. (line 6) 17495* images, number of: NUM_IMAGES. (line 6) 17496* IMAGE_INDEX: IMAGE_INDEX. (line 6) 17497* IMAGPART: AIMAG. (line 6) 17498* 'IMPORT' statement: Fortran 2003 status. (line 120) 17499* 'INCLUDE' directive: Directory Options. (line 6) 17500* inclusion, directory search paths for: Directory Options. (line 14) 17501* INDEX: INDEX intrinsic. (line 6) 17502* INT: INT. (line 6) 17503* INT2: INT2. (line 6) 17504* INT8: INT8. (line 6) 17505* integer kind: SELECTED_INT_KIND. (line 6) 17506* Interoperability: Mixed-Language Programming. 17507 (line 6) 17508* intrinsic: Error and Warning Options. 17509 (line 180) 17510* intrinsic Modules: Intrinsic Modules. (line 6) 17511* intrinsic procedures: Intrinsic Procedures. 17512 (line 6) 17513* Introduction: Top. (line 6) 17514* inverse hyperbolic cosine: ACOSH. (line 6) 17515* inverse hyperbolic sine: ASINH. (line 6) 17516* inverse hyperbolic tangent: ATANH. (line 6) 17517* 'IOMSG=' specifier: Fortran 2003 status. (line 91) 17518* IOR: IOR. (line 6) 17519* 'IOSTAT', end of file: IS_IOSTAT_END. (line 6) 17520* 'IOSTAT', end of record: IS_IOSTAT_EOR. (line 6) 17521* IPARITY: IPARITY. (line 6) 17522* IRAND: IRAND. (line 6) 17523* ISATTY: ISATTY. (line 6) 17524* ISHFT: ISHFT. (line 6) 17525* ISHFTC: ISHFTC. (line 6) 17526* ISIGN: SIGN. (line 6) 17527* ISNAN: ISNAN. (line 6) 17528* 'ISO_FORTRAN_ENV' statement: Fortran 2003 status. (line 128) 17529* IS_IOSTAT_END: IS_IOSTAT_END. (line 6) 17530* IS_IOSTAT_EOR: IS_IOSTAT_EOR. (line 6) 17531* ITIME: ITIME. (line 6) 17532* KILL: KILL. (line 6) 17533* KIND: KIND. (line 6) 17534* kind: KIND Type Parameters. 17535 (line 6) 17536* kind <1>: KIND. (line 6) 17537* kind, character: SELECTED_CHAR_KIND. (line 6) 17538* kind, integer: SELECTED_INT_KIND. (line 6) 17539* kind, old-style: Old-style kind specifications. 17540 (line 6) 17541* kind, real: SELECTED_REAL_KIND. (line 6) 17542* L2 vector norm: NORM2. (line 6) 17543* language, dialect options: Fortran Dialect Options. 17544 (line 6) 17545* LBOUND: LBOUND. (line 6) 17546* LCOBOUND: LCOBOUND. (line 6) 17547* LEADZ: LEADZ. (line 6) 17548* left shift, combined: DSHIFTL. (line 6) 17549* LEN: LEN. (line 6) 17550* LEN_TRIM: LEN_TRIM. (line 6) 17551* lexical comparison of strings: LGE. (line 6) 17552* lexical comparison of strings <1>: LGT. (line 6) 17553* lexical comparison of strings <2>: LLE. (line 6) 17554* lexical comparison of strings <3>: LLT. (line 6) 17555* LGAMMA: LOG_GAMMA. (line 6) 17556* LGE: LGE. (line 6) 17557* LGT: LGT. (line 6) 17558* libf2c calling convention: Code Gen Options. (line 25) 17559* libf2c calling convention <1>: Code Gen Options. (line 111) 17560* libgfortran initialization, set_args: _gfortran_set_args. (line 6) 17561* libgfortran initialization, set_convert: _gfortran_set_convert. 17562 (line 6) 17563* libgfortran initialization, set_fpe: _gfortran_set_fpe. (line 6) 17564* libgfortran initialization, set_max_subrecord_length: _gfortran_set_max_subrecord_length. 17565 (line 6) 17566* libgfortran initialization, set_options: _gfortran_set_options. 17567 (line 6) 17568* libgfortran initialization, set_record_marker: _gfortran_set_record_marker. 17569 (line 6) 17570* limits, largest number: HUGE. (line 6) 17571* limits, smallest number: TINY. (line 6) 17572* LINK: LINK. (line 6) 17573* linking, static: Link Options. (line 6) 17574* LLE: LLE. (line 6) 17575* LLT: LLT. (line 6) 17576* LNBLNK: LNBLNK. (line 6) 17577* LOC: LOC. (line 6) 17578* location of a variable in memory: LOC. (line 6) 17579* LOG: LOG. (line 6) 17580* LOG10: LOG10. (line 6) 17581* logarithm function: LOG. (line 6) 17582* logarithm function with base 10: LOG10. (line 6) 17583* logarithm function, inverse: EXP. (line 6) 17584* LOGICAL: LOGICAL. (line 6) 17585* logical and, bitwise: AND. (line 6) 17586* logical and, bitwise <1>: IAND. (line 6) 17587* logical exclusive or, bitwise: IEOR. (line 6) 17588* logical exclusive or, bitwise <1>: XOR. (line 6) 17589* logical not, bitwise: NOT. (line 6) 17590* logical or, bitwise: IOR. (line 6) 17591* logical or, bitwise <1>: OR. (line 6) 17592* logical, variable representation: Internal representation of LOGICAL variables. 17593 (line 6) 17594* login name: GETLOG. (line 6) 17595* LOG_GAMMA: LOG_GAMMA. (line 6) 17596* LONG: LONG. (line 6) 17597* LSHIFT: LSHIFT. (line 6) 17598* LSTAT: LSTAT. (line 6) 17599* LTIME: LTIME. (line 6) 17600* MALLOC: MALLOC. (line 6) 17601* mask, left justified: MASKL. (line 6) 17602* mask, right justified: MASKR. (line 6) 17603* MASKL: MASKL. (line 6) 17604* MASKR: MASKR. (line 6) 17605* MATMUL: MATMUL. (line 6) 17606* matrix multiplication: MATMUL. (line 6) 17607* matrix, transpose: TRANSPOSE. (line 6) 17608* MAX: MAX. (line 6) 17609* MAX0: MAX. (line 6) 17610* MAX1: MAX. (line 6) 17611* MAXEXPONENT: MAXEXPONENT. (line 6) 17612* maximum value: MAX. (line 6) 17613* maximum value <1>: MAXVAL. (line 6) 17614* MAXLOC: MAXLOC. (line 6) 17615* MAXVAL: MAXVAL. (line 6) 17616* MCLOCK: MCLOCK. (line 6) 17617* MCLOCK8: MCLOCK8. (line 6) 17618* memory checking: Code Gen Options. (line 142) 17619* MERGE: MERGE. (line 6) 17620* MERGE_BITS: MERGE_BITS. (line 6) 17621* messages, error: Error and Warning Options. 17622 (line 6) 17623* messages, warning: Error and Warning Options. 17624 (line 6) 17625* MIN: MIN. (line 6) 17626* MIN0: MIN. (line 6) 17627* MIN1: MIN. (line 6) 17628* MINEXPONENT: MINEXPONENT. (line 6) 17629* minimum value: MIN. (line 6) 17630* minimum value <1>: MINVAL. (line 6) 17631* MINLOC: MINLOC. (line 6) 17632* MINVAL: MINVAL. (line 6) 17633* Mixed-language programming: Mixed-Language Programming. 17634 (line 6) 17635* MOD: MOD. (line 6) 17636* model representation, base: RADIX. (line 6) 17637* model representation, epsilon: EPSILON. (line 6) 17638* model representation, largest number: HUGE. (line 6) 17639* model representation, maximum exponent: MAXEXPONENT. (line 6) 17640* model representation, minimum exponent: MINEXPONENT. (line 6) 17641* model representation, precision: PRECISION. (line 6) 17642* model representation, radix: RADIX. (line 6) 17643* model representation, range: RANGE. (line 6) 17644* model representation, significant digits: DIGITS. (line 6) 17645* model representation, smallest number: TINY. (line 6) 17646* module entities: Fortran Dialect Options. 17647 (line 52) 17648* module search path: Directory Options. (line 14) 17649* module search path <1>: Directory Options. (line 29) 17650* module search path <2>: Directory Options. (line 36) 17651* MODULO: MODULO. (line 6) 17652* modulo: MODULO. (line 6) 17653* MOVE_ALLOC: MOVE_ALLOC. (line 6) 17654* moving allocation: MOVE_ALLOC. (line 6) 17655* multiply array elements: PRODUCT. (line 6) 17656* MVBITS: MVBITS. (line 6) 17657* Namelist: Extensions to namelist. 17658 (line 6) 17659* natural logarithm function: LOG. (line 6) 17660* NEAREST: NEAREST. (line 6) 17661* newline: NEW_LINE. (line 6) 17662* NEW_LINE: NEW_LINE. (line 6) 17663* NINT: NINT. (line 6) 17664* norm, Euclidean: NORM2. (line 6) 17665* NORM2: NORM2. (line 6) 17666* NOT: NOT. (line 6) 17667* NULL: NULL. (line 6) 17668* NUM_IMAGES: NUM_IMAGES. (line 6) 17669* OpenMP: Fortran Dialect Options. 17670 (line 90) 17671* OpenMP <1>: OpenMP. (line 6) 17672* operators, unary: Unary operators. (line 6) 17673* options inquiry function: COMPILER_OPTIONS. (line 6) 17674* options, code generation: Code Gen Options. (line 6) 17675* options, debugging: Debugging Options. (line 6) 17676* options, dialect: Fortran Dialect Options. 17677 (line 6) 17678* options, directory search: Directory Options. (line 6) 17679* options, errors: Error and Warning Options. 17680 (line 6) 17681* options, Fortran dialect: Fortran Dialect Options. 17682 (line 11) 17683* options, 'gfortran' command: Invoking GNU Fortran. 17684 (line 6) 17685* options, linking: Link Options. (line 6) 17686* options, negative forms: Invoking GNU Fortran. 17687 (line 13) 17688* options, preprocessor: Preprocessing Options. 17689 (line 6) 17690* options, real kind type promotion: Fortran Dialect Options. 17691 (line 148) 17692* options, run-time: Code Gen Options. (line 6) 17693* options, runtime: Runtime Options. (line 6) 17694* options, warnings: Error and Warning Options. 17695 (line 6) 17696* OR: OR. (line 6) 17697* output, newline: NEW_LINE. (line 6) 17698* PACK: PACK. (line 6) 17699* PARITY: PARITY. (line 6) 17700* Parity: PARITY. (line 6) 17701* parity: POPPAR. (line 6) 17702* paths, search: Directory Options. (line 14) 17703* paths, search <1>: Directory Options. (line 29) 17704* paths, search <2>: Directory Options. (line 36) 17705* PERROR: PERROR. (line 6) 17706* pointer checking: Code Gen Options. (line 142) 17707* pointer, C address of pointers: C_F_PROCPOINTER. (line 6) 17708* pointer, C address of procedures: C_FUNLOC. (line 6) 17709* pointer, C association status: C_ASSOCIATED. (line 6) 17710* pointer, convert C to Fortran: C_F_POINTER. (line 6) 17711* pointer, Cray: Cray pointers. (line 6) 17712* pointer, cray: FREE. (line 6) 17713* pointer, cray <1>: MALLOC. (line 6) 17714* pointer, disassociated: NULL. (line 6) 17715* pointer, status: ASSOCIATED. (line 6) 17716* pointer, status <1>: NULL. (line 6) 17717* POPCNT: POPCNT. (line 6) 17718* POPPAR: POPPAR. (line 6) 17719* positive difference: DIM. (line 6) 17720* PRECISION: PRECISION. (line 6) 17721* Preprocessing: Preprocessing and conditional compilation. 17722 (line 6) 17723* preprocessing, assertion: Preprocessing Options. 17724 (line 113) 17725* preprocessing, assertion <1>: Preprocessing Options. 17726 (line 119) 17727* preprocessing, define macros: Preprocessing Options. 17728 (line 151) 17729* preprocessing, define macros <1>: Preprocessing Options. 17730 (line 154) 17731* preprocessing, include path: Preprocessing Options. 17732 (line 69) 17733* preprocessing, include path <1>: Preprocessing Options. 17734 (line 76) 17735* preprocessing, include path <2>: Preprocessing Options. 17736 (line 80) 17737* preprocessing, include path <3>: Preprocessing Options. 17738 (line 85) 17739* preprocessing, include path <4>: Preprocessing Options. 17740 (line 89) 17741* preprocessing, include path <5>: Preprocessing Options. 17742 (line 96) 17743* preprocessing, keep comments: Preprocessing Options. 17744 (line 122) 17745* preprocessing, keep comments <1>: Preprocessing Options. 17746 (line 137) 17747* preprocessing, no linemarkers: Preprocessing Options. 17748 (line 179) 17749* preprocessing, undefine macros: Preprocessing Options. 17750 (line 185) 17751* preprocessor: Preprocessing Options. 17752 (line 6) 17753* preprocessor, debugging: Preprocessing Options. 17754 (line 26) 17755* preprocessor, debugging <1>: Preprocessing Options. 17756 (line 35) 17757* preprocessor, debugging <2>: Preprocessing Options. 17758 (line 41) 17759* preprocessor, debugging <3>: Preprocessing Options. 17760 (line 44) 17761* preprocessor, debugging <4>: Preprocessing Options. 17762 (line 51) 17763* preprocessor, disable: Preprocessing Options. 17764 (line 12) 17765* preprocessor, enable: Preprocessing Options. 17766 (line 12) 17767* preprocessor, include file handling: Preprocessing and conditional compilation. 17768 (line 6) 17769* preprocessor, working directory: Preprocessing Options. 17770 (line 55) 17771* PRESENT: PRESENT. (line 6) 17772* private: Fortran Dialect Options. 17773 (line 52) 17774* procedure pointer, convert C to Fortran: C_LOC. (line 6) 17775* process ID: GETPID. (line 6) 17776* PRODUCT: PRODUCT. (line 6) 17777* product, double-precision: DPROD. (line 6) 17778* product, matrix: MATMUL. (line 6) 17779* product, vector: DOT_PRODUCT. (line 6) 17780* program termination: EXIT. (line 6) 17781* program termination, with core dump: ABORT. (line 6) 17782* 'PROTECTED' statement: Fortran 2003 status. (line 114) 17783* 'Q' exponent-letter: 'Q' exponent-letter. (line 6) 17784* RADIX: RADIX. (line 6) 17785* radix, real: SELECTED_REAL_KIND. (line 6) 17786* RAN: RAN. (line 6) 17787* RAND: RAND. (line 6) 17788* random number generation: IRAND. (line 6) 17789* random number generation <1>: RAN. (line 6) 17790* random number generation <2>: RAND. (line 6) 17791* random number generation <3>: RANDOM_NUMBER. (line 6) 17792* random number generation, seeding: RANDOM_SEED. (line 6) 17793* random number generation, seeding <1>: SRAND. (line 6) 17794* RANDOM_NUMBER: RANDOM_NUMBER. (line 6) 17795* RANDOM_SEED: RANDOM_SEED. (line 6) 17796* RANGE: RANGE. (line 6) 17797* range checking: Code Gen Options. (line 142) 17798* RANK: RANK. (line 6) 17799* rank: RANK. (line 6) 17800* re-association of parenthesized expressions: Code Gen Options. 17801 (line 325) 17802* read character, stream mode: FGET. (line 6) 17803* read character, stream mode <1>: FGETC. (line 6) 17804* REAL: REAL. (line 6) 17805* real kind: SELECTED_REAL_KIND. (line 6) 17806* real number, exponent: EXPONENT. (line 6) 17807* real number, fraction: FRACTION. (line 6) 17808* real number, nearest different: NEAREST. (line 6) 17809* real number, relative spacing: RRSPACING. (line 6) 17810* real number, relative spacing <1>: SPACING. (line 6) 17811* real number, scale: SCALE. (line 6) 17812* real number, set exponent: SET_EXPONENT. (line 6) 17813* Reallocate the LHS in assignments: Code Gen Options. (line 334) 17814* Reallocate the LHS in assignments, notification: Error and Warning Options. 17815 (line 208) 17816* REALPART: REAL. (line 6) 17817* 'RECORD': STRUCTURE and RECORD. 17818 (line 6) 17819* Reduction, XOR: PARITY. (line 6) 17820* remainder: MOD. (line 6) 17821* RENAME: RENAME. (line 6) 17822* repacking arrays: Code Gen Options. (line 244) 17823* REPEAT: REPEAT. (line 6) 17824* RESHAPE: RESHAPE. (line 6) 17825* right shift, combined: DSHIFTR. (line 6) 17826* root: SQRT. (line 6) 17827* rounding, ceiling: ANINT. (line 6) 17828* rounding, ceiling <1>: CEILING. (line 6) 17829* rounding, floor: AINT. (line 6) 17830* rounding, floor <1>: FLOOR. (line 6) 17831* rounding, nearest whole number: NINT. (line 6) 17832* RRSPACING: RRSPACING. (line 6) 17833* RSHIFT: RSHIFT. (line 6) 17834* run-time checking: Code Gen Options. (line 142) 17835* SAME_TYPE_AS: SAME_TYPE_AS. (line 6) 17836* 'SAVE' statement: Code Gen Options. (line 15) 17837* SCALE: SCALE. (line 6) 17838* SCAN: SCAN. (line 6) 17839* search path: Directory Options. (line 6) 17840* search paths, for included files: Directory Options. (line 14) 17841* SECNDS: SECNDS. (line 6) 17842* SECOND: SECOND. (line 6) 17843* seeding a random number generator: RANDOM_SEED. (line 6) 17844* seeding a random number generator <1>: SRAND. (line 6) 17845* SELECTED_CHAR_KIND: SELECTED_CHAR_KIND. (line 6) 17846* SELECTED_INT_KIND: SELECTED_INT_KIND. (line 6) 17847* SELECTED_REAL_KIND: SELECTED_REAL_KIND. (line 6) 17848* SET_EXPONENT: SET_EXPONENT. (line 6) 17849* SHAPE: SHAPE. (line 6) 17850* shift, left: DSHIFTL. (line 6) 17851* shift, left <1>: SHIFTL. (line 6) 17852* shift, right: DSHIFTR. (line 6) 17853* shift, right <1>: SHIFTR. (line 6) 17854* shift, right with fill: SHIFTA. (line 6) 17855* SHIFTA: SHIFTA. (line 6) 17856* SHIFTL: SHIFTL. (line 6) 17857* SHIFTR: SHIFTR. (line 6) 17858* SHORT: INT2. (line 6) 17859* SIGN: SIGN. (line 6) 17860* sign copying: SIGN. (line 6) 17861* SIGNAL: SIGNAL. (line 6) 17862* SIN: SIN. (line 6) 17863* sine: SIN. (line 6) 17864* sine, hyperbolic: SINH. (line 6) 17865* sine, hyperbolic, inverse: ASINH. (line 6) 17866* sine, inverse: ASIN. (line 6) 17867* SINH: SINH. (line 6) 17868* SIZE: SIZE. (line 6) 17869* size of a variable, in bits: BIT_SIZE. (line 6) 17870* size of an expression: C_SIZEOF. (line 6) 17871* size of an expression <1>: SIZEOF. (line 6) 17872* SIZEOF: SIZEOF. (line 6) 17873* SLEEP: SLEEP. (line 6) 17874* SNGL: REAL. (line 6) 17875* SPACING: SPACING. (line 6) 17876* SPREAD: SPREAD. (line 6) 17877* SQRT: SQRT. (line 6) 17878* square-root: SQRT. (line 6) 17879* SRAND: SRAND. (line 6) 17880* Standards: Standards. (line 6) 17881* STAT: STAT. (line 6) 17882* statement, 'ENUM': Fortran 2003 status. (line 93) 17883* statement, 'ENUMERATOR': Fortran 2003 status. (line 93) 17884* statement, 'FLUSH': Fortran 2003 status. (line 89) 17885* statement, 'IMPORT': Fortran 2003 status. (line 120) 17886* statement, 'ISO_FORTRAN_ENV': Fortran 2003 status. (line 128) 17887* statement, 'PROTECTED': Fortran 2003 status. (line 114) 17888* statement, 'SAVE': Code Gen Options. (line 15) 17889* statement, 'USE, INTRINSIC': Fortran 2003 status. (line 128) 17890* statement, 'VALUE': Fortran 2003 status. (line 116) 17891* statement, 'VOLATILE': Fortran 2003 status. (line 118) 17892* storage size: STORAGE_SIZE. (line 6) 17893* STORAGE_SIZE: STORAGE_SIZE. (line 6) 17894* 'STREAM' I/O: Fortran 2003 status. (line 103) 17895* stream mode, read character: FGET. (line 6) 17896* stream mode, read character <1>: FGETC. (line 6) 17897* stream mode, write character: FPUT. (line 6) 17898* stream mode, write character <1>: FPUTC. (line 6) 17899* string, adjust left: ADJUSTL. (line 6) 17900* string, adjust right: ADJUSTR. (line 6) 17901* string, comparison: LGE. (line 6) 17902* string, comparison <1>: LGT. (line 6) 17903* string, comparison <2>: LLE. (line 6) 17904* string, comparison <3>: LLT. (line 6) 17905* string, concatenate: REPEAT. (line 6) 17906* string, find missing set: VERIFY. (line 6) 17907* string, find non-blank character: LNBLNK. (line 6) 17908* string, find subset: SCAN. (line 6) 17909* string, find substring: INDEX intrinsic. (line 6) 17910* string, length: LEN. (line 6) 17911* string, length, without trailing whitespace: LEN_TRIM. (line 6) 17912* string, remove trailing whitespace: TRIM. (line 6) 17913* string, repeat: REPEAT. (line 6) 17914* strings, varying length: Varying Length Character Strings. 17915 (line 6) 17916* 'STRUCTURE': STRUCTURE and RECORD. 17917 (line 6) 17918* structure packing: Code Gen Options. (line 238) 17919* subscript checking: Code Gen Options. (line 142) 17920* substring position: INDEX intrinsic. (line 6) 17921* SUM: SUM. (line 6) 17922* sum array elements: SUM. (line 6) 17923* suppressing warnings: Error and Warning Options. 17924 (line 6) 17925* symbol names: Fortran Dialect Options. 17926 (line 34) 17927* symbol names, transforming: Code Gen Options. (line 54) 17928* symbol names, transforming <1>: Code Gen Options. (line 111) 17929* symbol names, underscores: Code Gen Options. (line 54) 17930* symbol names, underscores <1>: Code Gen Options. (line 111) 17931* SYMLNK: SYMLNK. (line 6) 17932* syntax checking: Error and Warning Options. 17933 (line 33) 17934* SYSTEM: SYSTEM. (line 6) 17935* system, error handling: GERROR. (line 6) 17936* system, error handling <1>: IERRNO. (line 6) 17937* system, error handling <2>: PERROR. (line 6) 17938* system, group ID: GETGID. (line 6) 17939* system, host name: HOSTNM. (line 6) 17940* system, login name: GETLOG. (line 6) 17941* system, process ID: GETPID. (line 6) 17942* system, signal handling: SIGNAL. (line 6) 17943* system, system call: EXECUTE_COMMAND_LINE. 17944 (line 6) 17945* system, system call <1>: SYSTEM. (line 6) 17946* system, terminal: ISATTY. (line 6) 17947* system, terminal <1>: TTYNAM. (line 6) 17948* system, user ID: GETUID. (line 6) 17949* system, working directory: CHDIR. (line 6) 17950* system, working directory <1>: GETCWD. (line 6) 17951* SYSTEM_CLOCK: SYSTEM_CLOCK. (line 6) 17952* tabulators: Error and Warning Options. 17953 (line 168) 17954* TAN: TAN. (line 6) 17955* tangent: TAN. (line 6) 17956* tangent, hyperbolic: TANH. (line 6) 17957* tangent, hyperbolic, inverse: ATANH. (line 6) 17958* tangent, inverse: ATAN. (line 6) 17959* tangent, inverse <1>: ATAN2. (line 6) 17960* TANH: TANH. (line 6) 17961* terminate program: EXIT. (line 6) 17962* terminate program, with core dump: ABORT. (line 6) 17963* THIS_IMAGE: THIS_IMAGE. (line 6) 17964* thread-safety, threads: Thread-safety of the runtime library. 17965 (line 6) 17966* TIME: TIME. (line 6) 17967* time, clock ticks: MCLOCK. (line 6) 17968* time, clock ticks <1>: MCLOCK8. (line 6) 17969* time, clock ticks <2>: SYSTEM_CLOCK. (line 6) 17970* time, conversion to GMT info: GMTIME. (line 6) 17971* time, conversion to local time info: LTIME. (line 6) 17972* time, conversion to string: CTIME. (line 6) 17973* time, current: DATE_AND_TIME. (line 6) 17974* time, current <1>: FDATE. (line 6) 17975* time, current <2>: ITIME. (line 6) 17976* time, current <3>: TIME. (line 6) 17977* time, current <4>: TIME8. (line 6) 17978* time, elapsed: CPU_TIME. (line 6) 17979* time, elapsed <1>: DTIME. (line 6) 17980* time, elapsed <2>: ETIME. (line 6) 17981* time, elapsed <3>: SECNDS. (line 6) 17982* time, elapsed <4>: SECOND. (line 6) 17983* TIME8: TIME8. (line 6) 17984* TINY: TINY. (line 6) 17985* TR 15581: Fortran 2003 status. (line 98) 17986* trace: Debugging Options. (line 61) 17987* TRAILZ: TRAILZ. (line 6) 17988* TRANSFER: TRANSFER. (line 6) 17989* transforming symbol names: Code Gen Options. (line 54) 17990* transforming symbol names <1>: Code Gen Options. (line 111) 17991* TRANSPOSE: TRANSPOSE. (line 6) 17992* transpose: TRANSPOSE. (line 6) 17993* trigonometric function, cosine: COS. (line 6) 17994* trigonometric function, cosine, inverse: ACOS. (line 6) 17995* trigonometric function, sine: SIN. (line 6) 17996* trigonometric function, sine, inverse: ASIN. (line 6) 17997* trigonometric function, tangent: TAN. (line 6) 17998* trigonometric function, tangent, inverse: ATAN. (line 6) 17999* trigonometric function, tangent, inverse <1>: ATAN2. (line 6) 18000* TRIM: TRIM. (line 6) 18001* TTYNAM: TTYNAM. (line 6) 18002* type cast: TRANSFER. (line 6) 18003* UBOUND: UBOUND. (line 6) 18004* UCOBOUND: UCOBOUND. (line 6) 18005* UMASK: UMASK. (line 6) 18006* underflow: Error and Warning Options. 18007 (line 176) 18008* underscore: Code Gen Options. (line 54) 18009* underscore <1>: Code Gen Options. (line 111) 18010* UNLINK: UNLINK. (line 6) 18011* UNPACK: UNPACK. (line 6) 18012* unused dummy argument: Error and Warning Options. 18013 (line 187) 18014* unused parameter: Error and Warning Options. 18015 (line 191) 18016* 'USE, INTRINSIC' statement: Fortran 2003 status. (line 128) 18017* user id: GETUID. (line 6) 18018* 'VALUE' statement: Fortran 2003 status. (line 116) 18019* Varying length character strings: Varying Length Character Strings. 18020 (line 6) 18021* Varying length strings: Varying Length Character Strings. 18022 (line 6) 18023* vector product: DOT_PRODUCT. (line 6) 18024* VERIFY: VERIFY. (line 6) 18025* version of the compiler: COMPILER_VERSION. (line 6) 18026* 'VOLATILE': Volatile COMMON blocks. 18027 (line 6) 18028* 'VOLATILE' statement: Fortran 2003 status. (line 118) 18029* warning, C binding type: Error and Warning Options. 18030 (line 99) 18031* warnings, aliasing: Error and Warning Options. 18032 (line 69) 18033* warnings, alignment of 'COMMON' blocks: Error and Warning Options. 18034 (line 198) 18035* warnings, all: Error and Warning Options. 18036 (line 61) 18037* warnings, ampersand: Error and Warning Options. 18038 (line 86) 18039* warnings, array temporaries: Error and Warning Options. 18040 (line 94) 18041* warnings, character truncation: Error and Warning Options. 18042 (line 106) 18043* warnings, conversion: Error and Warning Options. 18044 (line 113) 18045* warnings, conversion <1>: Error and Warning Options. 18046 (line 117) 18047* warnings, extra: Error and Warning Options. 18048 (line 120) 18049* warnings, function elimination: Error and Warning Options. 18050 (line 204) 18051* warnings, implicit interface: Error and Warning Options. 18052 (line 125) 18053* warnings, implicit procedure: Error and Warning Options. 18054 (line 131) 18055* warnings, intrinsic: Error and Warning Options. 18056 (line 180) 18057* warnings, intrinsics of other standards: Error and Warning Options. 18058 (line 135) 18059* warnings, line truncation: Error and Warning Options. 18060 (line 109) 18061* warnings, non-standard intrinsics: Error and Warning Options. 18062 (line 135) 18063* warnings, 'q' exponent-letter: Error and Warning Options. 18064 (line 142) 18065* warnings, suppressing: Error and Warning Options. 18066 (line 6) 18067* warnings, suspicious code: Error and Warning Options. 18068 (line 146) 18069* warnings, tabs: Error and Warning Options. 18070 (line 168) 18071* warnings, to errors: Error and Warning Options. 18072 (line 237) 18073* warnings, underflow: Error and Warning Options. 18074 (line 176) 18075* warnings, unused dummy argument: Error and Warning Options. 18076 (line 187) 18077* warnings, unused parameter: Error and Warning Options. 18078 (line 191) 18079* write character, stream mode: FPUT. (line 6) 18080* write character, stream mode <1>: FPUTC. (line 6) 18081* XOR: XOR. (line 6) 18082* XOR reduction: PARITY. (line 6) 18083* ZABS: ABS. (line 6) 18084* ZCOS: COS. (line 6) 18085* zero bits: LEADZ. (line 6) 18086* zero bits <1>: TRAILZ. (line 6) 18087* ZEXP: EXP. (line 6) 18088* ZLOG: LOG. (line 6) 18089* ZSIN: SIN. (line 6) 18090* ZSQRT: SQRT. (line 6) 18091 18092 18093 18094Tag Table: 18095Node: Top1950 18096Node: Introduction3337 18097Node: About GNU Fortran4086 18098Node: GNU Fortran and GCC8075 18099Node: Preprocessing and conditional compilation10189 18100Node: GNU Fortran and G7711834 18101Node: Project Status12407 18102Node: Standards14853 18103Node: Varying Length Character Strings15863 18104Node: Invoking GNU Fortran16615 18105Node: Option Summary18338 18106Node: Fortran Dialect Options21750 18107Node: Preprocessing Options30416 18108Node: Error and Warning Options38657 18109Node: Debugging Options48854 18110Node: Directory Options52322 18111Node: Link Options53757 18112Node: Runtime Options54383 18113Node: Code Gen Options56290 18114Node: Environment Variables72497 18115Node: Runtime73102 18116Node: TMPDIR74202 18117Node: GFORTRAN_STDIN_UNIT74872 18118Node: GFORTRAN_STDOUT_UNIT75254 18119Node: GFORTRAN_STDERR_UNIT75655 18120Node: GFORTRAN_UNBUFFERED_ALL76057 18121Node: GFORTRAN_UNBUFFERED_PRECONNECTED76588 18122Node: GFORTRAN_SHOW_LOCUS77232 18123Node: GFORTRAN_OPTIONAL_PLUS77728 18124Node: GFORTRAN_DEFAULT_RECL78204 18125Node: GFORTRAN_LIST_SEPARATOR78692 18126Node: GFORTRAN_CONVERT_UNIT79301 18127Node: GFORTRAN_ERROR_BACKTRACE82156 18128Node: Fortran 2003 and 2008 status82713 18129Node: Fortran 2003 status82973 18130Node: Fortran 2008 status88199 18131Node: TS 29113 status93048 18132Node: Compiler Characteristics94025 18133Node: KIND Type Parameters94561 18134Node: Internal representation of LOGICAL variables95989 18135Node: Thread-safety of the runtime library96849 18136Node: Data consistency and durability98276 18137Node: Extensions101330 18138Node: Extensions implemented in GNU Fortran101935 18139Node: Old-style kind specifications103292 18140Node: Old-style variable initialization104394 18141Node: Extensions to namelist105706 18142Node: X format descriptor without count field108009 18143Node: Commas in FORMAT specifications108536 18144Node: Missing period in FORMAT specifications109053 18145Node: I/O item lists109615 18146Node: 'Q' exponent-letter110002 18147Node: BOZ literal constants110602 18148Node: Real array indices113183 18149Node: Unary operators113482 18150Node: Implicitly convert LOGICAL and INTEGER values113896 18151Node: Hollerith constants support114855 18152Node: Cray pointers116627 18153Node: CONVERT specifier122074 18154Node: OpenMP124069 18155Node: Argument list functions126318 18156Node: Extensions not implemented in GNU Fortran127923 18157Node: STRUCTURE and RECORD128872 18158Node: ENCODE and DECODE statements131309 18159Node: Variable FORMAT expressions132669 18160Node: Alternate complex function syntax133774 18161Node: Volatile COMMON blocks134324 18162Node: Mixed-Language Programming134801 18163Node: Interoperability with C135382 18164Node: Intrinsic Types136716 18165Node: Derived Types and struct137712 18166Node: Interoperable Global Variables139070 18167Node: Interoperable Subroutines and Functions140345 18168Node: Working with Pointers144139 18169Node: Further Interoperability of Fortran with C148615 18170Node: GNU Fortran Compiler Directives151969 18171Node: Non-Fortran Main Program155221 18172Node: _gfortran_set_args157409 18173Node: _gfortran_set_options158347 18174Node: _gfortran_set_convert161747 18175Node: _gfortran_set_record_marker162615 18176Node: _gfortran_set_fpe163425 18177Node: _gfortran_set_max_subrecord_length164623 18178Node: Naming and argument-passing conventions165546 18179Node: Naming conventions166265 18180Node: Argument passing conventions167737 18181Node: Intrinsic Procedures172231 18182Node: Introduction to Intrinsics187717 18183Node: ABORT190067 18184Node: ABS190812 18185Node: ACCESS192414 18186Node: ACHAR194344 18187Node: ACOS195548 18188Node: ACOSH196802 18189Node: ADJUSTL197797 18190Node: ADJUSTR198739 18191Node: AIMAG199687 18192Node: AINT201059 18193Node: ALARM202665 18194Node: ALL204297 18195Node: ALLOCATED206221 18196Node: AND207360 18197Node: ANINT208659 18198Node: ANY210156 18199Node: ASIN212082 18200Node: ASINH213325 18201Node: ASSOCIATED214330 18202Node: ATAN217341 18203Node: ATAN2218759 18204Node: ATANH220551 18205Node: ATOMIC_DEFINE221559 18206Node: ATOMIC_REF222635 18207Node: BACKTRACE223897 18208Node: BESSEL_J0224477 18209Node: BESSEL_J1225534 18210Node: BESSEL_JN226595 18211Node: BESSEL_Y0228420 18212Node: BESSEL_Y1229430 18213Node: BESSEL_YN230440 18214Node: BGE232271 18215Node: BGT232963 18216Node: BIT_SIZE233613 18217Node: BLE234435 18218Node: BLT235117 18219Node: BTEST235755 18220Node: C_ASSOCIATED236640 18221Node: C_F_POINTER237851 18222Node: C_F_PROCPOINTER239286 18223Node: C_FUNLOC240793 18224Node: C_LOC242164 18225Node: C_SIZEOF243443 18226Node: CEILING244856 18227Node: CHAR245864 18228Node: CHDIR247076 18229Node: CHMOD248250 18230Node: CMPLX250165 18231Node: COMMAND_ARGUMENT_COUNT251618 18232Node: COMPILER_OPTIONS252534 18233Node: COMPILER_VERSION253560 18234Node: COMPLEX254524 18235Node: CONJG255663 18236Node: COS256719 18237Node: COSH258143 18238Node: COUNT259325 18239Node: CPU_TIME261348 18240Node: CSHIFT262705 18241Node: CTIME264365 18242Node: DATE_AND_TIME265867 18243Node: DBLE268347 18244Node: DCMPLX269142 18245Node: DIGITS270324 18246Node: DIM271291 18247Node: DOT_PRODUCT272572 18248Node: DPROD274215 18249Node: DREAL275142 18250Node: DSHIFTL275808 18251Node: DSHIFTR277141 18252Node: DTIME278475 18253Node: EOSHIFT281290 18254Node: EPSILON283363 18255Node: ERF284090 18256Node: ERFC284871 18257Node: ERFC_SCALED285681 18258Node: ETIME286374 18259Node: EXECUTE_COMMAND_LINE288622 18260Node: EXIT291209 18261Node: EXP292085 18262Node: EXPONENT293336 18263Node: EXTENDS_TYPE_OF294098 18264Node: FDATE294954 18265Node: FGET296427 18266Node: FGETC298252 18267Node: FLOOR300058 18268Node: FLUSH301045 18269Node: FNUM302922 18270Node: FPUT303645 18271Node: FPUTC305277 18272Node: FRACTION307056 18273Node: FREE307958 18274Node: FSEEK308799 18275Node: FSTAT311103 18276Node: FTELL312188 18277Node: GAMMA313168 18278Node: GERROR314220 18279Node: GETARG314940 18280Node: GET_COMMAND316711 18281Node: GET_COMMAND_ARGUMENT318083 18282Node: GETCWD320131 18283Node: GETENV321111 18284Node: GET_ENVIRONMENT_VARIABLE322543 18285Node: GETGID324706 18286Node: GETLOG325243 18287Node: GETPID326105 18288Node: GETUID326835 18289Node: GMTIME327351 18290Node: HOSTNM328835 18291Node: HUGE329756 18292Node: HYPOT330478 18293Node: IACHAR331304 18294Node: IALL332472 18295Node: IAND333957 18296Node: IANY334944 18297Node: IARGC336438 18298Node: IBCLR337459 18299Node: IBITS338121 18300Node: IBSET339039 18301Node: ICHAR339696 18302Node: IDATE341866 18303Node: IEOR342896 18304Node: IERRNO343776 18305Node: IMAGE_INDEX344325 18306Node: INDEX intrinsic345353 18307Node: INT346879 18308Node: INT2348607 18309Node: INT8349375 18310Node: IOR350090 18311Node: IPARITY350946 18312Node: IRAND352478 18313Node: IS_IOSTAT_END353837 18314Node: IS_IOSTAT_EOR354936 18315Node: ISATTY356065 18316Node: ISHFT356848 18317Node: ISHFTC357831 18318Node: ISNAN359052 18319Node: ITIME359819 18320Node: KILL360847 18321Node: KIND361756 18322Node: LBOUND362602 18323Node: LCOBOUND363940 18324Node: LEADZ365075 18325Node: LEN365936 18326Node: LEN_TRIM367232 18327Node: LGE368220 18328Node: LGT369733 18329Node: LINK371211 18330Node: LLE372250 18331Node: LLT373750 18332Node: LNBLNK375221 18333Node: LOC375999 18334Node: LOG376731 18335Node: LOG10378079 18336Node: LOG_GAMMA379069 18337Node: LOGICAL380171 18338Node: LONG380983 18339Node: LSHIFT381741 18340Node: LSTAT382827 18341Node: LTIME384027 18342Node: MALLOC385433 18343Node: MASKL386895 18344Node: MASKR387662 18345Node: MATMUL388432 18346Node: MAX389530 18347Node: MAXEXPONENT391065 18348Node: MAXLOC391882 18349Node: MAXVAL393907 18350Node: MCLOCK395547 18351Node: MCLOCK8396570 18352Node: MERGE397800 18353Node: MERGE_BITS398552 18354Node: MIN399417 18355Node: MINEXPONENT400955 18356Node: MINLOC401586 18357Node: MINVAL403611 18358Node: MOD405264 18359Node: MODULO407033 18360Node: MOVE_ALLOC408336 18361Node: MVBITS409369 18362Node: NEAREST410435 18363Node: NEW_LINE411535 18364Node: NINT412308 18365Node: NORM2413729 18366Node: NOT414871 18367Node: NULL415455 18368Node: NUM_IMAGES416363 18369Node: OR417179 18370Node: PACK418465 18371Node: PARITY420473 18372Node: PERROR421694 18373Node: POPCNT422319 18374Node: POPPAR423191 18375Node: PRECISION424245 18376Node: PRESENT425132 18377Node: PRODUCT426244 18378Node: RADIX427778 18379Node: RAN428590 18380Node: RAND429046 18381Node: RANDOM_NUMBER430381 18382Node: RANDOM_SEED432110 18383Node: RANGE435941 18384Node: RANK436622 18385Node: REAL437403 18386Node: RENAME439200 18387Node: REPEAT440222 18388Node: RESHAPE440950 18389Node: RRSPACING442417 18390Node: RSHIFT443110 18391Node: SAME_TYPE_AS444250 18392Node: SCALE445082 18393Node: SCAN445863 18394Node: SECNDS447421 18395Node: SECOND448513 18396Node: SELECTED_CHAR_KIND449389 18397Node: SELECTED_INT_KIND450984 18398Node: SELECTED_REAL_KIND452161 18399Node: SET_EXPONENT454838 18400Node: SHAPE455835 18401Node: SHIFTA457259 18402Node: SHIFTL458223 18403Node: SHIFTR459060 18404Node: SIGN459898 18405Node: SIGNAL461124 18406Node: SIN462630 18407Node: SINH463672 18408Node: SIZE464684 18409Node: SIZEOF466003 18410Node: SLEEP467480 18411Node: SPACING468041 18412Node: SPREAD469055 18413Node: SQRT470206 18414Node: SRAND471538 18415Node: STAT472708 18416Node: STORAGE_SIZE475876 18417Node: SUM476755 18418Node: SYMLNK478247 18419Node: SYSTEM479382 18420Node: SYSTEM_CLOCK480637 18421Node: TAN483396 18422Node: TANH484384 18423Node: THIS_IMAGE485558 18424Node: TIME487058 18425Node: TIME8488183 18426Node: TINY489336 18427Node: TRAILZ489937 18428Node: TRANSFER490755 18429Node: TRANSPOSE492791 18430Node: TRIM493481 18431Node: TTYNAM494339 18432Node: UBOUND495257 18433Node: UCOBOUND496647 18434Node: UMASK497784 18435Node: UNLINK498466 18436Node: UNPACK499446 18437Node: VERIFY500741 18438Node: XOR502470 18439Node: Intrinsic Modules503843 18440Node: ISO_FORTRAN_ENV504086 18441Node: ISO_C_BINDING508254 18442Node: OpenMP Modules OMP_LIB and OMP_LIB_KINDS511986 18443Node: Contributing513489 18444Node: Contributors514343 18445Node: Projects515974 18446Node: Proposed Extensions516780 18447Node: Copying518790 18448Node: GNU Free Documentation License556336 18449Node: Funding581460 18450Node: Option Index583986 18451Node: Keyword Index599118 18452 18453End Tag Table 18454