This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix C++0x memory model for -fno-strict-volatile-bitfields on ARM


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. 		 	   		  

Attachment: changelog-unaligned-data.txt
Description: Text document

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]