ARM compiler misbehaves ?
Grant Edwards
grante@visi.com
Thu Apr 29 01:36:00 GMT 2004
> >test_struct.test_short = 0x1234;
> >printf("%04x\n", test_struct.test_short);
> >
> >_may_ work. I don't think it's guaranteed to work, though.
>
> Actually, I'm pretty sure it is guaranteed to work as long as the
> compiler can see the "packed" attribute during compilation
I believe you're right. It's only when you use the "&"
operator to hide the actual structure from the compiler that
things go wrong.
> If you aren't sure we're right, take out the "packed" attribute and try
> again. It should work fine then. Also, stop the debugger after the
> assignment to test_pointer and examine its value: it should be 16-bit
> aligned.
IIRC, on an ARM7, it will store one byte in the "wrong" place
and leave the other byte alone.
--
Grant Edwards
grante@visi.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