Hello,

this patch fixes the recently discovered data store race on arm-eabi-gcc with 
-fno-strict-volatile-bitfields
for structures like this:

#define test_type unsigned short

typedef struct s{
 unsigned char Prefix[1];
 test_type Type;
}__attribute((__packed__,__aligned__(4))) ss;

volatile ss v;

void __attribute__((noinline))
foo (test_type u)
{
  v.Type = u;
}

test_type __attribute__((noinline))
bar (void)
{
  return v.Type;
}


I've manually confirmed the correct code generation using variations of the
example above on an ARM cross-compiler for -fno-strict-volatile-bitfields.

Note, that this example is still causes ICE's for -fstrict-volatile-bitfields,
but I'd like to fix that separately.

Boot-strapped and regression-tested on x86_64-linux-gnu.

Ok for trunk?

Thanks
Bernd.                                    
2013-10-25  Bernd Edlinger  <bernd.edlin...@hotmail.de>

        Fix C++0x memory model for unaligned fields in packed, aligned(4)
        structures with -fno-strict-volatile-bitfields on STRICT_ALIGNMENT
        targets like arm-none-eabi.
        * expmed.c (store_bit_field): Handle unaligned fields like
        bit regions.

Attachment: patch-unaligned-data.diff
Description: Binary data

Reply via email to