[oe] need help: cdrkit & bitifields

Phil Blundell pb at reciva.com
Fri Mar 6 15:08:32 UTC 2009


On Fri, 2009-03-06 at 10:42 +0100, Frans Meulenbroeks wrote:
> However the problem occurs in code that I have not written and that is
> not easy to modify.
> I don't have the code handy but it could be that the code in cdrkit
> works just the other way:

What I meant really was that the outcome of your test program might have
been influenced by alignment issues, and this might have been obscuring
the real situation with cdrtools.

> E.g. something like:
> bitfields bf;
> char *p = &bf;
> *p = 0xf0;

Right, this is safe.  Casting from a more restrictive type to "char*" is
always OK since there are no types with less restrictive alignment
requirements than char.

> I'll test that variant as well.
> The stupid thing is that cdrkit words under opensuse/x68 but not under
> oe/arm (LE).
> So either this is a compiler issue or a nonportable construct.

Yes, it seems.  My guess would be that it's a non-portable construct
somewhere rather than a compiler bug, but either is possible.

If it does turn out to be a struct alignment thing then you might be
able to work around it with judicious use of "__attribute__
((__packed__))".

It might also be worth checking out the ARM binary from Debian to see if
that behaves the same.

p.






More information about the Openembedded-devel mailing list