Ordering Data Declarations to Avoid Unaligned Data

For new programs or when the source declarations of an existing program can be easily modified, plan the order of your data declarations carefully to ensure the data items in a common block, derived-type data, record structure, or data items made equivalent by an EQUIVALENCE statement will be naturally aligned.

Use the following rules to prevent unaligned data:

When declaring data, consider using explicit length declarations, such as specifying a KIND parameter. For example, specify INTEGER(KIND=4) (or INTEGER(4)) rather than INTEGER. If you do use a default length (such as INTEGER, LOGICAL, COMPLEX, and REAL), be aware that the compiler options /integer_size:num and /real_size:num can change the size of an individual field's data declaration size and thus can alter the data alignment of a carefully-planned order of data declarations.

Using the suggested data declaration guidelines minimizes the need to use the /align options to add padding bytes to ensure naturally aligned data. In cases where the /align options are still needed, using the suggested data declaration guidelines can minimize the number of padding bytes added by the compiler: