Re: [PATCH]: Fix SIGBUS in JPEG handling on RISC



Le samedi 03 novembre 2007 à 15:50 -0700, David Miller a écrit :
> From: Mathias Hasselmann <mathias openismus com>
> Date: Sat, 03 Nov 2007 09:12:19 +0100
> 
> > <offtopic>
> > I didn't write that code, but I'd consider it a philosophical
> question,
> > if that code or your CPU architecture is "buggy"... ;-)
> > </offtopic>
> 
> Whether CPU architectures should trap on unaligned loads and
> stores is indeed an interesting philosophical discussion.
> 
> But the C language is pretty clear on this case, in that pointer
> addresses should meet the necessary alignment for the given type
> behind that pointer.

Furthermore, some CPU which allow unaligned accesses do it in 2 passes,
effectively taking a big slowdown. Unaligned access is generally frowned
upon and should be avoided (I don't know if it still applies to current
x86 architectures, but this restriction isn't in the C standard for no
reason).

	Xav




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]