This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/42834] memcpy folding overeager
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jan 2010 12:29:34 -0000
- Subject: [Bug middle-end/42834] memcpy folding overeager
- References: <bug-42834-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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