Re: Unaligned access fault in fxp on alpha

From: Bruce Evans <bde_at_zeta.org.au>
Date: Sun, 11 May 2003 20:17:38 +1000 (EST)
On Sun, 11 May 2003, Maxime Henrion wrote:

> I removed them because they were just looking bogus.  I wanted to ask
> people to test a patch adding a __packed in the struct definition to see
> if it fixed things.  If it works with a __packed keyword, I'd like
> it better than going back to having an array of four u_int8_t.
> Otherwise I'll put the u_int8_t back.

__packed looks very bogus to me.  It is a syntax error for non-gcc
compilers.  The code was apparently originally carefully written to
not depend on gccisms.

I think __packed is also a pessimization here on some arches.  The struct
also has some u_int16_t's which are aligned, but __packed says that
everything may be misaligned (unless you also use __aligned(mumble)).
On some arches, the compiler will have to access everything as bytes
and reassemble, or more complicated things if byte accesses are impossible.
Since the accesses are for machine registers, the accesses with unusual
widths and/or alignments for this may even be bugs.

I just noticed that gcc now has some warnings -Wpacked and -Wpadded to
help detect gratuitous use of __packed and errors in explicit packing/
padding.

Bruce
Received on Sun May 11 2003 - 01:17:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:07 UTC