This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/49279] [4.5/4.6/4.7 Regression] Optimization incorrectly presuming constant variable inside loop in g++ 4.5 and 4.6 with -O2 and -O3 for x86_64 targets


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49279

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-04 16:47:22 UTC ---
Looking at this (don't see how this is related to the other PR), I think the
bug is either that we have these TYPE_RESTRICT casts (caused by storing a
non-restricted pointer into a restricted field) in the IL at all, or that we
are propagating the restrict tags through the restricted field which we have
decided not to have a restrict tag for.  If it is a field that can have a
restrict tag safely attached to it (restrict field in a structure argument, or
DECL_BY_REFERENCE/restrict REFERENCE_TYPE argument pointed structure, or global
variable field, or perhaps automatic variable without address taken, the casts
for store to it should either not have (restr) at all, or at least should use
the same restrict tag as the field.  But if the field can't have safely a
restrict tag, if we make it up because of the casts for store to it, different
stores might be with different tags and if two different pointers alias and PTA
doesn't figure it out, we have expressions based on the same restricted field
with different restrict tags and miscompile.

Now the question is how to safely find out what is a cast for store from other
casts.  TYPE_RESTRICT casts from non-restrict pointers feeding one stmt which
stores it into restricted field?  Or should we just say such casts shouldn't be
in the IL?  Or should only TYPE_RESTRICT casts to SSA_NAMEs of non-artificial
vars be considered?

In the testcase, all the __restrict casts are casts for store into some field
that can't have safely a restrict tag attached:
  # PT = nonlocal escaped { D.7761 } (restr)
  data.11D.7427_92 = (const ScalarD.4717 * restrict) D.7426_91;
  # .MEMD.7374_151 = VDEF <.MEMD.7374_52>
  MEM[(struct MapBaseD.4571 *)&D.4884].m_dataD.4766 = data.11D.7427_92;


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