[comp.sys.dec] unaligned data access

tgp@sei.cmu.edu (Tod Pike) (02/13/90)

I realize that this has probably been discussed in the recent past, but I
haven't seen it since I started reading this news group.  Is there an easy
way to recode or recompile to get rid of the
	 "Fixed up unaligned data access for pid XXXXX (emacs) at pc 0xXXXXXX"
messages?  I realize that the problem is that the code is doing the wrong
thing, but hope that we can use some compile time switch to fix the problem.
We are seeing the messages mostly from Gosling Emacs and mwm.

			Thanks,
				Tod Pike

-- 
Arpanet: tgp@sei.cmu.edu
Mail:    Carnegie Mellon University
	 Software Engineering Institute
	 Pittsburgh, PA. 15213-3980

graham@fuel.dec.com (kris graham) (02/15/90)

> I realize that this has probably been discussed in the recent past, but I
> haven't seen it since I started reading this news group.  Is there an easy
> way to recode or recompile to get rid of the
> 	 "Fixed up unaligned data access for pid XXXXX (emacs) at pc 0xXXXXXX"
> messages?  I realize that the problem is that the code is doing the wrong
> thing, but hope that we can use some compile time switch to fix the problem.
> We are seeing the messages mostly from Gosling Emacs and mwm.

The DECstation 3100 imposes boundary alignment rules.   It expects that
 integers be on longword boundaries, and shorts be on word boundaries.  
The VAX is usually' more forgiving' ; the VAX allows alignment on any byte
 boundary whereas the PMAX  requires 'natural' alignment.  Short (2bytes) 
and long (4bytes) must be accessed on boundaries evenly divisible by 2 
and 4 respectively.  

Unaligned accesses causes 'traps' in the ULTRIX kernel where the system 
attempts 'fixup' the unaligned access.  Failed attempts at 'fixups' usually
results with SIGBUS (bus errors) signals, whereas successful 'fixups'
prints messages to TTY with info on where (program counter) the alignment
error was seen.  Unaligned access 'fixups' normally affect program
performance.

The dbx command should help you locate the offending code causing the 
unaligned access.

 dbx> 0xXXXXX/bb       ..where 0xXXXXXX is the address,

You  will  be able to find where in source code  the error is comming from.
Compiling with the -g switch will even give more debugging info.

On the otherhand, if you just want to turn off the unaligned access
messages, use the UAC command.  Look at the ULTRIX RISC
man pages for more info.

Christopher Graham          
Digital Equipment Corp            
Ultrix Resource Center                                             
New York City

Internet: graham@fuel.enet.dec.com 
UUCP:     ...!decwrl!fuel.enet.dec.com!graham