This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] Strict volatile bit-fields clean-up
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Biener <richard dot guenther at gmail dot com>
- Date: Tue, 3 Dec 2013 12:50:51 +0100
- Subject: RE: [PATCH] Strict volatile bit-fields clean-up
- Authentication-results: sourceware.org; auth=none
- References: <DUB122-W30342E15CACDDA6AAE2376E4E60 at phx dot gbl> <CAFiYyc1n8sLWqR51H76DYNSCPbKPsu0DXouBdpay_8reJMs10Q at mail dot gmail dot com> <DUB122-W21BE390D27A47F4AE155B4E4D50 at phx dot gbl>,<4523076 dot 2RSQTWM6Sb at polaris>
>
>> Yes. I somehow did expect DECL_BIT_FIELD to be something simple,
>> without dependency on if -fstrict-volatile-bitfields is given, or what
>> Language front-end generated it, or if STRICT_ALIGNMENT is defined.
>
> Yes, it should be that way, and everything else is a bug.
>
I tried something like this, and it did boot-strap, but failed in some acats tests:
/* If the bitfield is volatile, we want to access it in the
field's mode, not the computed mode.
If a MEM has VOIDmode (external with incomplete type),
use BLKmode for it instead. */
if (MEM_P (to_rtx))
{
+ gcc_assert ((TREE_CODE (to) == COMPONENT_REF && DECL_BIT_FIELD (TREE_OPERAND (to, 1)))
+ || (bitpos % BITS_PER_UNIT == 0 && bitsize % BITS_PER_UNIT == 0));
if (volatilep && flag_strict_volatile_bitfields> 0)
to_rtx = adjust_address (to_rtx, mode1, 0);
Bernd.