Unaligned access to packed structs on ppc405

Yaro Pollak yarop@altair-semi.com
Mon Jan 30 12:03:00 GMT 2006



David Edelsohn wrote:

>>>>>>Yaro Pollak writes:
>>>>>>            
>>>>>>
>
>  
>
>>I am cross-compiling on GCC 3.4.1 for the PowerPC 405, which can handle 
>>unaligned accesses in hardware.
>>Whenever I am accessing members of a packed bit-struct by pointer, the 
>>compiler produces byte accesses, instead of 4-byte acceses.
>>I've tried to use |-mstrict-align but to no avail.
>>    
>>
>
>	What does "|-mstrict-align" mean?  -mstrict-align means "do not
>assume that unaligned accesses are handled by the system."  You are
>requesting that the compiler assume the target requires strict alignment
>and then questioning why it is accessing a packed bit-struct assuming the
>least alignment.
>
>David
>
>  
>
Yes, I actually couldn't tell whether I should use -mno-strict-align or 
-mstrict-align from the explanation in GCC documentation (thank you for 
your explanation) so I tried both, but it didn't matter at all. I guess 
I should have mentioned that before. Perhaps any other ideas? I feel it 
is something fundamental that I keep missing.

Yaro



More information about the Gcc-help mailing list