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

Re: "Unaligned access" on Alpha



On Sun, Feb 29, 2004 at 11:02:30AM -0600, Kelledin wrote:
> Lately I've been looking closely at the compile logs on my EV56 
> box, and I've noticed a particular gcc warning occurring 
> frequently:

>     cast increases required alignment of target type.

> This worries me almost as much as casts between integers and 
> pointers of different size, but...even with all the warnings, I 
> don't get too many crashes.  Still, I'm compelled to wonder 
> about the effect of unaligned accesses, i.e. how severe is an 
> unaligned access in user-space?  How about in kernel-space?  How 
> does the system handle them?

> I have a pretty clear idea what it would take to fix that warning 
> condition, but it occurs so frequently that I'm not sure it 
> would be worth the time. :/

As of Linux 2.6, unaligned memory access is no longer handled for you by
the kernel on alpha.  These will instead generate SIGBUS errors, just as
they have forever on Linux sparc.  Any such bugs should be fixed,
therefore.

And in some cases, such as the evms case that currently came up on this
list, such casts hide more serious bugs still.  However, not all such
warnings are actual bugs at all:  you may be seeing the result of a
pointer being down-cast and then up-cast again, which is a little sloppy
(mostly from the standpoint that it causes compiler warnings), but
shouldn't cause problems when running the app.

Cheers,
-- 
Steve Langasek
postmodern programmer

Attachment: signature.asc
Description: Digital signature


Reply to: