Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2006 18:10:45 -0800
From:      Tim Kientzle <kientzle@freebsd.org>
Cc:        arm@freebsd.org, current@freebsd.org, keramida@freebsd.org
Subject:   Re: [head tinderbox] failure on arm/arm
Message-ID:  <4557D425.40101@freebsd.org>
In-Reply-To: <20061112.154733.-432839119.imp@bsdimp.com>
References:  <20061112180758.GD4237@kobe.laptop>	<20061112132105.6bac38d6@kan.dnsalias.net>	<20061112192810.GC1173@rambler-co.ru> <20061112.154733.-432839119.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20061112192810.GC1173@rambler-co.ru>
             Ruslan Ermilov <ru@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4557D425.40101>