Use the -align recnbyte (or -Zp[n]) option to specify the alignment constraint for structures on n-byte boundaries (where n = 1, 2, 4, 8, or 16 with -Zp[n]).
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 (where n = 1, 2, 4, 8, or 16), 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 -Zp2 prog1.f
The default for IA-32 and Itanium-based systems is -align rec8byte or -Zp8. The -Zp16 option enables you to align Fortran structures such as common blocks. For information on Fortran record structures, see STRUCTURE statement in the Intel® Fortran Language Reference.
If you specify -Zp (omit n), structures are packed at 8-byte boundary.
The -align option is a front-end option that changes alignment of variables in a common block.
Example:
common /block1/ch,doub,ch1,int
integer int
character(len=1) ch, ch1
double precision doub
end
The -align option enables padding inserted to ensure alignment of doub and int on natural alignment boundaries. The -noalign option disables padding.
The -align option applies mainly to structures. It analyzes and reorders memory layout for variables and arrays and basically functions as -Zp{n}. You can disable either option with -noalign.
For -align keyword options, see your User's Guide, Volume I.
The -pad option is effectively not different from -align when applied to structures and derived types. However, the scope of -pad is greater because it applies also to common blocks, derived types, sequence types, and VAX* structures.
The following options control whether the Intel Fortran compiler adds padding (when needed) to naturally align multiple data items in common blocks, derived-type structures, and Intel Fortran record structures:
By default (with -O2), the -align commons option requests that data in common blocks be aligned on up to 4-byte boundaries, by adding padding bytes as needed.
The -align nocommons arbitrarily aligns the bytes of common block data. 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.
By default (with -O2), the -align dcommons option
requests that data in common blocks be aligned on up to 8-byte boundaries,
by adding padding bytes as needed.
The -align nodcommons arbitrarily aligns the
bytes of data items in a common data.
Specify the -align dcommons option 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 norecords option requests that multiple data items in derived-type data and record structures (an Intel Fortran extension) be aligned arbitrarily on byte boundaries instead of being naturally aligned. The default is -align records.
The -align records option requests that multiple data items in record structures (extension) and derived-type data without the SEQUENCE statement be naturally aligned, by adding padding bytes as needed.
The -align recnbyte option requests that fields of records and components of derived types be aligned on either the size byte boundary specified or the boundary that will naturally align them, whichever is smaller. This option does not affect whether common blocks are naturally aligned or packed.
The -align sequence option controls alignment of derived-type components declared with the SEQUENCE statement (sequenced components).
The -align nosequence option means that sequenced components are packed regardless of any other alignment rules. Note that -align none implies -align nosequence.
The -align sequence option means that sequenced components obey whatever alignment rules are currently in use. Consequently, since -align record is a default value, then -align sequence alone on the command line will cause the components of these derived types to be naturally aligned.
The default behavior is that multiple data items in derived-type structures and record structures will be naturally aligned; data items in common blocks will not (-align records with -align nocommons ). In derived-type structures, using the SEQUENCE statement prevents -align records from adding needed padding bytes to naturally align data items.