align

Tells the compiler how to align certain data items.

IDE Equivalent

Windows:
Data > Structure Member Alignment
(/align:recnbyte)
Data > Common Element Alignment
(/align:[no]commons or /align:[no]dcommons)
Data > SEQUENCE Types Obey Alignment Rules
(/align:[no]sequence)

Linux: None

Architectures

IA-32, IntelŪ EM64T, IntelŪ ItaniumŪ architecture

Syntax

Linux: -align [keyword]
-noalign
Windows:  /align[:keyword]
/noalign

Arguments

keyword     Specifies the data items to align. Possible values are:
  none Prevents padding bytes anywhere in common blocks and structures.
  [no]commons Affects alignment of common block entities.

 

[no]dcommons

Affects alignment of common block entities.

 

[no]records

Affects alignment of derived-type components and fields of record structures.

 

recnbyte

Specifies a size boundary for derived-type components and fields of record structures.

 

[no]sequence

Affects alignment of sequenced derived-type components.

 

all

Adds padding bytes whenever possible to data items in common blocks and structures.

Default

nocommons

Adds no padding bytes for alignment of common blocks.

nodcommmons

Adds no padding bytes for alignment of common blocks.

records

Aligns derived-type components and record structure fields on default natural boundaries.

rec16byte

Aligns derived-type components and record structure fields on size boundary 16.

nosequence

Causes derived-type components declared with the SEQUENCE statement to be packed, regardless of current alignment rules set by the user.

By default, no padding is added to common blocks but padding is added to structures.

Description

This option specifies the alignment to use for certain data items. The compiler adds padding bytes to perform the alignment.

Option

Description

align none Tells the compiler not to add padding bytes anywhere in common blocks or structures. This is the same as specifying noalign.
align commons Aligns all common block entities on natural boundaries up to 4 bytes, by adding padding bytes as needed.

The align nocommons option adds no padding to common blocks. In this case, unaligned data can occur unless the order of data items specified in the COMMON statement places the largest numeric data item first, followed by the next largest numeric data (and so on), followed by any character data.

align dcommons Aligns all common block entities on natural boundaries up to 8 bytes, by adding padding bytes as needed.

This option is useful for applications that use common blocks, unless your application has no unaligned data or, if the application might have unaligned data, all data items are four bytes or smaller. For applications that use common blocks where all data items are four bytes or smaller, you can specify /align:commons instead of /align:dcommons.

The align nodcommons option adds no padding to common blocks.

On Windows systems, if you specify the /stand:f90 or /stand:f95 option, /align:dcommons is ignored.

On Linux systems, if you specify any -std option or the -stand f90 or -stand f95 option, -align dcommons is ignored.

align norecords Aligns components of derived types and fields within record structures on arbitrary byte boundaries with no padding.

The align records option requests that multiple data items in record structures and derived-type structures without the SEQUENCE statement be naturally aligned, by adding padding as needed.

align recnbyte Aligns components of derived types and fields within record structures on the smaller of the size boundary specified (n) or the boundary that will naturally align them. n can be 1, 2, 4, 8, or 16. When you specify this option, each structure member after the first is stored on either the size of the member type or n-byte boundaries, whichever is smaller. For example, to specify 2 bytes as the packing boundary (or alignment constraint) for all structures and unions in the file prog1.f, use the following command:

ifort {-align rec2byte | /align:rec2byte} prog1.f

This option does not affect whether common blocks are naturally aligned or packed.

align sequence Aligns components of a derived type declared with the SEQUENCE statement (sequenced components) according to the alignment rules that are currently in use. The default alignment rules are to align unsequenced components on natural boundaries.

The align nosequence option requests that sequenced components be packed regardless of any other alignment rules. Note that align none implies align nosequence.

On Windows systems, if you specify the /stand:f90 or /stand:f95 option, /align:sequence is ignored.

On Linux systems, if you specify any -std option or the -stand f90 or -stand f95 option, -align sequence is ignored.

align all Tells the compiler to add padding bytes whenever possible to obtain the natural alignment of data items in common blocks, derived types, and record structures. Specifies align nocommons, align dcommons, align records, align nosequence. This is the same as specifying align with no keyword.

Alternate Options

align none Linux: -noalign
Windows: /noalign

align records 

Linux: -align rec16byte, -Zp16
Windows: /align:rec16byte, /Zp16

align norecords

Linux: -Zp1, -align rec1byte
Windows: /Zp1, /align:rec1byte

align recnbyte

Linux: -Zp{1|2|4|8|16}
Windows: /Zp{1|2|4|8|16}

align all

Linux: -align commons -align dcommons -align records -align nosequence
Windows: /align:(nocommons,dcommons,records,nosequence)

See Also

Optimizing Applications: Setting Data Type and Alignment