[head tinderbox] failure on arm/arm
Tim Kientzle
kientzle at freebsd.org
Sun Nov 12 18:10:47 PST 2006
In message: <20061112192810.GC1173 at rambler-co.ru>
Ruslan Ermilov <ru at freebsd.org> writes:
: On the other hand, having GCC align "struct foo { char x[11]; }"
: on a four-byte boundary (other than for backward compatibility)
: doesn't make too much sense to me.
It makes a lot of sense, actually, even on i386, which is
why the standard allows the compiler a lot of leeway to
pad and align such structure. For example, consider this
structure assignment:
struct foo a,b;
a = b;
The structure copy here is a LOT faster if the structures
are always suitably aligned and padded. If the compiler
pads your sample struct to 12 bytes and 4-aligns, the
structure copy here can be done with 3 aligned 32-bit moves.
Even on i386, aligned operations are a lot faster than
unaligned ones.
The code mentioned in the original post is simply broken;
it does not comply with the ISO C Standard.
Tim Kientzle
More information about the freebsd-current
mailing list