SUMMARY: Unalligned Access error

From: Paul Kitwin <PAUKIT_at_HBSI.COM>
Date: Thu, 12 Feb 1998 23:46:51 -0800

> Well, looks like it's sloppy code or bad compilling.
>
> Looks like my hardware and OS are good, guess I get to send this back
> to the developers!
>
>
> Here is the answer from DEC:
>
>
> (http://www.partner.digital.com/www-swdev/pages/Home/TECH/faqs/dunix/u
> nalign.html)
>
> 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).
> 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
> 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 enough about the
> entire application to make all the correct assumptions. Some reasons
> for 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, and word
> data are used.
> * Structures and unions (size, member
> alignment, structure alignment, etc. are handled 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 parameters
> 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.
> 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.
>
>
>
>
>
Received on Fri Feb 13 1998 - 08:46:17 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT