Subject: Re: port-alpha/8145: Compiler alignment bug on Alpha architecture
To: None <sopwith!>
From: Jason Thorpe <>
List: port-alpha
Date: 08/04/1999 22:29:30
On Wed, 4 Aug 1999 17:39:27 GMT 
 Der Beagle <sopwith!> wrote:

 > 		883         switch (r_type_xe(iref_packed)) {
 > 	The author of Ghostscript (L. Peter Deutsch, says:
 > 		This is a compiler bug.
 > 		iref_packed is declared as register const ref_packed *.
 > 		ref_packed is defined in iref.h as ushort (16-bit).  Also,
 > 		r_type_xe is defined in iref.h as casting the pointer to const ushort *.
 > 		Therefore, the compiler should be generating code that assumes no more
 > 		than ushort (2-byte) alignment.
 > 		Indeed, the value of iref_packed at the point of the unaligned access
 > 		is ushort (2-byte) aligned, a.k.a. even.
 > 		However, the trap message says the opcode was ldl, which is a 4- or 8-byte
 > 		load.
 > 	Peter would like to be copied on any reply regarding this problem.

You're right... it was a 4-byte load (ldq is 8-byte).  But, it's worth noting
that the Alpha architecture only defines 4 and 8 byte loads (barring the BWX

I'm not saying the compiler isn't to blame (if the code is correctly written,
and the problem persists, then it probably is!), but I've also seen a whole
lot of code out there which does the wrong thing with type alignment...

        -- Jason R. Thorpe <>