HP Fortran Programmer's Reference (September 2007)

Data types and data objects
Resolving issues with unaligned data
Chapter 5 135
Resolving issues with unaligned data
The following suggestions will aid with issues regarding unaligned data:
For Itanium—based applications
As a quick fix, add the following call to the main program:
call allow_unaligned_data_access( )
Then, link in an additional library that fixes these alignment issues at runtime:
-lunalign
Longer term, try compiling with the following flag:
+allow_unaligned
An example would be:
PROGRAM bs30
INTEGER*2 i2(10)
INTEGER*4 i4
EQUIVALENCE (i2(2), i4)
DATA I4 /z’FFFF0000’/
i4=12
call allow_unaligned_data_access()
print *,i4
END
Then compile with:
/opt/fortran90/bin/f90 foo.f -lunalign +noppu
If you need to drop the +noppu, then add an alias directive as follows:
!$HP$ALIAS allow_unaligned_data_access=’allow_unaligned_data_access’
PROGRAM bs30
INTEGER*2 i2(10)
INTEGER*4 i4
EQUIVALENCE (i2(2), i4)
DATA I4 /z’FFFF0000’/
i4=12
call allow_unaligned_data_access()
print *,i4
END
Then compile with: