Checking for Inefficient Unaligned Data
During compilation, the Visual Fortran compiler naturally aligns as
much data as possible. Exceptions that can result in unaligned data are
described in Causes of Unaligned Data and Ensuring Natural Alignment.
Because unaligned data can slow run-time performance, it is worthwhile to:
- Double-check data declarations within common block, derived-type data,
or record structures to ensure all data items are
naturally aligned (see the data declaration rules in Ordering Data
Declarations to Avoid Unaligned Data). Using modules to contain data declarations can
ensure consistent alignment and use of such data.
- Avoid the EQUIVALENCE statement or use it in a manner that cannot cause
unaligned data or data spanning natural boundaries.
- Ensure that passed arguments from outside the program unit are naturally
aligned.
- Check that the size of array elements containing at least one derived-type
data or record structure cause array elements to
start on aligned boundaries (see Causes
of Unaligned Data and Ensuring Natural Alignment).
During compilation, warning messages are issued for any data items
that are known to be unaligned (unless you specify the
/warn:noalignments option).