| #2 14-APR-1997 15:06:07.47
NEWMAIL
From: HYDRA::AXPDEVELOPER "[email protected]"
To: SMTP%"[email protected]"
CC: AXPDEVELOPER
Subj: RE: Unalligned access Error Message
Shyam,
The unaligned access messages that you are receiving will not cause the
software to fail, but can cause significant performance degradation for your
application. My recommendation is that you modify your application to avoid
generating unaligned accesses. Attached is some info on what causes
unaligned accesses and how to track down the source of the unaligned
accesses in your application. This is from one of our FAQ web pages found
at:
http://www.partner.digital.com/www-swdev/pages/Home/TECH/faqs/dunix/unalign.html
Karen Dorhamer
Alpha Developer Support
FAQs About Unaligned Access on Digital UNIX
1.How are data accessed on Alpha?
The Alpha architecture supports longword (32-bits) and quadword (64 bits) memory
accesses. Byte and word accesses (on EV4 and EV5 Alpha Architectures) are
achieved through the use of multiple instructions (load as a longword
or quadword;
mask and shift to retrieve the byte or word).
2.How are data aligned on Alpha?
Longwords (e.g. an int) are aligned on 4-byte boundaries.
Quadwords (e.g. a long) are aligned on 8-byte boundaries.
Float data types are aligned on 4-byte boundaries.
Long, double, and pointers are aligned on 8-byte boundaries.
A structure as a whole is aligned on the boundary of the largest
element contained therein.
.Am I getting unaligned access warnings?
On Digital UNIX systems, you can enable or disable reporting of the
"unaligned access" warnings by using:
uac p - shows current process uac setup
uac p 1 - Enables unaligned access message control for the
current process
uac p 0 - Disables unaligned access message control
for the
current process
uac s - shows system uac setup
NOTE: Default settings for uac under Digital UNIX V4.0 running CDE is:
% uac p
parent printing is off
fixup is on
sigbus is off
4.What causes unaligned access errors?
Unaligned accesses may occur for a number of reasons. For instance,
while the
compiler does its best to naturally align data and variables, it may
not know en
ough
about the entire application to make all the correct assumptions. Some
reasons f
or
unaligned access are:
Parameters being passed into functions
Pointers (64 bits) cast as ints (32 bits)
Multithreaded applications on multiple processors, not using proper
lockings
techniques, may experience synchronization problems while accessing
common data
through a common address space. This is especially a problem when char,
byte, an
d
word data are used.
Structures and unions (size, member alignment, structure alignment,
etc. are han
dled
differently by the Alpha architecture than by 32-bit architectures.
Library calls, such as printf(), scanf(), malloc(), calloc(), lseek(),
fsetpos()
and
fgetpos() are handled differently by the Alpha architecture. i.e. size
of parame
ters to
these functions may differ from 32-bit systems.
Constants may have different values between 32-bit and 64-bit systems.
This
becomes an issue when exchanging data between these systems.
Accessing data in old files, or files shared between 32-bit and 64-bit
systems.
5.How do I get rid of "unaligned access" errors?
So you see this kind of error message?!
Unaligned access pid=2276 <unalign> va=11ffffd01 pc=120001188
ra=120001100 type=
stq
The message above says: program unalign has an unaligned access at PC
Address
0x120001188.
To isolate where the error message comes from:
Write down the PC Address reported by the message. i.e. pc=120001188
Run the debugger, specifying the executable file with the unaligned
access. i.e.
% dbx unalign
Set break at the pc address and run. i.e.
dbx> stopi at 0x120001188
dbx> run
Once stopped at the break point, use the "where" command and find the
source
line for the fault.
Knowing where the problem lies, try to fix it.
Fixing the code requires an understanding of the code and how it
interfaces
with other parts of the code. The resolution may require code changes
as well
as specifying additional compiler options such as -xtaso or
-nomember_alignment .
Recompile, relink and try again.
A good example for the process of finding and fixing unaligned access
problems is given in THIS PAGE.
Note: Additional information on this topic can be obtained from the DEC
OSF/1 AXP debugger manual or man pages on your compiler.
|
| From: SMTP%"[email protected]" 15-APR-1997 16:48:01.25
To: [email protected] ([email protected])
CC:
Subj: Re: Unalligned access Error Message
Karen,
Great! I ran the program under dbx, gave the break point at the PC value
where there was an 'unaligned acces'. This procedure helped me in
determining the fragment of source code, which had the bug, and was
able to solve the problem in a minute. Thanks very much!
Shyam
|