This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should ADJUST_FIELD_ALIGN honor __attribute__((packed))?


On Mon, Apr 19, 2004 at 01:18:00AM -0700, Jim Wilson wrote:
> On Sun, 2004-04-18 at 18:37, Daniel Jacobowitz wrote:
> > 	* stor-layout.c (layout_decl): Check DECL_PACKED before calling
> > 	ADJUST_FIELD_ALIGN.  Check maximum_field_alignment after.
> 
> This moves the maximum_field_alignment check.  This was not in the
> earlier patch, and there was no explanation offered.  After a bit of
> poking around, I figured out that this was needed to make pragma pack
> work right.  It would have been helpful if you had explained this
> yourself instead of making me look it up.
> 
> OK for head.  I believe 3.4 requires separate approval from Mark
> Mitchell.

Sorry about that.  I had a whole large explanation thought up, and had
to run out the door before I got a chance to write it down.  You're
quite right - when running tests on GCC 3.4, I noticed that there were
two failing tests related to packing, and the previous patch only fixed
one of them.

Committed to HEAD.  Mark, how do you feel about this patch for 3.4.1?
It is an ABI change, but only for architectures where
ADJUST_FIELD_ALIGN can increase the alignment of a field, and only for
packed structures.  I only know of powerpc/altivec and arm/iwmmxt being
affected.  For iwmmxt this fixes the alignment of packed 'long long',
which is relatively common; for PPC I believe it would only affect
packed structures containing vectors, which is pretty unlikely.

It is not, as far as I know, a regression.  I don't remember what the
patch policy for 3.x.x releases is.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]