This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR64822: incorrect folding of bitfield in union on big endian targets
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "Thomas Preud'homme" <thomas dot preudhomme at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Biener <richard dot guenther at gmail dot com>, Jiong Wang <Jiong dot Wang at arm dot com>
- Date: Thu, 29 Jan 2015 11:39:26 +0100
- Subject: Re: [PATCH] Fix PR64822: incorrect folding of bitfield in union on big endian targets
- Authentication-results: sourceware.org; auth=none
- References: <001c01d03bae$35590880$a00b1980$ at arm dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jan 29, 2015 at 06:27:36PM +0800, Thomas Preud'homme wrote:
> Incorrect folding happen when a bitfield in a union is accessed and the union was initialized via another field. This is a reminiscence of GCC32RM-325 due to sccvn not passing the right size to fold_ctor_reference. sccvn uses TYPE_SIZE which gives the size of the container integer for a bitfield instead of TYPE_PRECISION that gives the actual size occupied by the bitfield. This patch fixes that and modify bitfld-6 so that it catch this issue in addition to the old one.
>
> ChangeLog entries are as follows:
>
> *** gcc/ChangeLog ***
>
> 2015-01-28 Thomas Preud'homme <thomas.preudhomme@arm.com>
>
You should mention
PR middle-end/62103
I'll defer review of the sccvn change to Richard.
> * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Use TYPE_PRECISION
> to compute size of referenced value in the constant case.
>
> *** gcc/testsuite/ChangeLog ***
>
> 2015-01-28 Thomas Preud'homme <thomas.preudhomme@arm.com>
>
> * gcc.c-torture/execute/bitfld-6.c: Use 24 bits for bitfield b. Adapt
> expected values accordingly.
IMHO if the old testcase wasn't incorrect, you'd better add a new testcase
instead of modifying existing one.
Jakub