ARM compiler misbehaves ?

Bill Gatliff bgat@billgatliff.com
Thu Apr 29 14:43:00 GMT 2004


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



More information about the crossgcc mailing list