From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,e42f728345b2a43 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1993-09-15 06:46:15 PST Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!wupost!cs.utexas.edu!uunet!decwrl!pa.dec.com!jac.nuo.dec.com!crl.dec.com!utne.zk3.dec.com!mytoy.zk3.dec.com!ddhill From: ddhill@zk3.dec.com (Dave Hill) Newsgroups: comp.unix.osf.osf1 Subject: Re: Alignment on alpha? Date: 15 Sep 1993 13:29:28 GMT Organization: WHATX Sender: ddhill@mytoy.zk3.dec.com (Dave Hill) Distribution: world Message-ID: <2775bo$52b@utne.zk3.dec.com> References: <275gq7INNg9j@zephyr.grace.cri.nz> NNTP-Posting-Host: mytoy.zk3.dec.com In article <275gq7INNg9j@zephyr.grace.cri.nz>, chrisp@marc.cri.nz writes: |> Hi, |> Can someone explain to me how to do long un-aligned accesses without |> generating run-time errors. |> |> And what alignment is necessary on alpha, byte word long or quad |> |> Chris, Email: chrisp@marc.cri.nz |> |> HortResearch Ltd., New Zealand. |> |> "He's dead, Jim. I'll get his tricorder. You take his wallet." Structures, pointers, longs (sizeof(x) == 8) on a mod 8 boundry int (sizeof(int) == 4) on a mod 4 boundry short (sizeof(short) == 2) on a mod 2 boundry char (sizeof(cahr) == 1) on any boundry There is a pattern there somewhere :-) Malloc always returns % 8 Almost all unaligned access errors I have dealt with on the Alpha platform have been because the wrong thing was passed, for example: func (long * l) { *l = some_value; } main() { int i; func(&i); } This code can generate an unaligned access, and can produce bad side affects. For example, the compliler will write 64 bits into the address that is passed to the function, but you only passed 32 bits worth of space, so something is getting squashed. /Dave