This is the mail archive of the
mailing list for the GCC project.
RE: Folding a bitfield in a union
- From: "Thomas Preud'homme" <thomas dot preudhomme at arm dot com>
- To: "'Richard Biener'" <richard dot guenther at gmail dot com>
- Cc: "GCC Development" <gcc at gcc dot gnu dot org>
- Date: Mon, 30 Jun 2014 10:59:29 +0800
- Subject: RE: Folding a bitfield in a union
- Authentication-results: sourceware.org; auth=none
- References: <005301cf91d4$2d9c3560$88d4a020$ at arm dot com> <CAFiYyc0tU_Qx2JFky7_7yEYWOWNMk7w8LXDS=qDihxn2ii97fQ at mail dot gmail dot com> <005401cf91ee$f0fa4050$d2eec0f0$ at arm dot com> <CAFiYyc31trbr0S8+1=XogLgasP4w7iAkVqFFCD5nkawf7KWeHA at mail dot gmail dot com>
> From: Richard Biener [mailto:firstname.lastname@example.org]
> Sent: Friday, June 27, 2014 6:23 PM
> Yes - I was specifically looking for an early out to avoid wrong-code.
> So, is size % BITS_PER_UNIT != 0 a working fix to avoid the wrong-code
> issues with bitfields (on big-endian targets)?
I'm afraid not. A bitfield of 24 bits passes this test but the folding with
VIEW_CONVERT_EXPR is still wrong. Better compare size against the bitsize
of type. That would eliminate all bitfields.
> I'd rather disable it for all endianesses - gives us more incentive
> to fix it properly.
> Yeah (the code is already there in varasm.c:output_constructor - it
> just uses a different "buffer").
Good, I'll take a look at it when I'll come back to this patch.