http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58570

--- Comment #9 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Eric,

there is one more thing to consider for your proposed patch,
that is the damned -fstrict-volatile-bitfields:

if strict_volatile_bitfields>0 and the BIT_FIELD access
is _volatile_ it does not respect the BIT_FIELD_REPRESENTATIVE at all.

that means for instance:
struct
{
  int a:24;
  char b;
} s;

s.a=1;
s.b=2;

we have a INT32 read-modify-write over b.

even worse:
struct
{
  int a:24;
} __attribute__((packed)) s;

s.a=1;

uses an (unaligned) INT32 read-modify-write and may overwrite
one member of an adjacent structure.

Note that at least the second example should no longer write beyond
the structure if this patch is applied:
 http://gcc.gnu.org/ml/gcc-patches/2013-09/msg02058.html

So you should expect an alias if either field is a VOLATILE
bit-field access and flag_strict_volatile_bitfields > 0.

Bernd.

Reply via email to