This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] reimplement -fstrict-volatile-bitfields v4, part 2/2
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: Bernd Edlinger <bernd dot edlinger at hotmail dot de>, <sandra at codesourcery dot com>, <gcc-patches at gcc dot gnu dot org>, <richard dot guenther at gmail dot com>
- Date: Thu, 17 Oct 2013 17:21:47 +0000
- Subject: Re: [PATCH] reimplement -fstrict-volatile-bitfields v4, part 2/2
- Authentication-results: sourceware.org; auth=none
- References: <52463D60 dot 8040607 at codesourcery dot com>,<201309302018 dot r8UKIU9g004905 at greed dot delorie dot com> <DUB122-W29B621BE86DA0D30377F19E41D0 at phx dot gbl> <201310162346 dot r9GNk6Zb013168 at greed dot delorie dot com> <525F4881 dot 30900 at codesourcery dot com>,<201310170250 dot r9H2oKkv017657 at greed dot delorie dot com> <DUB122-W47A0C292667380EF5C8D20E4050 at phx dot gbl> <201310171617 dot r9HGHEOV006872 at greed dot delorie dot com>
On Thu, 17 Oct 2013, DJ Delorie wrote:
> > It is as Sandra said, at least on ARM -fstrict-volatile-bitfields
> > does not function at all. And the C++11 memory model wins all the time.
>
> Are we talking about N2429? I read through the changes and it didn't
> preclude honoring the user's types.
At least on ARM, you can e.g. have a non-bit-field "char" that occupies
part of the same 4-byte unit as an "int" bit-field. And the C11/C++11
memory model prohibits stores to that bit-field from doing
read/modify/write on the whole 4-byte unit, as that's a store data race.
If the user wants to allow that data race, they can rewrite their code by
changing the "char" into a bit-field. I believe that in all cases where
strict-volatile-bitfields ABIs are incompatible with the default --param
allow-store-data-races=0, the structure can be similarly rewritten by the
user so the adjacent fields become bit-fields, if they want the
strict-volatile-bitfields requirements for their code to be compatible
with the memory model.
--
Joseph S. Myers
joseph@codesourcery.com