This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Bitfields accesses (causing problems to some ARM hardware)
- To: "Joern Rennecke" <amylaar at cygnus dot co dot uk>
- Subject: RE: Bitfields accesses (causing problems to some ARM hardware)
- From: "Igor Shevlyakov" <igor at windriver dot com>
- Date: Thu, 18 May 2000 18:24:50 -0700
- Cc: <gcc at gcc dot gnu dot org>
> > Do you have any suggestion how it should be handled. Could we
> fixed it in that
> > way that we will consider "volatile" for example and generate
> code for that as
> > for real bit-field. Or maybe do you know how to change source to
> get desired
> > effect.
>
> My suggestion:
> Use a union of the struct and an int for a temporary variable.
> Declare the I/O port as volatile int. To read the port, assign its value
> to the int part of the union, and then look at the various fields in your
> temporary variable. Likewise, to write, assemble the value in your
> temporary
> variable, and then assign it as an integer to the port register.
It's easy but looks very heavy in code there are a lot of playing with those
bitfields.
Actualy I was looking for way to change structure definition but leave all
accesses as is.
Thanks
Igor