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]

Re: [C++0x] contiguous bitfields race implementation


On 05/18/11 16:58, Jason Merrill wrote:
It seems like you're calculating maxbits correctly now, but an access
doesn't necessarily start from the beginning of the sequence of
bit-fields, especially given store_split_bit_field. That is,

This is what I was trying to explain to you on irc. And I obviously muffed up the whole explanation :).



struct A { int i; int j: 32; int k: 8; char c[2]; };

Here maxbits would be 40, so we decide that it's OK to use SImode to
access the word starting with k, and clobber c in the process. Am I wrong?

You are correct. I have redesigned the patch to pass around starting and ending bit positions, so get_best_mode() can make a more informed decision.


I also started using DECL_BIT_FIELD_TYPE instead of DECL_BIT_FIELD to determine if a DECL is a bit field. It turns out DECL_BIT_FIELD is not set for bit fields with mode sized number of bits (32-bits, 16-bits, etc).

Furthermore, I added another test to check the above scenario.

Bootstrapped and tested on x86-64 with --param=allow-store-data-races=0.

How do you like these apples?

Attachment: curr
Description: Text document


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