JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2: Fortran User's Guide
search filter icon
search icon

Document Information

Preface

1.  Introduction

2.  Using Solaris Studio Fortran

3.  Fortran Compiler Options

4.  Solaris Studio Fortran Features and Differences

4.1 Source Language Features

4.1.1 Continuation Line Limits

4.1.2 Fixed-Form Source Lines

4.1.3 Tab Form

4.1.4 Source Form Assumed

4.1.4.1 Mixing Forms

4.1.4.2 Case

4.1.5 Limits and Defaults

4.2 Data Types

4.2.1 Boolean Type

4.2.1.1 Rules Governing Boolean Type

4.2.1.2 Alternate Forms of Boolean Constants

Octal

Hexadecimal

Hollerith

4.2.1.3 Alternate Contexts of Boolean Constants

4.2.2 Abbreviated Size Notation for Numeric Data Types

4.2.3 Size and Alignment of Data Types

4.3 Cray Pointers

4.3.1 Syntax

4.3.2 Purpose of Cray Pointers

4.3.3 Declaring Cray Pointers and Fortran 95 Pointers

4.3.4 Features of Cray Pointers

4.3.5 Restrictions on Cray Pointers

4.3.6 Restrictions on Cray Pointees

4.3.7 Usage of Cray Pointers

4.4 STRUCTURE and UNION (VAX Fortran)

4.5 Unsigned Integers

4.5.1 Arithmetic Expressions

4.5.2 Relational Expressions

4.5.3 Control Constructs

4.5.4 Input/Output Constructs

4.5.5 Intrinsic Functions

4.6 Fortran 200x Features

4.6.1 Interoperability with C Functions

4.6.2 IEEE Floating-Point Exception Handling

4.6.3 Command-Line Argument Intrinsics

4.6.4 PROTECTED Attribute

4.6.5 Fortran 2003 Asynchronous I/O

4.6.6 Extended ALLOCATABLE Attribute

4.6.7 VALUE Attribute

4.6.8 Fortran 2003 Stream I/O

4.6.9 Fortran 2003 Formatted I/O Features

4.6.10 Fortran 2003 IMPORT Statement

4.6.11 Fortran 2003 FLUSH I/O Statement

4.6.12 Fortran 2003 POINTER INTENT Feature

4.6.13 Fortran 2003 Enhanced Array Constructor

4.6.14 Miscellaneous Fortran 2003 and Fortran 2008 Features

4.7 Additional I/O Extensions

4.7.1 I/O Error Handling Routines

4.7.2 Variable Format Expressions

4.7.3 NAMELIST Input Format

4.7.4 Binary Unformatted I/O

4.7.5 Miscellaneous I/O Extensions

4.8 Directives

4.8.1 Form of Special f95 Directive Lines

4.8.1.1 Fixed-Form Source

4.8.1.2 Free-Form Source

4.8.2 FIXED and FREE Directives

4.8.2.1 Scope

4.8.2.2 Uses

4.8.2.3 Restrictions

4.8.3 Parallelization Directives

4.9 Module Files

4.9.1 Searching for Modules

4.9.2 The -use=list Option Flag

4.9.3 The fdumpmod Command

4.10 Intrinsics

4.11 Forward Compatibility

4.12 Mixing Languages

5.  FORTRAN 77 Compatibility: Migrating to Solaris Studio Fortran

A.  Runtime Error Messages

B.  Features Release History

C.  Fortran Directives Summary

Index

4.6 Fortran 200x Features

A number of new features in the Fortran 2003 standard appear in this release of the Solaris Studio Fortran compiler. For details, refer to the Fortran 2003 standard. Also included are some features proposed in the Fortran 2008 draft standard. For details on these, see the appropriate draft publications.

4.6.1 Interoperability with C Functions

The new standard for Fortran provides:

The ISO_C_BINDING module provides access to named constants that are kind type parameters representing data that is compatible with C types.

The standard also introduces the BIND(C) attribute. A Fortran derived type is interoperable with C if it has the BIND attribute.

This release of the Fortran compiler implements these features as described in the chapter 15 of the standard. Fortran also provides facilities for defining derived types and enumerations that correspond to C types, as described in chapter 4 of the standard.

4.6.2 IEEE Floating-Point Exception Handling

New intrinsic modules IEEE_ARITHMETIC, and IEEE_FEATURES provide support for exceptions and IEEE arithmetic in the Fortran language. Full support of these features is provided by:

USE, INTRINSIC :: IEEE_ARITHMETIC

USE, INTRINSIC :: IEEE_FEATURES

The INTRINSIC keyword is new in Fortran 2003.These modules define a set of derived types, constants, rounding modes, inquiry functions, elemental functions, kind functions, and elemental and non-elemental subroutines. The details are contained in Chapter 14 of the Fortran 2003 standard.

4.6.3 Command-Line Argument Intrinsics

The Fortran 2003 standard introduces three new intrinsics for processing command-line arguments and environment variables. These are:

4.6.4 PROTECTED Attribute

The Fortran compiler now accepts the Fortran 2003 PROTECTED attribute. PROTECTED imposes limitations on the usage of module entities. Objects with the PROTECTED attribute are only definable within the module that declares them.

4.6.5 Fortran 2003 Asynchronous I/O

The compiler recognizes the ASYNCHRONOUS specifier on I/O statements:

ASYNCHRONOUS=[’YES’ | ’NO’]

This syntax is as proposed in the Fortran 2003 standard, Chapter 9. In combination with the WAIT statement it allows the programmer to specify I/O processes that may be overlapped with computation. While the compiler recognizes ASYNCHRONOUS=’YES’, the standard does not require actual asynchronous I/O. In this release of the compiler, I/O is always synchronous.

4.6.6 Extended ALLOCATABLE Attribute

Fortran 2003 extends the data entities allowed for the ALLOCATABLE attribute. Previously this attribute was limited to locally stored array variables. It is now allowed with:

Allocatable entities remain forbidden in all places where they may be storage-associated: COMMON blocks and EQUIVALENCE statements. Allocatable array components may appear in SEQUENCE types, but objects of such types are then prohibited from COMMON and EQUIVALENCE.

4.6.7 VALUE Attribute

The f95 compiler accepts the Fortran 2003 VALUE type declaration attribute.

Specifying a subprogram dummy input argument with this attribute indicates that the actual argument is passed “by value”. The following example demonstrates the use of the VALUE attribute with a C main program calling a Fortran subprogram with a literal value as an argument:

C code:
#include <stdlib.h>
int main(int ac, char *av[])
{
    to_fortran(2);
}

Fortran code:
       subroutine to_fortran(i)
       integer, value :: i
       print *, i
       end

4.6.8 Fortran 2003 Stream I/O

The Fortran 2003 standard defines a new “stream” I/O scheme. Stream I/O access treats a data file as a continuous sequence of bytes, addressable by a positive integer starting from 1. The data file can be connected for either formatted or unformatted access.

Declare a stream I/O file with the ACCESS=’STREAM’ specifier on the OPEN statement. File positioning to a byte address requires a POS=scalar_integer_expression specifier on a READ or WRITE statement. The INQUIRE statement accepts ACCESS=’STREAM’, a specifier STREAM=scalar_character_variable, and POS=scalar_integer_variable.

4.6.9 Fortran 2003 Formatted I/O Features

Three new Fortran 2003 formatted I/O specifiers have been implemented in f95. They may appear on OPEN, READ, WRITE, PRINT, and INQUIRE statements:

When used in INQUIRE statements, these specifiers declare a character variable for returning the current values.

New edit descriptors DP, DC, RP, and RC change the defaults within a single FORMAT statement to decimal point, decimal comma, processor-defined rounding, and compatible rounding respectively. For example:

WRITE(*,’(I5,DC,F10.3)’) N, W

prints a comma instead of a period in the F10.3 output item.

See also the -iorounding compiler command-line option for changing the floating-point rounding modes on formatted I/O. (3.4.45 -iorounding[={compatible|processor-defined}].)

4.6.10 Fortran 2003 IMPORT Statement

The IMPORT statement specified entities in the host scoping unit that are accessible by host association. It is allowed only in an interface body.

4.6.11 Fortran 2003 FLUSH I/O Statement

The f95 compiler accepts the Fortran 2003 FLUSH statement. The FLUSH statement makes data written to an external file available to other processes, or causes data placed in an external file by means other than Fortran to be available to a READ statement.

4.6.12 Fortran 2003 POINTER INTENT Feature

The Fortran compiler now supports the INTENT attribute for POINTER dummy arguments: INTENT(IN), INTENT(OUT), or INTENT(INOUT) may be specified for pointer dummies.

For example,

subroutine sub(P)
integer, pointer, intent(in) :: p
...

end

The INTENT attribute for pointers applies to the pointer and not what it points to, so for INTENT(IN) pointers, the following are illegal because they modify the pointer:

 p => t
 allocate(p)
 deallocate(p)

But the following is legal for INTENT(IN) pointers, because it modifies the pointee:

 p = 400

4.6.13 Fortran 2003 Enhanced Array Constructor

Use of square brackets in place of (/ and /) in array constructors is allowed:

X = [ 3.2, 4.01, 6.5 ]

The Fortran 2003 standard allows the use of square brackets as array constructors. This can conflict with interval constants. When the square brackets are used without the -xia option (or similar options to enable interval arithmetic) they are treated as array constructors. When -xia option is used, they are treated as constants. Interval users should continue using (/ and /) array constructors to avoid compilation errors.

4.6.14 Miscellaneous Fortran 2003 and Fortran 2008 Features

For details on the Fortran 2003 features listed below, refer to the published Fortran 2003 Standard. Fortran 2008 features are described in published Fortran 200x draft documents.