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: [PATCH] Fix PR64822: incorrect folding of bitfield in union on big endian targets


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


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