[ECOS] structure size
Grant Edwards
grante@visi.com
Tue Jan 6 16:10:00 GMT 2004
> ----------------------------------------------------------------------------
> struct xyzzy {
> short a;
> int b;
> } __attribute__((packed));
>
> struct xyzzy data;
>
> int
> fred(void)
> {
> data.b = 42;
> }
> ----------------------------------------------------------------------------
>
> Compile with arm-elf-gcc -S. The assignment to data.b is implemented
> using four separate strb instructions, as I would expect. If you try
> reading data.b instead there will be four ldrb instructions plus
> appropriate manipulation.
It looks like gcc 3.3 for H8 "does the right thing" as well.
After looking at the contortions it has to go through to access
misaligned struct fields, one would certainly try to avoid
them.
--
Grant Edwards
grante@visi.com
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list