From: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: Re: need help: cdrkit & bitifields
Date: Fri, 6 Mar 2009 10:42:18 +0100 [thread overview]
Message-ID: <ac9c93b10903060142k13d1908btcd39319477b37530@mail.gmail.com> (raw)
In-Reply-To: <1236330230.4607.54.camel@lenovo.internal.reciva.com>
2009/3/6 Phil Blundell <pb@reciva.com>:
> On Thu, 2009-03-05 at 22:10 +0100, Frans Meulenbroeks wrote:
>> main(int argc, char **argv)
>> {
>> char c = 0xf0;
>> bitfields *bf = &c;
>
> This isn't a legal thing to do. Struct addresses on ARM need to be
> 32-bit aligned, whereas &c is only guaranteed aligned to an 8-bit
> boundary. You can't, in general, take a pointer to an arbitrary type,
> cast it to a struct and expect to get good results.
>
> You need to use a union, or something like:
>
> struct wrapped_char {
> char c;
> }
>
> struct wrapped_char wc;
> wc.c = 0xf0;
> bitfields &bf = &wc;
>
> p.
>
Hi Phil,
I understand the alignment issue.
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:
E.g. something like:
bitfields bf;
char *p = &bf;
*p = 0xf0;
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.
Puzzled.
FM
next prev parent reply other threads:[~2009-03-06 9:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-05 17:21 need help: cdrkit & bitifields Frans Meulenbroeks
2009-03-05 18:26 ` Koen Kooi
2009-03-05 21:10 ` Frans Meulenbroeks
2009-03-06 9:03 ` Phil Blundell
2009-03-06 9:42 ` Frans Meulenbroeks [this message]
2009-03-06 15:08 ` Phil Blundell
2009-03-07 9:37 ` Khem Raj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ac9c93b10903060142k13d1908btcd39319477b37530@mail.gmail.com \
--to=fransmeulenbroeks@gmail.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox