Miscellaneous Fortran Specific Options
Descriptions of miscellaneous Fortran specific options.
--
The -- symbol signifies the end of options. After this symbol, specify files to be processed. This symbol is optional. It may be useful if the input file names begin with one or more dash (-) characters.
-A module_name[, module_name] ...
The -A module_name , module_name ... option directs the compiler to behave as if a USE module_name statement was entered for each module_name in the Fortran source code. The USE statements are entered in every program unit and interface body in the source file being compiled.
-b bin_obj_file
The -b bin_obj_file option disables the link step and saves the binary object file version of the program in bin_obj_file.
Only one input file is allowed when the -b bin_obj_file option is specified. If there is more than one input file, use the -c option to disable the link step and save the binary files to their default file names. If only one input file is processed and neither the -b nor the -c option is specified, the binary version of the program is not saved after the link is completed.
If both the -b bin_obj_file and -c options are specified on the ftn command line, the link step is disabled and the binary object file is written to the name specified as the argument to the -b bin_obj_file option. For more information about the -c option, see -c.
By default, the binary file is saved in file.o, where file is the name of the source file and .o is the suffix used.
-d disable_opt and -e enable_opt
The -d disable and -e enable options disable or enable compiling options. To specify more than one compiling option, enter the options without separators between them; for example, -eaf. The Compiling Options table below shows the arguments to use for disable or enable.
| args | Action, if enabled |
|---|---|
| 0 | Initializes all undefined local stack, static, and heap variables to 0. If a user variable is of type character, it is initialized to NUL. If a user variable is type logical, it is initialized to false. The stack variables are initialized upon each execution of the procedure. Enabling this option can help identify problems caused by using uninitialized numeric and logical variables. When used in combination with -ei, Real and Complex variables are initialized to signaling NaNs, while all other typed objects are initialized to 0. Objects in common blocks will be initialized if the common block is declared within a BLOCKDATA program unit compiled with this option. Default: disabled |
| a | Aborts compilation after encountering the first error. Default: disabled |
| A | Treat all module variables as PUBLIC. Does not override explicit PRIVATE statements or attributes. Disabling this option has the effect of including a PRIVATE statement in the specification part of the module. Default: enabled |
| b | If enabled, issue a warning message rather than an error message when the compiler detects a call to a procedure with one or more dummy arguments having the TARGET, VOLATILE or ASYNCHRONOUS attribute and there is not an explicit interface definition. Default: disabled |
| B | Generates binary output. If disabled, inhibits all optimization and allows only syntactic and semantic checking. Default: enabled |
| c | Interface checking: use Cray's system modules to check library calls in a compilation. If there is a procedure with the same name as one in the library, errors will be received because the compiler does not skip user-specified procedures when it performs the checks. Default: disabled |
| C | Enable/disable some types of standard call site checking. The current Fortran standard requires that the number and types of arguments must agree between the caller and callee. These constraints are enforced in cases where the compiler can detect them, however, specifying -dC disables some of this error checking, which may be necessary in order to get some older Fortran codes to compile. If error checking is disabled, unexpected compile-time or run time results may occur. The compiler by default attempts to detect situations in which an interface block should be specified but is not. Specifying -dC disables this type of checking as well. Default: enabled |
| d | Controls a column-oriented debugging feature when using fixed source form. When the option is enabled, the compiler replaces the D or d characters in column 1 of the source with a blank and treats the entire line as a valid source line. This feature can be useful, for example, during debugging to insert PRINT statements. When disabled, a D or d character in column 1 is treated as a comment character. Default: disabled |
| D | The -eD option enables all debugging options. This option is equivalent to specifying the -G0 with the -m2, -r1, and -R bcdsp options. See also -ed. Default: disabled |
| e | Enable/disable masking expression support for non-integer type operands. This allows masking expressions to be evaluated without type conversion. For example, with this enabled, will be evaluated as a bitwise or and the assignment will occur without type conversion. By default, the compiler will turn .or. into the IOR intrinsic and type conversion will occur when the value is assigned to the real_variable. This option may not be supported in all situations because of new compiler optimization requirements.Default: disabled |
| E | The -eE option enables existing declarations to duplicate the declarations contained in a used module. Therefore, there is no need to modify the older code by removing the existing declarations. Because the declarations are not removed, the associated objects will duplicate declarations already in the code, which is not standard. Existing declarations of a procedure must match the interface definitions in the module; otherwise an error is generated. Only existing declarations that declare the function name or generic name in an EXTERNAL or type statement are allowable under this option. This example illustrates some of the acceptable types of existing declarations. Program older contains the older code, while module m contains the interfaces to check. Default: disabled |
| f | Turns .mod files into lowercase names for makefile flexibility. Default: disabled |
| F | Controls preprocessor expansion of macros in Fortran source lines. Default: enabled |
| g | Allows branching into the code block for a DO or DO WHILE construct. Historically, codes used branches out of and into DO constructs. Fortran standards prohibit branching into a DO construct from outside of that construct. By default, the Cray Fortran compiler will issue an error for this situation. Cray does not recommend branching into a DO construct, but if -eg is specified, the code will compile. Default: disabled |
| h | Enables support for 8-bit and 16-bit INTEGER and LOGICAL types that use explicit kind or star values. By default (-eh), data objects declared as INTEGER(kind=1) or LOGICAL(kind=1) are 8 bits long, and objects declared as INTEGER(kind=2) or LOGICAL(kind=2) are 16 bits long. When this option is disabled (-dh), data objects declared as INTEGER(kind=1), INTEGER(kind=2), LOGICAL(kind=1), or LOGICAL(kind=2) are 32 bits long. Vectorization of 8- and 16-bit objects is deferred. Default: enabled |
| I | Treats all variables as if an IMPLICIT NONE statement had been specified. Does not override any IMPLICIT statements or explicit type statements. All variables must be typed. Default: disabled |
| i | Initializes all undefined local stack, static, and heap variables of type REAL or COMPLEX to an invalid value (signaling NaN). Stack variables are initialized upon each execution of the procedure. Objects in common blocks will be initialized if the common block is declared within a BLOCKDATA program unit compiled with this option. Default: disabled |
| j | Executes DO loops at least once. Default: disabled |
| m | When this option is enabled, the compiler creates .mod files to hold module information for future compiles. When it is disabled, and a module is compiled, the compiler deletes any existing MODULENAME.mod files it finds in the output directory before creating new module information in the .o file. By default, module files are written to the current working directory. Use the -J dir_name option to specify an alternate output directory for .mod files only. For more information about the -J dir_name option, -J dir_name, below. Whether this option is enabled or disabled, the search order for satisfying modules references in USE statements is as follows: The current working directory. Any directories or files specified with the -p option. Any directories specified with the -I option. Any directories or files specified with the FTN_MODULE_PATH environment variable. When searching within a directory, the compiler first checks all .mod files, then the .o files, and then the .a files. The compiler creates modules through the MODULE statement. A module is referenced with the USE statement. All .mod files are named modulename.mod, where modulename is the name of the module specified in the MODULE or USE statement. Default: disabled |
| n | Generates messages to note all nonstandard Fortran usage. Default: disabled |
| N | -eN is the same as -en, except that the messages are ERROR level. If -dN is specified, ANSI messages are not generated. This is the same as -dn. If multiple -en, -dn, -eN, or -dN options are specified, the last one encountered takes precedence. Default: disabled |
| o | Display to stderr the optimization options used by the compiler for this compilation. Default: disabled |
| p | Controls double precision type. This option can only be enabled when the default data size is 64 bits (-s default64 or -s real64). When -s default64 or -s real64 is specified, and double precision arithmetic is disabled, DOUBLE PRECISION variables and constants specified with the D exponent are converted to default real type (64-bit). If double precision is enabled (-ep), they are handled as a double precision type (128-bit). Similarly when the -s default64 or -s real64 option is used, variables declared on a DOUBLE COMPLEX statement and complex constants specified with the D exponent are mapped to the complex type in which each part has a default real type, so the complex variable is 128-bit. If double precision is enabled (-ep), each part has double precision type, so the double complex variable is 256-bit. |
| P | Performs source preprocessing on Fortran source files, but does not compile (see sourcefile Suffix under for valid file extensions). When specified, source code is included by #include directives but not by Fortran INCLUDE lines. Generates file.i, which contains the source code after the preprocessing has been performed and the effects have been applied to the source program. For more information about source preprocessing, see Source Preprocessing. Default: disabled |
| q | Aborts compilation if 100 or more errors are generated. Default: enabled |
| Q | Controls whether the compiler accepts variable names that begin with a leading underscore (_) character. For example, when Q is enabled, the compiler accepts _ANT as a variable name. Enabling this option can cause collisions with system name space, such library entry point names. Default: disabled |
| R | Compiles all functions and subroutines as if they had been defined with the RECURSIVE attribute. Default: disabled |
| s | Scales the values of the count and count_rate arguments for the SYSTEM_CLOCK intrinsic function down by a factor of 2 **14 (16384) if the storage size of the value of each of the count and count-rate argumens is 32 bits. Otherwise, no scaling occurs. Default: enabled |
| S | Generates assembly language output and saves it in file.s. Default: disabled |
| T | Controls preprocessing of Fortran source files. When enabled, source preprocessing is performed. Macro expansion within Fortran source lines is enabled but can be controlled by the -e/d
F command line option. When disabled, -dT, preprocessing of the Fortran source file is not performed, even for files with upper case suffixes, like file.F90. Default: When not specified, default is to honor the case of the file name suffix, and other preprocessing options such as -e/d Z -e/d P and -e/d F |
| v | Allocates variables to static storage. These variables are treated as if they had appeared in a SAVE statement. The following types of variables are not allocated to static storage: automatic variables (explicitly or implicitly stated), variables declared with the AUTOMATIC attribute, variables allocated in an ALLOCATE statement, and local variables in explicit recursive procedures. Variables with the ALLOCATABLE attribute remain allocated on procedure exit, unless explicitly deallocated, but they are not allocated in static memory. Variables in explicit recursive procedures consist of those in functions, in subroutines, and in internal procedures within functions and subroutines that have been defined with the RECURSIVE attribute. The STACK compiler directive overrides -ev; for more information about this compiler directive, see STACK.Default: disabled |
| w | Enables support for automatic memory allocation for allocatable variables and arrays that are on the left hand side of intrinsic assignment statements. Using this option may degrade run time performance, even when automatic memory allocation is not needed. It can affect optimizations for a code region containing an assignment to allocatable variables or arrays; for example, by preventing loop fusion for multiple array syntax assignment statements with the same shape. Default: enabled |
| X | If a module variable has initializers, implicit or explicit, and the variable has greater than 10,000 elements to be initialized, optionally create a new module procedure to do the initialization at run time before MAIN is called. Enabling this option may significantly reduce compile time and reduce the size of the executable for some code, while increasing execution time. If performance is the only issue, disable this option. Default : enabled |
| z | Initialize all memory allocated by Fortran ALLOCATE statements to zero. This option applies only for the current source file and should be specified for each source file compilation where this behavior is desired. Default: disabled |
| Z | Performs source preprocessing and compilation on Fortran source files (see sourcefile Suffix for valid file extensions). When specified, source code is included by #include directives and by Fortran INCLUDE lines. Generates file.i, which contains the source code after the preprocessing has been performed and the effects applied to the source program. For more information about source preprocessing, see Source Preprocessing. Default: disabled |
-F
The -F option is obsolete and is supported for compatibility with legacy make files. Macro expansion is now enabled by default. To disable macro expansion, use the -dF option.
For more information about source preprocessing, see Source Preprocessing.
-f source_form
The -f source_form option specifies whether the Fortran source file is written in fixed source form or free source form. For source_form, enter free or fixed. The source_form specified here overrides any source form implied by the source file suffix. A FIXED or FREE directive specified in the source code overrides this option (see FREE and FIXED).
The default source form is fixed for input files that have the .f, .F, .for, or .FOR suffix. The default source form is free for input files that have the .f90, .F90, .f95, .F95, .f03, .F03, .f08, .F08, .ftn, or .FTN suffix. Note that the Fortran standard has declared fixed source form to be obsolescent.
If the file has a .F, .FOR, .F90, .F95, .F03, .F08, or .FTN suffix, the source preprocessor is invoked. See Source Preprocessing about preprocessing.
-h byteswapio
The -h byteswapio option forces byte-swapping from big-endian to little-endian (or visa versa) of all input and output files for direct and sequential unformatted I/O.
REAL(KIND=16) and COMPLEX(KIND=16) are not supported.
-h [no]contiguous
Default: -h nocontiguous
The -hcontiguous option declares that every assumed-shape array and array pointer target is contiguous, whether or not they have a CONTIGOUS keyword, potentially increasing the range of permitted compiler optimizations. By default, the compiler does not assume that all array pointers are pointers associated with contiguous targets or that all assumed shape arrays are contiguous and there is no way to verify this at compile time.
Use with caution. This additional level of compiler optimization is safe when the memory objects occupy contiguous blocks of memory. Also, if there is potential for hidden dependencies between the memory locations which the pointers are referring to, then do not use this option.
-h [no]contiguous_assumed_shape
Default: nocontiguous_assumed_shape
If contiguous_assumed_shape is specified, all assumed-shape dummy arguments are implicitly marked with the CONTIGUOUS attribute.
-h [no]fp_trap
Default: fp_trap, if traps are enabled using the -K trap option, or if -Ofp[0,1] is in effect. Otherwise, the default is nofp_trap.
Controls whether the compiler generates code that is compatible with floating-point traps.
-h [no]func_trace
Default: nofunc_trace
__pat_tp_func_entry
__pat_tp_func_returnThese are resolved by CrayPat when the program is instrumented using the pat_build command. When the instrumented program is executed and it encounters either of these entry points, CrayPat captures the address of the current function and its return address.
-h [no]second_underscore
Default: -h nosecond_underscore
The -h [no]second_underscore option controls the way in which external names are generated. By default, the compiler generates external names in lower case and will add one trailing underscore (_). This behavior matches the PGI Fortran compiler's external behavior. If -h second_underscore is specified, the compiler adds a second trailing underscore if the original external name has any underscores in it. This behavior matches the GNU compiler's external naming behavior.
-h page_align_allocate
The -h page_align_allocate option directs the compiler to force allocations of arrays larger than the memory page size to be aligned on a page boundary. This option affects only the ALLOCATE statements of the current source file; therefore it must be specified for each source file where this behavior is desired. Using this option can improve DIRECTIO performance.
-J dir_name
The -J dir_name option specifies the directory to which file.mod files are written when the -e m option is specified on the command line. By default, module files are written to the current working directory.
The compiler will automatically search the dir_name directory for modules to satisfy USE statements. An error is issued if the -em option is not specified when the -J dir_name is used.
-N col
The -N col option specifies the line width for fixed- and free-format source lines. The value used for col specifies the maximum number of columns per line.
For free form sources, col can be set to 132, 255, or 1023.
For fixed form sources, col can be set to 72, 80, 132, 255, or 1023.
Characters in columns beyond the col specification are ignored.
By default, lines are 72 characters wide for fixed-format sources and 255 characters wide for free-form sources.
-p module_site [,module_site]
The -p module_site option tells the compiler where to look for Fortran modules to satisfy USE statements. The module_site argument specifies the name of a file or directory to search for modules. The module_site specified can be a .mod file, .o (object) file, .a (archive) file, or a directory.
By default, module files are written to the current working directory. Alternatively, use the -J dir_name option during compilation to specify an alternate output directory for .mod files only. The compiler will search for modules stored in the directories specified using the -J dir_name option for the current compilation automatically; there is no need to use the -p option explicitly to make the compiler do this. For more information, see -J dir_name.
- The current working directory (or -J dir_name directory, if specified).
- Any directories or files specified with the -p option.
- Any directories with the -I option.
- Any directories or files specified with the FTN_MODULE_PATH environment variable.
When searching within a directory, the compiler first searches the .mod files, then the .o files, then the .a files, and then the directories, in the order specified.
File name substitution (such as *.o) is not allowed. If the path name begins with a slash (/), the name is assumed to be an absolute path name. Otherwise, it is assumed to be a path name relative to the working directory. Specify multiple module_site locations with the -p option either by separating them with commas or by using a separate -p argument for each module_site. There is no limit on the number of -p options to be specified.
Cray provides some modules as part of the Cray Fortran Compiler Programming Environment. These are referred to as system modules. The system files containing these modules are searched last.
% ftn -p steve.o -p mike.o joe.f
Assume that steve.o contains a module called Rock and mike.o contains a module called Stone. A reference to use Rock in joe.f causes the compiler to use Rock from steve.o. A reference to Stone in joe.f causes the compiler to use Stone from mike.o.
% ftn -p murphy.o -p molly.a prog.f
programs
/ | \
tests one.f two.f
|
use_it.fMODULE one
INTEGER i
END MODULEMODULE two
INTEGER j
END MODULEPROGRAM demo
USE one
USE two
. . .
END PROGRAM% ftn -p programs programs/tests/use_it.f
MODULE split
INTEGER k
REAL a
END MODULE
PROGRAM demopr
USE split
INTEGER j
j = 3
k = 1
a = 2.0
CALL suba(j)
PRINT *, 'j=', j
PRINT *, 'k=', k
PRINT *, 'a=', a
ENDSUBROUTINE suba(1)
USE split
INTEGER 1
1 = 4
k = 5
CALL subb (1)
RETURN
END
SUBROUTINE subb(m)
USE split
INTEGER m
m = 6
a = 7.0
RETURN
END% ftn -p progone.o progone.f progtwo.f
When the -e m option is in effect, use the -p module_site option to specify one or more directories that contain module files rather than specifying every individual module file name.
-Q path
The -Q path option specifies the directory that will contain all saved nontemporary files from this compilation (for example, all .o and .mod files). Specific file types (like .o files) are saved to a different directory if the -b, -J, -o, or -eS option is specified.
current_dir
----------------------
| | |
| | |
| | |
bin_out mod_out all_out% ftn -b x.o -em x.f90% ftn -Q all_out -em -b x.o x.f90% ftn -Q all_out -b bin_out/x.o -em x.f90% ftn -Q all_out -J mod_out x.f90-s size
The -s size option allows the modification of the sizes of variables, literal constants, and intrinsic function results declared as type REAL, INTEGER, LOGICAL, COMPLEX, DOUBLE COMPLEX, or DOUBLE PRECISION. Use one of the following values for size:
| size | Action |
|---|---|
byte_pointer | (Default) Applies a byte scaling factor to integers used in pointer arithmetic involving Cray pointers. That is, Cray pointers are moved on byte instead of word boundaries. Pointer arithmetic scaling is explained in Pointer Scaling Factor. |
default32 | (Default) Adjusts the data size of default types as follows:
|
default64 | Adjust the data size of default types as follows:
|
integer32 | (Default) Adjusts the default data size of default integers and logicals to 32 bits. |
integer64 | Adjusts the default data size of default integers and logicals to 64 bits. |
real32 | (Default) Adjusts the default data size of default real types as follows:
|
real64 | Adjusts the default data size of default real types as follows:
|
word_pointer | Applies a word scaling factor to integers used in pointer arithmetic involving Cray pointers. That is, Cray pointers are moved on word instead of byte boundaries. Pointer arithmetic scaling is explained later in Pointer Scaling Factor. |
The default data size options (for example, -s default64) option do not affect the size of explicitly declared data (for example, REAL(KIND=4) X).
REAL(KIND=16) and COMPLEX(KIND=16) support 128-bit floating point and 256-bit complex types, sometimes referred to as quad-precision. See 128-Bit Precision.
Different Default Data Size Options on the Command Line
% ftn -s default64 -s integer32 ...Program test
IMPLICIT NONE
real r
integer i
common /blk/ r(10), i(10)
integer overlay(10)
equivalence (overlay, r)
call clear(overlay)
call clear(i)
contains
subroutine clear(i)
integer, dimension (10) :: i
i = 0
end subroutine
end program testThe above program sets only the first 10 32-bit words of array r to zero. It should instead set 10 64-bit words to zero.
Pointer Scaling Factor
Cray_ptr = Cray_ptr + integer_value
as
Cray_ptr = Cray_ptr + (integer_value * scaling_factor)
The scaling factor is dependent on the size of the default integer and which scaling option (-s byte_pointer or -s word_pointer) is enabled.
| Scaling Options | Default Integer Size | Scaling Factor |
|---|---|---|
| -s byte_pointer | 32 or 64 bits | 1 |
| -s word_pointer and -s default32 enabled | 32 bits | 4 |
| -s word_pointer and -s default64 enabled | 64 bits | 8 |
pointer (ptr, ptee) !Cray pointer
ptr = ptr + iptr = ptr + (4*i)ptr = ptr + (8*i)-T
The -T option disables the compiler but displays all options currently in effect. The Cray Fortran compiler generates information identical to that generated when the -v option is specified on the command line; when -T is specified, however, no processing is performed. When this option is specified, output is written to the standard error file (stderr).