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: Problem with stores and loads from unions and proposed fix


Hi,

On Sat, 6 Feb 2010, Richard Guenther wrote:

> > CSE detects that the same subexpression is used in two places and
> > substitutes a reaching register for the reference to u32.word without
> > noticing that the memory has been modified by the bit field reference.
> > ÂAdding a call to invalidate_any_buried_refs(dest) flags the memory
> > reference in such a way that it is not ignored and the erroneous CSE
> > optimization is not done.
> >
> > Thanks to anyone who can help determine whether this is a problem for 
> > other gcc versions and getting a fix into the gcc source.
> 
> Please specify the GCC version this happens with and show the RTL
> before gcse.

In private communication it became clear that the set in question was a 
bitmap set:
  (set (ZERO_EXTRACT (MEM:SI (REG:SI <fp>) (CONST_INT 8) (CONST_INT 24) ) 
       ... rhs ... )

This is an rmw set, hence includes a use.  Similarly mishandled would be
  (set (MEM (MEM ...)) rhs )
(the inner MEM is a use and needs to be invalidated).  I think it's quite 
clear that the invalidate_any_buried_refs call for the destination is 
missing.  The comment in front of this if, of why it's okay to ignore 
"aliasing" seems confused, this doesn't involve aliasing at all.


Ciao,
Michael.

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