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 middle-end/42834] memcpy folding overeager



------- Comment #2 from rguenth at gcc dot gnu dot org  2010-01-22 12:29 -------
          /* With memcpy, it is possible to bypass aliasing rules, so without
             this check i.e. execute/20060930-2.c would be misoptimized,
             because it use conflicting alias set to hold argument for the
             memcpy call.  This check is probably unnecessary with
             -fno-strict-aliasing.  Similarly for destvar.  See also
             PR29286.  */
          else if (!var_decl_component_p (srcvar))
            srcvar = NULL_TREE;

this is ok for C but not enough for C++.  For C++ we need to unconditionally
zero srcvar with only the memcpy statement to look at.

A propagation pass might be able to figure out the dynamic type of the
memory we are copying.  Might fit well into a pass to propagate alignment
information.


-- 


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


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