This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: ARM compiler misbehaves ?


Richard:


Richard wrote:


Actually, I'm pretty sure it is guaranteed to work as long as the compiler can see the "packed" attribute during compilation (if it couldn't, that would be a serious structural problem in your source code!).

Which claimed it should work. It doesn't, and isn't intended to.



My claim was in response to the original poster's use of a _reference_ to the packed structure member, by name, as a parameter to printf(). Not through a pointer.


Manipulations through pointers won't work, that much should be clear by now (as should be the underlying reason). But _references_ to packed structure members by name, even when misaligned, do work. Gcc will reconstruct the misaligned object in a properly-aligned one (a register, or on the stack), when necessary.



b.g.

--
Bill Gatliff
Affordable GNU and Linux training and consulting services.
bgat@billgatliff.com



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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