This is the mail archive of the gcc@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: memcpy to an unaligned address


One of the things that continues to baffle me (and my colleagues) is
the bizarre way in which attributes such as "packed" work when applied
to structs.

It would be natural to assume, as Shaun did, that marking a struct
"packed" (or, for that matter, "packed,aligned(2)") would apply that
attribute to the fields of the struct.

But it doesn't work that way.  To get the right results, you have to
stick attributes all over the structure fields, one by one.  This is
highly counterintuive.

Worse yet, in this example the attribute is applied to the structure
elements to some extent but not consistently -- it causes the fields
to be packed -- hence unaligned -- but it does not do unaligned
accesses to the fields.

This sure looks like a bug.

     paul


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