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.2 Data Types

This section describes features and extensions to the Fortran data types.

4.2.1 Boolean Type

f95 supports constants and expressions of Boolean type. However, there are no Boolean variables or arrays, and there is no Boolean type statement.

4.2.1.1 Rules Governing Boolean Type
4.2.1.2 Alternate Forms of Boolean Constants

f95 allows a Boolean constant (octal, hexadecimal, or Hollerith) in the following alternate forms (no binary). Variables cannot be declared Boolean. Standard Fortran does not allow these forms.

Octal

ddddddB, where d is any octal digit

Within an I/O format specification, the letter B indicates binary digits; elsewhere it indicates octal digits.

Hexadecimal

X’ddd or X"ddd", where d is any hexadecimal digit

Hollerith

Accepted forms for Hollerith data are:

nH
’H
""H
nL
’L
""L
nR
’R
""R

Above, “…” is a string of characters and n is the character count.

Examples: Octal and hexadecimal constants.

Boolean Constant
Internal Octal for 32-bit Word
0B
00000000000
77740B
00000077740
X"ABE"
00000005276
X"-340"
37777776300
X’1 2 3’
00000000443
X’FFFFFFFFFFFFFFFF’
37777777777

Examples: Octal and hexadecimal in assignment statements.

i = 1357B
j = X"28FF"
k = X’-5A’

Use of an octal or hexadecimal constant in an arithmetic expression can produce undefined results and do not generate syntax errors.

4.2.1.3 Alternate Contexts of Boolean Constants

f95 allows BOZ constants in the places other than DATA statements.

Bbbb
Oooo
Zzzz
B"bbb"
O"ooo"
Z"zzz"

If these are assigned to a real variable, no type conversion occurs.

Standard Fortran allows these only in DATA statements.

4.2.2 Abbreviated Size Notation for Numeric Data Types

f95 allows the following nonstandard type declaration forms in declaration statements, function statements, and IMPLICIT statements. The form in column one is nonstandard Fortran, though in common use. The kind numbers in column two can vary by vendor.

Table 4-2 Size Notation for Numeric Data Types

Nonstandard
Declarator
Short Form
Meaning
INTEGER*1
INTEGER(KIND=1)
INTEGER(1)
One-byte signed integers
INTEGER*2
INTEGER(KIND=2)
INTEGER(2)
Two-byte signed integers
INTEGER*4
INTEGER(KIND=4)
INTEGER(4)
Four-byte signed integers
LOGICAL*1
LOGICAL(KIND=1)
LOGICAL(1)
One-byte logicals
LOGICAL*2
LOGICAL(KIND=2)
LOGICAL(2)
Two-byte logicals
LOGICAL*4
LOGICAL(KIND=4)
LOGICAL(4)
Four-byte logicals
REAL*4
REAL(KIND=4)
REAL(4)
IEEE single-precision four-byte floating-point
REAL*8
REAL(KIND=8)
REAL(8)
IEEE double-precision eight-byte floating-point
REAL*16
REAL(KIND=16)
REAL(16)
IEEE quad-precision sixteen-byte floating-point
COMPLEX*8
COMPLEX(KIND=4)
COMPLEX(4)
Single-precision complex (four bytes each part)
COMPLEX*16
COMPLEX(KIND=8)
COMPLEX(8)
Double-precision complex (eight bytes each part)
COMPLEX*32
COMPLEX(KIND=16)
COMPLEX(16)
Quad-precision complex (sixteen bytes each part)

4.2.3 Size and Alignment of Data Types

Storage and alignment are always given in bytes. Values that can fit into a single byte are byte-aligned.

The size and alignment of types depends on various compiler options and platforms, and how variables are declared. The default maximum alignment in COMMON blocks is to 4-byte boundaries.

Default data alignment and storage allocation can be changed by compiling with special options, such as -aligncommon, -f, -dalign, -dbl_align_all,- xmemalign,, and- xtypemap. The default descriptions in this manual assume that these options are not in force.

There is additional information in the Fortran Programming Guide regarding special cases of data types and alignment on certain platforms.

The following table summarizes the default size and alignment, ignoring other aspects of types and options.

Table 4-3 Default Data Sizes and Alignments (in Bytes)

Fortran Data Type
Size
DefaultAlignment
Alignment inCOMMON
BYTE X

CHARACTER X

CHARACTER*n X

1

1

n

1

1

1

1

1

1

COMPLEX X

COMPLEX*8 X

DOUBLE COMPLEX X

COMPLEX*16 X

COMPLEX*32 X

8

8

16

16

32

4

4

8

8

8/16

4

4

4

4

4

DOUBLE PRECISION X

REAL X

REAL*4 X

REAL*8 X

REAL*16 X

8

4

4

8

16

8

4

4

8

8/16

4

4

4

4

4

INTEGER X

INTEGER*2 X

INTEGER*4 X

INTEGER*8 X

4

2

4

8

4

2

4

8

4

2

4

4

LOGICAL X

LOGICAL*1 X

LOGICAL*2 X

LOGICAL*4 X

LOGICAL*8 X

4

1

2

4

8

4

1

2

4

8

4

1

2

4

4

Note the following:

Options -f or -dalign force alignment of all 8, 16, or 32-byte data onto 8-byte boundaries. Option -dbl_align_all causes all data to be aligned on 8-byte boundaries. Programs that depend on the use of these options may not be portable.