Path: chuka.playstation.co.uk!tjs From: tjs@cs.monash.edu.au (Toby Sargeant) Newsgroups: scea.yaroze.programming.gnu_compiler Subject: Re: Does this work with GCC? Date: 29 Oct 1999 08:27:27 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 12 Message-ID: References: <7vaa1h$bhb1@scea> NNTP-Posting-Host: longford.csse.monash.edu.au X-Newsreader: slrn (0.9.4.3 UNIX) On Thu, 28 Oct 1999 12:23:55 -0400, Brian Weed wrote: > n = *u.p16; // Crashes when p16 is odd MIPS assembler uses the lh(u) instruction to load half words. There is a restriction that the address loaded from be even, unlike x86 processors. The compiler _could_ generate code to test every load and perform the extra work when the access was unaligned, but that would be rather ugly. It's also possible to do this as an exception (i.e. trap the unaligned load/store and do the rightThing(tm) in the exception handler). Both of these are significant performance hits. Stick to using aligned pointers :) Toby.