Elements of FORTRAN |
1 |
![]() |
This compiler also conforms to the standards FIPS 69-1, BS 6832, and MIL-STD-1753. It provides an IEEE standard 754-1985 floating-point package.
On SPARC systems, it provides support for optimization exploiting features of SPARC V8, including the SuperSPARCTM implementation. These features are defined in the SPARC Architecture Manual: Version 8.
NAMELIST, DO WHILE, structures, records, unions, maps, and variable formats. Multiprocessor FORTRAN includes automatic and explicit loop parallelization.Sun FORTRAN 77 accepts many VMS extensions, so that programs originally written for VAX systems will port easily to Solaris.
--Even though they are not in the character set, most control characters are allowed as data. The exceptions are: Control A, Control B, Control C, which are not allowed as data. These characters can be entered into the program in other ways, such as with the char() function.
|
Symbolic constants Variables Arrays Structures Records Record fields |
Labeled commons Namelist groups Main programs Subroutines Functions Entry points |
The following restrictions apply:
ATAD = 1.0E-6 Atad = 1.0e-6 |
IF ( X .LT. ATAD ) GO TO 9 IF ( X .LT. A TAD ) GO TO 9 IF(X.LT.ATAD)GOTO9 |
X2
2X
Starts with a digit.
DELTA_TEMP
_DELTA_TEMP
Starts with an _ (reserved for the compiler).
Y$Dot
Y|Dot
There is an invalid character |.
Table 1-3 Sample Symbolic Names
Valid
Invalid
Reason
There are three types of subprograms: subroutines, functions, and block data subprograms. The subroutines and functions are called procedures, which are invoked from other procedures or from the main program. The block data subprograms are handled by the loader.
The nonexecutable statements specify attributes, such as type and size; determine arrangement or order; define initial data values; specify editing instructions; define statement functions; classify program units; and define entry points. In general, nonexecutable statements are completed before execution of the first executable statement.
You can format a source line in either of two ways:
(1 initial and 99 continuation). To change this number of lines, use the -Nln option.
Otherwise, by default, f77 ignores any characters after column 72.Example: Compile to allow extended lines:
demo% f77 -e prog.f |
Padding
Padding is significant in lines such as the two in the following DATA statement:
C 1 2 3 4 5 6 7 C23456789012345678901234567890123456789012345678901234567890123456789012 DATA SIXTYH/60H 1 / |
Comments and Blank Lines
A line with a c, C, *, d, D, or! in column one is a comment line, except that if the -xld option is set, then the lines starting with D or d are compiled as debug lines. The d, D, and! are nonstandard.
Directives
A directive passes information to a compiler in a special form of comment.
Directives are also called compiler pragmas. There are two kinds of directives:
Because it is a comment, a directive cannot be continued, but you can have many C$PRAGMA lines, one after the other, as needed.
If a comment satisfies the above syntax, it is expected to contain one or more directives recognized by the compiler; if it does not, a warning is issued.
The C() directive for a particular function must appear before the first reference to that function in each subprogram that contains such a reference. The recommended usage is:
EXTERNAL ABC, XYZ !$PRAGMA C(ABC, XYZ) |
The unroll Directive
The unroll directive requires that you specify sun after C$PRAGMA.
Example: To unroll loops two times:
C$PRAGMA SUN UNROLL=2 |
The
The WEAK Directive
WEAK directive defines a symbol to have less precedence than an earlier definition of the same symbol. This pragma is used mainly in sources files for building libraries. The linker does not produe an error message if it is unable to resolve a weak symbol.
C$PRAGMA WEAK (name1 [=name2]) |
WEAK (name1) defines name1 to be a weak symbol. The linker does not produce an error message if it does not find a definition for name1.WEAK (name1=name2) defines name1 to be a weak symbol and an alias for name2. Parallel Directives
A parallel directive is a special comment that directs the compiler to do something about parallelization. The following are the parallel directives: