What about "unaligned access" in FORTRAN programs?

What about "unaligned access" in FORTRAN programs?


This is most often caused by COMMON blocks in which variables are not
naturally aligned. For example:

REAL*4 X
REAL*8 Y
COMMON /CMN/ X,Y

Y will be at offset 4, which is not a multiple of its size (8). The best
solution is to rearrange variables in the COMMON so that real, complex
and integer variables are listed in order of decreasing size, followed by
CHARACTER variables. Put your declaration in an INCLUDE file to make sure
all uses are consistent! You can also ask the compiler to automatically
add padding to align variables through the -align dcommons switch, or
through a CDEC$ OPTIONS directive. See the DEC Fortran User Manual for
further details.



FAQ Home