Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

3.4.74 –pad[=p]

Insert padding for efficient use of cache.

This option inserts padding between arrays or character variables, if they are static local and not initialized, or if they are in common blocks. The extra padding positions the data to make better use of cache. In either case, the arrays or character variables can not be equivalenced.

p, if present, must be either %none or either (or both) local or common:

local
Add padding between adjacent local variables.
common
Add padding between variables in common blocks.
%none
Do not add padding. (Compiler default.)

If both local and common are specified, they can appear in any order.

Defaults for -pad:

  • The compiler does no padding by default.

  • Specifying -pad, but without a value is equivalent to -pad=local,common.

The -pad[=p] option applies to items that satisfy the following criteria:

  • The items are arrays or character variables

  • The items are static local or in common blocks

For a definition of local or static variables, see –stackvar.

The program must conform to the following restrictions:

  • Neither the arrays nor the character strings are equivalenced

  • If -pad=common is specified for compiling a file that references a common block, it must be specified when compiling all files that reference that common block. The option changes the spacing of variables within the common block. If one program unit is compiled with the option and another is not, references to what should be the same location within the common block might reference different locations.

  • If -pad=common is specified, the declarations of common block variables in different program units must be the same except for the names of the variables.The amount of padding inserted between variables in a common block depends on the declarations of those variables. If the variables differ in size or rank in different program units, even within the same file, the locations of the variables might not be the same.

  • If -pad=common is specified, EQUIVALENCE declarations involving common block variables are flagged with a warning message and the block is not padded.

  • Avoid overindexing arrays in common blocks with -pad=common specified. The altered positioning of adjacent data in a padded common block will cause overindexing to fail in unpredictable ways.

It is the programmer’s responsibility to make sure that common blocks are compiled consistently when -pad is used. Common blocks appearing in different program units that are compiled inconsistently with -pad=common will cause errors. Compiling with -Xlist will report when common blocks with the same name have different lengths in different program units.