r237319 - in /trunk/gcc: ChangeLog fold-const.c...

segher@gcc.gnu.org segher@gcc.gnu.org
Fri Jun 10 23:58:00 GMT 2016


Author: segher
Date: Fri Jun 10 23:58:09 2016
New Revision: 237319

URL: https://gcc.gnu.org/viewcvs?rev=237319&root=gcc&view=rev
Log:
fold-const: Don't access bit fields with too big mode (PR71310)

Currently, optimize_bit_field_compare reads the bitfield in word_mode
if it can.  If the bit field is normally accessed in a smaller mode,
this might be a violation of the memory model, although the "extra"
part of the read is not used.  But also, previous stores to the bit
field will have been done in the smaller mode, and then bigger loads
from it cause a LHS problem.


	PR middle-end/71310
	* fold-const.c (optimize_bit_field_compare): Don't try to use
	word_mode unconditionally for reading the bit field, look at
	DECL_BIT_FIELD_REPRESENTATIVE instead.

gcc/testsuite/
	PR middle-end/71310
	* gcc.target/powerpc/pr71310.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.target/powerpc/pr71310.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list